Simplify getIntPtrType, allowing it to work for arbitrary pointer sizes.
authorDan Gohman <gohman@apple.com>
Mon, 8 Oct 2007 15:16:25 +0000 (15:16 +0000)
committerDan Gohman <gohman@apple.com>
Mon, 8 Oct 2007 15:16:25 +0000 (15:16 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42751 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/TargetData.cpp

index 0bdb23b5b74e4a9e66443eb9ebb82d02108185b9..b2d76d841807ce48b46e6b4e720b0e9daada67d4 100644 (file)
@@ -565,12 +565,7 @@ unsigned char TargetData::getPreferredTypeAlignmentShift(const Type *Ty) const {
 /// getIntPtrType - Return an unsigned integer type that is the same size or
 /// greater to the host pointer size.
 const Type *TargetData::getIntPtrType() const {
-  switch (getPointerSize()) {
-  default: assert(0 && "Unknown pointer size!");
-  case 2: return Type::Int16Ty;
-  case 4: return Type::Int32Ty;
-  case 8: return Type::Int64Ty;
-  }
+  return IntegerType::get(getPointerSizeInBits());
 }