[vmkit-commits] [vmkit] r129249 - in /vmkit/trunk/lib/J3/Compiler: ExceptionsCheck.inc JavaJIT.cpp JavaJITOpcodes.cpp LLVMInfo.cpp LowerConstantCalls.cpp

Nicolas Geoffray nicolas.geoffray at lip6.fr
Sun Apr 10 10:40:22 PDT 2011


Author: geoffray
Date: Sun Apr 10 12:40:22 2011
New Revision: 129249

URL: http://llvm.org/viewvc/llvm-project?rev=129249&view=rev
Log:
Move to new LLVM API on PHINode::Create.


Modified:
    vmkit/trunk/lib/J3/Compiler/ExceptionsCheck.inc
    vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp
    vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp
    vmkit/trunk/lib/J3/Compiler/LLVMInfo.cpp
    vmkit/trunk/lib/J3/Compiler/LowerConstantCalls.cpp

Modified: vmkit/trunk/lib/J3/Compiler/ExceptionsCheck.inc
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/ExceptionsCheck.inc?rev=129249&r1=129248&r2=129249&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/ExceptionsCheck.inc (original)
+++ vmkit/trunk/lib/J3/Compiler/ExceptionsCheck.inc Sun Apr 10 12:40:22 2011
@@ -322,7 +322,7 @@
     ex->tester = createBasicBlock("testException");
     
     // PHI Node for the exception object
-    PHINode::Create(intrinsics->JavaObjectType, "", ex->tester);
+    PHINode::Create(intrinsics->JavaObjectType, 0, "", ex->tester);
     
     // Set the unwind destination of the instructions in the range of this
     // handler to the test block of the handler. If an instruction already has
@@ -344,7 +344,7 @@
     opcodeInfos[ex->handlerpc].handler = true;
     
     if (ex->javaHandler->empty()) {
-      PHINode::Create(intrinsics->JavaObjectType, "", ex->javaHandler);
+      PHINode::Create(intrinsics->JavaObjectType, 0, "", ex->javaHandler);
     }
 
   }

Modified: vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp?rev=129249&r1=129248&r2=129249&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp Sun Apr 10 12:40:22 2011
@@ -132,39 +132,6 @@
 
     BasicBlock* endBlock = 0;
     PHINode* node = 0;
-#if 0
-    // TODO: enable this only when inlining?
-    if (meth && !isAbstract(meth->access)) {
-      Value* cl = CallInst::Create(intrinsics->GetClassFunction, args[0], "",
-                                   currentBlock);
-      Value* cl2 = intrinsics->getNativeClass(meth->classDef);
-      if (cl2->getType() != intrinsics->JavaCommonClassType) {
-        cl2 = new BitCastInst(cl2, intrinsics->JavaCommonClassType, "", currentBlock);
-      }
-
-      Value* test = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, cl, cl2, "");
-
-      BasicBlock* trueBlock = createBasicBlock("true virtual invoke");
-      BasicBlock* falseBlock = createBasicBlock("false virtual invoke");
-      endBlock = createBasicBlock("end virtual invoke");
-      BranchInst::Create(trueBlock, falseBlock, test, currentBlock);
-      currentBlock = trueBlock;
-      Value* res = 0;
-      if (canBeInlined(meth)) {
-        res = invokeInline(meth, args);
-      } else {
-        Function* func = intrinsics->getMethod(meth);
-        res = invoke(func, args, "", currentBlock);
-      }
-      BranchInst::Create(endBlock, currentBlock);
-      if (retType != Type::getVoidTy(*llvmContext)) {
-        node = PHINode::Create(virtualType->getReturnType(), "", endBlock);
-        node->addIncoming(res, currentBlock);
-      }
-      currentBlock = falseBlock;
-    }
-#endif
-
     Value* indexes2[2];
     indexes2[0] = intrinsics->constantZero;
 
@@ -189,7 +156,7 @@
     
       BasicBlock* resolveVirtual = createBasicBlock("resolveVirtual");
       BasicBlock* endResolveVirtual = createBasicBlock("endResolveVirtual");
