summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2013-07-26 17:37:20 +0000
committerMatt Arsenault <Matthew.Arsenault@amd.com>2013-07-26 17:37:20 +0000
commit58376d8ede436eb1fe474bca1582a4f7afe613f9 (patch)
treec02eca1bc60eac9b2ff7d3ac2e616490986e875d /include
parent2dd272f89638887f1ad086b7cac86e8d3058f13b (diff)
downloadllvm-58376d8ede436eb1fe474bca1582a4f7afe613f9.tar.gz
llvm-58376d8ede436eb1fe474bca1582a4f7afe613f9.tar.bz2
llvm-58376d8ede436eb1fe474bca1582a4f7afe613f9.tar.xz
Re-add DataLayout pointer size convenience functions.
These were reverted in r167222 along with the rest of the last different address space pointer size attempt. These will be used in later commits. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187223 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/IR/DataLayout.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/llvm/IR/DataLayout.h b/include/llvm/IR/DataLayout.h
index c15591b6d2..269edeb9f3 100644
--- a/include/llvm/IR/DataLayout.h
+++ b/include/llvm/IR/DataLayout.h
@@ -271,6 +271,18 @@ public:
unsigned getPointerSizeInBits(unsigned AS = 0) const {
return getPointerSize(AS) * 8;
}
+
+ /// Layout pointer size, in bits, based on the type. If this function is
+ /// called with a pointer type, then the type size of the pointer is returned.
+ /// If this function is called with a vector of pointers, then the type size
+ /// of the pointer is returned. This should only be called with a pointer or
+ /// vector of pointers.
+ unsigned getPointerTypeSizeInBits(Type *) const;
+
+ unsigned getPointerTypeSize(Type *Ty) const {
+ return getPointerTypeSizeInBits(Ty) / 8;
+ }
+
/// Size examples:
///
/// Type SizeInBits StoreSizeInBits AllocSizeInBits[*]