[vmkit-commits] [vmkit] r76372 - in /vmkit/trunk/lib: JnJVM/Compiler/JavaAOTCompiler.cpp JnJVM/Compiler/JavaJIT.cpp Mvm/Compiler/EscapeAnalysis.cpp N3/VMCore/CLIJit.cpp N3/VMCore/Opcodes.cpp

Nicolas Geoffray nicolas.geoffray at lip6.fr
Sun Jul 19 10:00:30 PDT 2009


Author: geoffray
Date: Sun Jul 19 12:00:30 2009
New Revision: 76372

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


Modified:
    vmkit/trunk/lib/JnJVM/Compiler/JavaAOTCompiler.cpp
    vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.cpp
    vmkit/trunk/lib/Mvm/Compiler/EscapeAnalysis.cpp
    vmkit/trunk/lib/N3/VMCore/CLIJit.cpp
    vmkit/trunk/lib/N3/VMCore/Opcodes.cpp

Modified: vmkit/trunk/lib/JnJVM/Compiler/JavaAOTCompiler.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Compiler/JavaAOTCompiler.cpp?rev=76372&r1=76371&r2=76372&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/JavaAOTCompiler.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/JavaAOTCompiler.cpp Sun Jul 19 12:00:30 2009
@@ -763,7 +763,7 @@
   assert(ATy && "Malformed type");
 
   Constant* TCM[1] = { getJavaClass(cl) };
-  CommonClassElts.push_back(ConstantArray::get(ATy, TCM, 1));
+  CommonClassElts.push_back(Context.getConstantArray(ATy, TCM, 1));
   
   // access
   CommonClassElts.push_back(Context.getConstantInt(Type::Int16Ty, cl->access));
@@ -1022,7 +1022,7 @@
   TempElts.push_back(getStaticInstance(cl));
   Constant* CStr[1] = { ConstantStruct::get(TCMTy, TempElts) };
   TempElts.clear();
-  ClassElts.push_back(ConstantArray::get(ATy, CStr, 1));
+  ClassElts.push_back(Context.getConstantArray(ATy, CStr, 1));
 
   // thinlock
   ClassElts.push_back(Context.getNullValue(JnjvmModule::ptrType));

Modified: vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.cpp?rev=76372&r1=76371&r2=76372&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.cpp Sun Jul 19 12:00:30 2009
@@ -280,13 +280,12 @@
   endBlock = createBasicBlock("end block");
       
   // Allocate currentLocalIndexNumber pointer