-      PHINode* node = PHINode::Create(Type::getInt32Ty(*llvmContext), "",
+      PHINode* node = PHINode::Create(Type::getInt32Ty(*llvmContext), 2, "",
                                       endResolveVirtual);
 
       Value* load = new LoadInst(GV, "", false, currentBlock);
@@ -402,7 +369,7 @@
   endBlock = createBasicBlock("end block");
   
   if (returnType != Type::getVoidTy(*llvmContext)) {
-    endNode = PHINode::Create(returnType, "", endBlock);
+    endNode = PHINode::Create(returnType, 0, "", endBlock);
   }
   
   // Allocate currentLocalIndexNumber pointer
@@ -448,7 +415,7 @@
       BasicBlock* BB = createBasicBlock("");
       BasicBlock* NotZero = createBasicBlock("");
       const Type* Ty = PointerType::getUnqual(intrinsics->JavaObjectType);
-      PHINode* node = PHINode::Create(Ty, "", BB);
+      PHINode* node = PHINode::Create(Ty, 2, "", BB);
 
       Value* test = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, i,
                                  intrinsics->JavaObjectNullConstant, "");
@@ -519,7 +486,7 @@
     BasicBlock* endBlock = createBasicBlock("");
     Value* test = new LoadInst(nativeFunc, "", currentBlock);
     const llvm::Type* Ty = test->getType();
-    PHINode* node = PHINode::Create(Ty, "", endBlock);
+    PHINode* node = PHINode::Create(Ty, 2, "", endBlock);
     node->addIncoming(test, currentBlock);
     Value* cmp = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, test,
                               Constant::getNullValue(Ty), "");
@@ -937,7 +904,7 @@
   exploreOpcodes(reader, codeLen);
 
   if (returnType != Type::getVoidTy(*llvmContext)) {
-    endNode = PHINode::Create(returnType, "", endBlock);
+    endNode = PHINode::Create(returnType, 0, "", endBlock);
   }
 
   reader.cursor = start;
