[llvm-commits] [llvm] r42751 - /llvm/trunk/lib/Target/TargetData.cpp

Dan Gohman djg at cray.com
Mon Oct 8 08:16:25 PDT 2007


Author: djg
Date: Mon Oct  8 10:16:25 2007
New Revision: 42751

URL: http://llvm.org/viewvc/llvm-project?rev=42751&view=rev
Log:
Simplify getIntPtrType, allowing it to work for arbitrary pointer sizes.

Modified:
    llvm/trunk/lib/Target/TargetData.cpp

Modified: llvm/trunk/lib/Target/TargetData.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetData.cpp?rev=42751&r1=42750&r2=42751&view=diff

==============================================================================
--- llvm/trunk/lib/Target/TargetData.cpp (original)
+++ llvm/trunk/lib/Target/TargetData.cpp Mon Oct  8 10:16:25 2007
@@ -565,12 +565,7 @@
 /// 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());
 }
 
 





More information about the llvm-commits mailing list