[llvm-branch-commits] [llvm-gcc-branch] r79645 - /llvm-gcc-4.2/branches/Apple/Bender-SWB/gcc/llvm-convert.cpp

Bill Wendling isanbard at gmail.com
Fri Aug 21 10:50:20 PDT 2009


Author: void
Date: Fri Aug 21 12:50:20 2009
New Revision: 79645

URL: http://llvm.org/viewvc/llvm-project?rev=79645&view=rev
Log:
Make switch less gross. By Duncan.

Modified:
    llvm-gcc-4.2/branches/Apple/Bender-SWB/gcc/llvm-convert.cpp

Modified: llvm-gcc-4.2/branches/Apple/Bender-SWB/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Bender-SWB/gcc/llvm-convert.cpp?rev=79645&r1=79644&r2=79645&view=diff

==============================================================================
--- llvm-gcc-4.2/branches/Apple/Bender-SWB/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/branches/Apple/Bender-SWB/gcc/llvm-convert.cpp Fri Aug 21 12:50:20 2009
@@ -3319,17 +3319,9 @@
   Value *Amt = Emit(TREE_OPERAND(exp, 1), 0);
 
   if (isa<PointerType>(In->getType())) {
-    const Type *Ty = 0;
-
-    switch (getInt64(TYPE_SIZE (TREE_TYPE (TREE_OPERAND (exp, 0))), true)) {
-    default: assert(0 && "Pointer size in bits not a power of 2!");
-    case 1:  Ty = Type::getInt1Ty(Context);  break;
-    case 8:  Ty = Type::getInt8Ty(Context);  break;
-    case 16: Ty = Type::getInt16Ty(Context); break;
-    case 32: Ty = Type::getInt32Ty(Context); break;
-    case 64: Ty = Type::getInt64Ty(Context); break;
-    }
-
+    const Type *Ty =
+      IntegerType::get(Context,
+                       TYPE_PRECISION(TREE_TYPE (TREE_OPERAND (exp, 0))));
     In = Builder.CreatePtrToInt(In, Ty,
                                 (In->getNameStr()+".cast").c_str());
   }





More information about the llvm-branch-commits mailing list