@@ -1170,7 +1137,7 @@
   endBlock = createBasicBlock("end");
 
   if (returnType != Type::getVoidTy(*llvmContext)) {
-    endNode = llvm::PHINode::Create(returnType, "", endBlock);
+    endNode = llvm::PHINode::Create(returnType, 0, "", endBlock);
   }
   
   if (isSynchro(compilingMethod->access)) {
@@ -1666,7 +1633,7 @@
  
   BasicBlock* trueCl = createBasicBlock("UserCtp OK");
   BasicBlock* falseCl = createBasicBlock("UserCtp Not OK");
-  PHINode* node = llvm::PHINode::Create(Ty, "", trueCl);
+  PHINode* node = llvm::PHINode::Create(Ty, 2, "", trueCl);
   node->addIncoming(res, currentBlock);
   BranchInst::Create(falseCl, trueCl, test, currentBlock);
   std::vector<Value*> Args;
@@ -2326,7 +2293,7 @@
     
   // Block bb6 (label_bb6)
   currentBlock = label_bb6;
-  PHINode* ptr_table_0_lcssa = PHINode::Create(Ty, "table.0.lcssa",
+  PHINode* ptr_table_0_lcssa = PHINode::Create(Ty, 2, "table.0.lcssa",
                                                currentBlock);
   ptr_table_0_lcssa->reserveOperandSpace(2);
   ptr_table_0_lcssa->addIncoming(ptr_26, label_bb4);
@@ -2572,8 +2539,8 @@
                                         currentBlock);
   BranchInst::Create(label_bb11, label_backward, cmp, currentBlock);
 
-  PHINode* phi_dst_ptr = PHINode::Create(ptr_44->getType(), "", label_bb11);
-  PHINode* phi_src_ptr = PHINode::Create(ptr_44->getType(), "", label_bb11);
+  PHINode* phi_dst_ptr = PHINode::Create(ptr_44->getType(), 3, "", label_bb11);
+  PHINode* phi_src_ptr = PHINode::Create(ptr_44->getType(), 3, "", label_bb11);
   phi_dst_ptr->addIncoming(ptr_44, currentBlock);
   phi_src_ptr->addIncoming(ptr_42, currentBlock);
  
@@ -2600,9 +2567,8 @@
   // Block bb11 (label_bb11)
   currentBlock = label_bb11;
   Argument* fwdref_39 = new Argument(Type::getInt32Ty(*llvmContext));
-  PHINode* int32_i_016 = PHINode::Create(Type::getInt32Ty(*llvmContext),
+  PHINode* int32_i_016 = PHINode::Create(Type::getInt32Ty(*llvmContext), 2,
                                          "i.016", label_bb11);
-  int32_i_016->reserveOperandSpace(2);
   int32_i_016->addIncoming(fwdref_39, label_bb11);
   int32_i_016->addIncoming(intrinsics->constantZero, log_label_bb);
    

Modified: vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp?rev=129249&r1=129248&r2=129249&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp Sun Apr 10 12:40:22 2011
@@ -1011,7 +1011,7 @@
         BasicBlock* ifFalse = createBasicBlock("non -1 div");
         BasicBlock* ifTrue = createBasicBlock("-1 div");
         BasicBlock* endBlock = createBasicBlock("End division");
-        PHINode* node = PHINode::Create(val1->getType(), "", endBlock);
+        PHINode* node = PHINode::Create(val1->getType(), 2, "", endBlock);
         BranchInst::Create(ifTrue, ifFalse, cmp, currentBlock);
         currentBlock = ifTrue;
         node->addIncoming(BinaryOperator::CreateSub(intrinsics->constantZero,
@@ -1087,7 +1087,7 @@
                                   intrinsics->constantMinusOne, "");
         BasicBlock* ifFalse = createBasicBlock("non -1 rem");
         BasicBlock* endBlock = createBasicBlock("end block");
-        PHINode* node = PHINode::Create(val1->getType(), "", endBlock);
+        PHINode* node = PHINode::Create(val1->getType(), 2, "", endBlock);
         node->addIncoming(intrinsics->constantZero, currentBlock);
         BranchInst::Create(endBlock, ifFalse, cmp, currentBlock);
         currentBlock = ifFalse;
@@ -1340,7 +1340,7 @@
                                          val, val, "");
         
         BasicBlock* res = createBasicBlock("F2I");
-        PHINode* node = PHINode::Create(llvm::Type::getInt32Ty(*llvmContext), "", res);
+        PHINode* node = PHINode::Create(llvm::Type::getInt32Ty(*llvmContext), 4, "", res);
         node->addIncoming(intrinsics->constantZero, currentBlock);
         BasicBlock* cont = createBasicBlock("F2I");
 
@@ -1386,7 +1386,7 @@
                                          val, val, "");
         
         BasicBlock* res = createBasicBlock("F2L");
-        PHINode* node = PHINode::Create(llvm::Type::getInt64Ty(*llvmContext), "", res);
+        PHINode* node = PHINode::Create(Type::getInt64Ty(*llvmContext), 4, "", res);
         node->addIncoming(intrinsics->constantLongZero, currentBlock);
         BasicBlock* cont = createBasicBlock("F2L");
 
@@ -1439,7 +1439,7 @@
                                          val, val, "");
         
         BasicBlock* res = createBasicBlock("D2I");
-        PHINode* node = PHINode::Create(llvm::Type::getInt32Ty(*llvmContext), "", res);
+        PHINode* node = PHINode::Create(Type::getInt32Ty(*llvmContext), 4, "", res);
         node->addIncoming(intrinsics->constantZero, currentBlock);
         BasicBlock* cont = createBasicBlock("D2I");
 
@@ -1486,7 +1486,7 @@
                                          val, val, "");
         
         BasicBlock* res = createBasicBlock("D2L");
