[llvm-commits] [llvm-gcc-4.2] r91955 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

Eric Christopher echristo at apple.com
Tue Dec 22 16:31:11 PST 2009


Author: echristo
Date: Tue Dec 22 18:31:11 2009
New Revision: 91955

URL: http://llvm.org/viewvc/llvm-project?rev=91955&view=rev
Log:
Update llvm-convert for bitcode changes.  Convert last argument to
a boolean.

Modified:
    llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=91955&r1=91954&r2=91955&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Tue Dec 22 18:31:11 2009
@@ -4972,9 +4972,21 @@
     tree Object = TREE_VALUE(arglist);
     tree ObjTy = TREE_VALUE(TREE_CHAIN(arglist));
 
+    // LLVM doesn't handle type 1 or type 3. Deal with that here.
+    Value *Tmp = Emit(ObjTy, 0);
+    
+    ConstantInt *CI = dyn_cast<ConstantInt>(Tmp);
+    assert(CI);
+    
+    // Clear the bottom bit since we only handle whole objects and shift to turn
+    // the second bit into our boolean.
+    uint64_t val = (CI->getZExtValue() & 0x2) >> 1;
+    
+    Value *NewTy = ConstantInt::get(Tmp->getType(), val);
+    
     Value* Args[] = {
       Emit(Object, 0),
-      Emit(ObjTy, 0)
+      NewTy
     };
 
     // Grab the current return type.
@@ -4987,10 +4999,10 @@
                                     false);
 
     Result = Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
-							  Intrinsic::objectsize,
-							  &Ty,
-							  1),
-				Args, Args + 2);
+                                                          Intrinsic::objectsize,
+                                                          &Ty,
+                                                          1),
+                                Args, Args + 2);
     return true;
   }
   // Unary bit counting intrinsics.





More information about the llvm-commits mailing list