[vmkit-commits] [vmkit] r64762 - /vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp

Nicolas Geoffray nicolas.geoffray at lip6.fr
Tue Feb 17 03:45:08 PST 2009


Author: geoffray
Date: Tue Feb 17 05:45:03 2009
New Revision: 64762

URL: http://llvm.org/viewvc/llvm-project?rev=64762&view=rev
Log:
Put allocas from inline'd functions at the entry point of the function
so that Mem2Reg can run on them.


Modified:
    vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp

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

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp Tue Feb 17 05:45:03 2009
@@ -530,14 +530,30 @@
   for (uint32 i = 0; i < codeLen; ++i) {
     opcodeInfos[i].exceptionBlock = endExBlock;
   }
+
+  BasicBlock* firstBB = llvmFunction->begin();
   
-  for (int i = 0; i < maxLocals; i++) {
-    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));
+  if (firstBB->begin() != firstBB->end()) {
+    Instruction* firstInstruction = firstBB->begin();
+
+    for (int i = 0; i < maxLocals; i++) {
+      intLocals.push_back(new AllocaInst(Type::Int32Ty, "", firstInstruction));
+      doubleLocals.push_back(new AllocaInst(Type::DoubleTy, "",
+                                            firstInstruction));
+      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(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));
+    }
   }
   
   uint32 index = 0;





More information about the vmkit-commits mailing list