-        PHINode* node = PHINode::Create(llvm::Type::getInt64Ty(*llvmContext), "", res);
+        PHINode* node = PHINode::Create(Type::getInt64Ty(*llvmContext), 4, "", res);
         node->addIncoming(intrinsics->constantLongZero, currentBlock);
         BasicBlock* cont = createBasicBlock("D2L");
 
@@ -1574,7 +1574,7 @@
         
         BasicBlock* cont = createBasicBlock("LCMP");
         BasicBlock* res = createBasicBlock("LCMP");
-        PHINode* node = PHINode::Create(llvm::Type::getInt32Ty(*llvmContext), "", res);
+        PHINode* node = PHINode::Create(Type::getInt32Ty(*llvmContext), 2, "", res);
         node->addIncoming(intrinsics->constantZero, currentBlock);
         
         BranchInst::Create(res, cont, test, currentBlock);
@@ -2211,7 +2211,7 @@
         Value* cmp = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, obj,
                                   intrinsics->JavaObjectNullConstant, "");
         BasicBlock* endBlock = createBasicBlock("end type compare");
-        PHINode* node = PHINode::Create(Type::getInt1Ty(*llvmContext), "", endBlock);
+        PHINode* node = PHINode::Create(Type::getInt1Ty(*llvmContext), 2, "", endBlock);
         
         if (checkcast) {
           exceptionCheckcast = createBasicBlock("false checkcast");

Modified: vmkit/trunk/lib/J3/Compiler/LLVMInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/LLVMInfo.cpp?rev=129249&r1=129248&r2=129249&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/LLVMInfo.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/LLVMInfo.cpp Sun Apr 10 12:40:22 2011
@@ -369,7 +369,7 @@
                                 arg, "");
       BasicBlock* endBlock = BasicBlock::Create(context, "end", res);
       BasicBlock* loadBlock = BasicBlock::Create(context, "load", res);
-      PHINode* node = PHINode::Create(Intrinsics.JavaObjectType, "",
+      PHINode* node = PHINode::Create(Intrinsics.JavaObjectType, 2, "",
                                       endBlock);
       node->addIncoming(Intrinsics.JavaObjectNullConstant, currentBlock);
       BranchInst::Create(endBlock, loadBlock, cmp, currentBlock);
@@ -459,7 +459,7 @@
                                 arg, "");
       BasicBlock* endBlock = BasicBlock::Create(context, "end", res);
       BasicBlock* loadBlock = BasicBlock::Create(context, "load", res);