-  Value* temp = new AllocaInst(*llvmContext, Type::Int32Ty, "",
+  Value* temp = new AllocaInst(Type::Int32Ty, "",
                                currentBlock);
   new StoreInst(module->constantZero, temp, false, currentBlock);
   
   // Allocate oldCurrentLocalIndexNumber pointer
-  Value* oldCLIN = new AllocaInst(*llvmContext, 
-                                  PointerType::getUnqual(Type::Int32Ty), "",
+  Value* oldCLIN = new AllocaInst(PointerType::getUnqual(Type::Int32Ty), "",
                                   currentBlock);
 
   Value* Args2[2] = { temp, oldCLIN };
@@ -357,7 +356,7 @@
 
       currentBlock = NotZero;
 
-      Value* temp = new AllocaInst(*llvmContext, module->JavaObjectType, "",
+      Value* temp = new AllocaInst(module->JavaObjectType, "",
                                    currentBlock);
       new StoreInst(i, temp, false, currentBlock);
       node->addIncoming(temp, currentBlock);
@@ -408,7 +407,7 @@
   // this problem because it passes first arguments in registers.
   // Therefore, it was overwriting the frame pointer when entering the
   // native method.
-  Value* Temp = new AllocaInst(*llvmContext, module->ptrType, "", currentBlock);
+  Value* Temp = new AllocaInst(module->ptrType, "", currentBlock);
   new StoreInst(FrameAddr, Temp, currentBlock);
   Value* result = llvm::CallInst::Create(nativeFunc, nativeArgs.begin(),
                                          nativeArgs.end(), "", currentBlock);
@@ -691,21 +690,21 @@
     Instruction* firstInstruction = firstBB->begin();
 
     for (int i = 0; i < maxLocals; i++) {
-      intLocals.push_back(new AllocaInst(*llvmContext, Type::Int32Ty, "", firstInstruction));
-      doubleLocals.push_back(new AllocaInst(*llvmContext, Type::DoubleTy, "",
+      intLocals.push_back(new AllocaInst(Type::Int32Ty, "", firstInstruction));
+      doubleLocals.push_back(new AllocaInst(Type::DoubleTy, "",
                                             firstInstruction));
-      longLocals.push_back(new AllocaInst(*llvmContext, Type::Int64Ty, "", firstInstruction));
-      floatLocals.push_back(new AllocaInst(*llvmContext, Type::FloatTy, "", firstInstruction));
-      objectLocals.push_back(new AllocaInst(*llvmContext, module->JavaObjectType, "",
+      longLocals.push_back(new AllocaInst(Type::Int64Ty, "", firstInstruction));
+      floatLocals.push_back(new AllocaInst(Type::FloatTy, "", firstInstruction));
+      objectLocals.push_back(new AllocaInst(module->JavaObjectType, "",
                                           firstInstruction));
     }
   } else {
     for (int i = 0; i < maxLocals; i++) {
-      intLocals.push_back(new AllocaInst(*llvmContext, Type::Int32Ty, "", firstBB));
-      doubleLocals.push_back(new AllocaInst(*llvmContext, Type::DoubleTy, "", firstBB));
-      longLocals.push_back(new AllocaInst(*llvmContext, Type::Int64Ty, "", firstBB));
-      floatLocals.push_back(new AllocaInst(*llvmContext, Type::FloatTy, "", firstBB));
-      objectLocals.push_back(new AllocaInst(*llvmContext, module->JavaObjectType, "",
+      intLocals.push_back(new AllocaInst(Type::Int32Ty, "", firstBB));
+      doubleLocals.push_back(new AllocaInst(Type::DoubleTy, "", firstBB));
+      longLocals.push_back(new AllocaInst(Type::Int64Ty, "", firstBB));
+      floatLocals.push_back(new AllocaInst(Type::FloatTy, "", firstBB));
+      objectLocals.push_back(new AllocaInst(module->JavaObjectType, "",
                                             firstBB));
     }
   }
@@ -829,11 +828,11 @@
   
 
   for (int i = 0; i < maxLocals; i++) {
-    intLocals.push_back(new AllocaInst(*llvmContext, Type::Int32Ty, "", currentBlock));
-    doubleLocals.push_back(new AllocaInst(*llvmContext, Type::DoubleTy, "", currentBlock));
-    longLocals.push_back(new AllocaInst(*llvmContext, Type::Int64Ty, "", currentBlock));
-    floatLocals.push_back(new AllocaInst(*llvmContext, Type::FloatTy, "", currentBlock));
-    objectLocals.push_back(new AllocaInst(*llvmContext, module->JavaObjectType, "",
+    intLocals.push_back(new AllocaInst(Type::Int32Ty, "", currentBlock));
+    doubleLocals.push_back(new AllocaInst(Type::DoubleTy, "", currentBlock));
+    longLocals.push_back(new AllocaInst(Type::Int64Ty, "", currentBlock));
+    floatLocals.push_back(new AllocaInst(Type::FloatTy, "", currentBlock));
+    objectLocals.push_back(new AllocaInst(module->JavaObjectType, "",
                                           currentBlock));
   }
 
@@ -885,7 +884,7 @@
 
 #if defined(ISOLATE_SHARING)
   ctpCache = i;
-  Value* addrCtpCache = new AllocaInst(*llvmContext, module->ConstantPoolType, "",
+  Value* addrCtpCache = new AllocaInst(module->ConstantPoolType, "",
                                        currentBlock);
   /// make it volatile to be sure it's on the stack
   new StoreInst(ctpCache, addrCtpCache, true, currentBlock);

Modified: vmkit/trunk/lib/Mvm/Compiler/EscapeAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Compiler/EscapeAnalysis.cpp?rev=76372&r1=76371&r2=76372&view=diff

==============================================================================
--- vmkit/trunk/lib/Mvm/Compiler/EscapeAnalysis.cpp (original)
+++ vmkit/trunk/lib/Mvm/Compiler/EscapeAnalysis.cpp Sun Jul 19 12:00:30 2009
@@ -168,7 +168,6 @@
 bool EscapeAnalysis::processMalloc(Instruction* I, Value* Size, Value* VT,
                                    Loop* CurLoop) {
   Instruction* Alloc = I;
-  LLVMContext* Context = I->getParent()->getContext();
   
   ConstantInt* CI = dyn_cast<ConstantInt>(Size);
   bool hasFinalizer = true;
@@ -220,7 +219,7 @@
         BB->getInstList().insert(BB->getTerminator(), Alloc);
       }
 
-      AllocaInst* AI = new AllocaInst(*Context, Type::Int8Ty, Size, "", Alloc);
+      AllocaInst* AI = new AllocaInst(Type::Int8Ty, Size, "", Alloc);
       BitCastInst* BI = new BitCastInst(AI, Alloc->getType(), "", Alloc);
       DOUT << "escape" << Alloc->getParent()->getParent()->getName() << "\n";
       Alloc->replaceAllUsesWith(BI);

Modified: vmkit/trunk/lib/N3/VMCore/CLIJit.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/CLIJit.cpp?rev=76372&r1=76371&r2=76372&view=diff

==============================================================================
--- vmkit/trunk/lib/N3/VMCore/CLIJit.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/CLIJit.cpp Sun Jul 19 12:00:30 2009
@@ -625,7 +625,7 @@
     return;
 
   } else if (type->super == MSCorlib::pValue || type->super == MSCorlib::pEnum) {
-    obj = new AllocaInst(*(llvmFunction->getContext()), type->naturalType, "", currentBlock);
+    obj = new AllocaInst(type->naturalType, "", currentBlock);
     uint64 size = module->getTypeSize(type->naturalType);
         
     std::vector<Value*> params;
@@ -978,7 +978,7 @@
   }
   
    if (nbe) {
-    supplLocal = new AllocaInst(*(llvmFunction->getContext()), VMObject::llvmType, "exceptionVar",
+    supplLocal = new AllocaInst(VMObject::llvmType, "exceptionVar",
                                 currentBlock);
   }
   
@@ -1210,7 +1210,7 @@
     
     const Type* cur = i->getType();
 
-    AllocaInst* alloc = new AllocaInst(*(llvmFunction->getContext()), cur, "", currentBlock);
+    AllocaInst* alloc = new AllocaInst(cur, "", currentBlock);
     new StoreInst(i, alloc, false, currentBlock);
     arguments.push_back(alloc);
   } 
@@ -1223,7 +1223,7 @@
             e = temp.end(); i!= e; ++i) {
       VMCommonClass* cl = *i;
       cl->resolveType(false, false, genMethod);
-      AllocaInst* alloc = new AllocaInst(*(llvmFunction->getContext()), cl->naturalType, "", currentBlock);
+      AllocaInst* alloc = new AllocaInst(cl->naturalType, "", currentBlock);
       if (cl->naturalType->isSingleValueType()) {
         new StoreInst(llvmFunction->getContext()->getNullValue(cl->naturalType), alloc, false,
                       currentBlock);
@@ -1387,7 +1387,7 @@
     
     const Type* cur = (*i)->getType();
 
-    AllocaInst* alloc = new AllocaInst(*(llvmFunction->getContext()), cur, "", currentBlock);
+    AllocaInst* alloc = new AllocaInst(cur, "", currentBlock);
     new StoreInst(*i, alloc, false, currentBlock);
     arguments.push_back(alloc);
   } 
@@ -1400,7 +1400,7 @@
             e = temp.end(); i!= e; ++i) {
       VMCommonClass* cl = *i;
       cl->resolveType(false, false, genMethod);
-      AllocaInst* alloc = new AllocaInst(*(llvmFunction->getContext()), cl->naturalType, "", currentBlock);
+      AllocaInst* alloc = new AllocaInst(cl->naturalType, "", currentBlock);
       if (cl->naturalType->isSingleValueType()) {
         new StoreInst(llvmFunction->getContext()->getNullValue(cl->naturalType), alloc, false,
                       currentBlock);
@@ -1623,7 +1623,7 @@
       funcType = funcType->getContainedType(0);
     }
     const Type* lastType = funcType->getContainedType(funcType->getNumContainedTypes() - 1);
-    ret = new AllocaInst(*(llvmFunction->getContext()), lastType->getContainedType(0), "", InsertAtEnd);
+    ret = new AllocaInst(lastType->getContainedType(0), "", InsertAtEnd);
     args.push_back(ret);
   }
   Value* val = 0;
@@ -1655,7 +1655,7 @@
       funcType = funcType->getContainedType(0);
     }
     const Type* lastType = funcType->getContainedType(funcType->getNumContainedTypes() - 1);
-    ret = new AllocaInst(*(llvmFunction->getContext()), lastType->getContainedType(0), "", InsertAtEnd);
+    ret = new AllocaInst(lastType->getContainedType(0), "", InsertAtEnd);
     args.push_back(ret);
   }
   
@@ -1692,7 +1692,7 @@
       funcType = funcType->getContainedType(0);
     }
     const Type* lastType = funcType->getContainedType(funcType->getNumContainedTypes() - 1);
-    ret = new AllocaInst(*(llvmFunction->getContext()), lastType->getContainedType(0), "", InsertAtEnd);
+    ret = new AllocaInst(lastType->getContainedType(0), "", InsertAtEnd);
     args.push_back(ret);
   }
 
@@ -1721,7 +1721,7 @@
       funcType = funcType->getContainedType(0);
     }
     const Type* lastType = funcType->getContainedType(funcType->getNumContainedTypes() - 1);
-    ret = new AllocaInst(*(llvmFunction->getContext()), lastType->getContainedType(0), "", InsertAtEnd);
+    ret = new AllocaInst(lastType->getContainedType(0), "", InsertAtEnd);
     args.push_back(ret);
   }
 

Modified: vmkit/trunk/lib/N3/VMCore/Opcodes.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/Opcodes.cpp?rev=76372&r1=76371&r2=76372&view=diff

==============================================================================
--- vmkit/trunk/lib/N3/VMCore/Opcodes.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/Opcodes.cpp Sun Jul 19 12:00:30 2009
@@ -191,7 +191,7 @@
     return new LoadInst(val, name, currentBlock);
   } else {
     uint64 size = module->getTypeSize(contained);
-    Value* ret = new AllocaInst(*(llvmFunction->getContext()), contained, "", currentBlock); 
+    Value* ret = new AllocaInst(contained, "", currentBlock); 
     std::vector<Value*> params;
     params.push_back(new BitCastInst(ret, PointerType::getUnqual(Type::Int8Ty), "", currentBlock));
     params.push_back(new BitCastInst(val, PointerType::getUnqual(Type::Int8Ty), "", currentBlock));
@@ -1302,7 +1302,7 @@
 
         if (val->getType()->getTypeID() != Type::PointerTyID) {
           convertValue(val, type->naturalType, currentBlock); 
-          Value* tmp = new AllocaInst(*(llvmFunction->getContext()), type->naturalType, "", currentBlock);
+          Value* tmp = new AllocaInst(type->naturalType, "", currentBlock);
           new StoreInst(val, tmp, false, currentBlock);
           val = tmp;
         }
@@ -1794,7 +1794,7 @@
                                                  true, genClass, genMethod);
         assert(type);
 
-        Value* val = new AllocaInst(*(llvmFunction->getContext()), type->naturalType, "", currentBlock);
+        Value* val = new AllocaInst(type->naturalType, "", currentBlock);
         Value* obj = pop();
 
         if (obj->getType() != type->virtualType) {
@@ -1924,7 +1924,7 @@
           }
           
           case LOCALLOC : {
-            push(new AllocaInst(*(llvmFunction->getContext()), Type::Int8Ty, pop(), "", currentBlock));
+            push(new AllocaInst(Type::Int8Ty, pop(), "", currentBlock));
             break;
           }
           





More information about the vmkit-commits mailing list