-      PHINode* node = PHINode::Create(Intrinsics.JavaObjectType, "",
+      PHINode* node = PHINode::Create(Intrinsics.JavaObjectType, 2, "",
                                       endBlock);
       node->addIncoming(Intrinsics.JavaObjectNullConstant, currentBlock);
       BranchInst::Create(endBlock, loadBlock, cmp, currentBlock);
@@ -519,7 +519,7 @@
   BasicBlock* callBlock = BasicBlock::Create(context, "call", stub);
   PHINode* node = NULL;
   if (!signature->getReturnType()->isVoid()) {
-    node = PHINode::Create(stub->getReturnType(), "", endBlock);
+    node = PHINode::Create(stub->getReturnType(), 2, "", endBlock);
   }
     
 

Modified: vmkit/trunk/lib/J3/Compiler/LowerConstantCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/LowerConstantCalls.cpp?rev=129249&r1=129248&r2=129249&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/LowerConstantCalls.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/LowerConstantCalls.cpp Sun Apr 10 12:40:22 2011
@@ -385,7 +385,7 @@
           BasicBlock* NoDelegatee = BasicBlock::Create(*Context, "No delegatee", &F);
           BasicBlock* DelegateeOK = BasicBlock::Create(*Context, "Delegatee OK", &F);
           BranchInst::Create(NoDelegatee, DelegateeOK, cmp, CI);
-          PHINode* phi = PHINode::Create(intrinsics->JavaObjectType, "", DelegateeOK);
+          PHINode* phi = PHINode::Create(intrinsics->JavaObjectType, 2, "", DelegateeOK);
           phi->addIncoming(Del, CI->getParent());
           
           Instruction* Res = CallInst::Create(intrinsics->RuntimeDelegateeFunction,
@@ -424,7 +424,7 @@
           
           BasicBlock* trueCl = BasicBlock::Create(*Context, "Initialized", &F);
           BasicBlock* falseCl = BasicBlock::Create(*Context, "Uninitialized", &F);
-          PHINode* node = llvm::PHINode::Create(intrinsics->JavaClassType, "", trueCl);
+          PHINode* node = llvm::PHINode::Create(intrinsics->JavaClassType, 2, "", trueCl);
           node->addIncoming(Cl, CI->getParent());
           BranchInst::Create(trueCl, falseCl, test, CI);
   
@@ -504,7 +504,7 @@
  
           BasicBlock* trueCl = BasicBlock::Create(*Context, "Ctp OK", &F);
           BasicBlock* falseCl = BasicBlock::Create(*Context, "Ctp Not OK", &F);
-          PHINode* node = llvm::PHINode::Create(returnType, "", trueCl);
+          PHINode* node = llvm::PHINode::Create(returnType, 2, "", trueCl);
           node->addIncoming(arg1, CI->getParent());
           BranchInst::Create(falseCl, trueCl, test, CI);
   
@@ -573,7 +573,7 @@
 
             BasicBlock* OKBlock = BasicBlock::Create(*Context, "", &F);
             BasicBlock* NotOKBlock = BasicBlock::Create(*Context, "", &F);
-            PHINode* node = PHINode::Create(intrinsics->VTType, "",
+            PHINode* node = PHINode::Create(intrinsics->VTType, 2, "",
                                             OKBlock);
             node->addIncoming(LoadedGV, CI->getParent());
 
@@ -617,7 +617,7 @@
           
           BasicBlock* CurEndBlock = BasicBlock::Create(*Context, "", &F);
           BasicBlock* FailedBlock = BasicBlock::Create(*Context, "", &F);
-          PHINode* node = PHINode::Create(Type::getInt1Ty(*Context), "", CurEndBlock);
+          PHINode* node = PHINode::Create(Type::getInt1Ty(*Context), 2, "", CurEndBlock);
 
           ConstantInt* CC = ConstantInt::get(Type::getInt32Ty(*Context),
               JavaVirtualTable::getOffsetIndex());
@@ -673,7 +673,7 @@
           BasicBlock* BB9 = BasicBlock::Create(*Context, "BB9", &F);
           const Type* Ty = PointerType::getUnqual(intrinsics->VTType);
           
-          PHINode* resFwd = PHINode::Create(Type::getInt32Ty(*Context), "", BB7);
+          PHINode* resFwd = PHINode::Create(Type::getInt32Ty(*Context), 2, "", BB7);
    
           // This corresponds to:
           //    if (VT1.cache == VT2 || VT1 == VT2) goto end with true;
@@ -738,7 +738,6 @@
           // endLoopTest:
           //    if (i < size) goto test
           //    else goto end with false
-          resFwd->reserveOperandSpace(2);
           resFwd->addIncoming(intrinsics->constantZero, Preheader);
           resFwd->addIncoming(IndVar, BB6);
     
@@ -753,8 +752,7 @@
           BranchInst::Create(BB9, BB5);
 
           // Final block, that gets the result.
-          PHINode* node = PHINode::Create(Type::getInt1Ty(*Context), "", BB9);
-          node->reserveOperandSpace(3);
+          PHINode* node = PHINode::Create(Type::getInt1Ty(*Context), 3, "", BB9);
           node->addIncoming(ConstantInt::getTrue(*Context), CI->getParent());
           node->addIncoming(ConstantInt::getFalse(*Context), BB7);
           node->addIncoming(ConstantInt::getTrue(*Context), BB5);





More information about the vmkit-commits mailing list