[vmkit-commits] [vmkit] r86843 - /vmkit/trunk/lib/Mvm/Compiler/JIT.cpp

Nicolas Geoffray nicolas.geoffray at lip6.fr
Wed Nov 11 08:52:06 PST 2009


Author: geoffray
Date: Wed Nov 11 10:52:06 2009
New Revision: 86843

URL: http://llvm.org/viewvc/llvm-project?rev=86843&view=rev
Log:
Mimic LLVM optimization passes.


Modified:
    vmkit/trunk/lib/Mvm/Compiler/JIT.cpp

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

==============================================================================
--- vmkit/trunk/lib/Mvm/Compiler/JIT.cpp (original)
+++ vmkit/trunk/lib/Mvm/Compiler/JIT.cpp Wed Nov 11 10:52:06 2009
@@ -81,7 +81,7 @@
         GFI = *I;
       }
       MethodInfo* MI =
-        new(MvmModule::Allocator, "MvmJITMethodInfo") MvmJITMethodInfo(GFI, &F);
+        new(*MvmModule::Allocator, "MvmJITMethodInfo") MvmJITMethodInfo(GFI, &F);
       VirtualMachine::SharedRuntimeFunctions.addMethodInfo(MI, Code,
                                               (void*)((uintptr_t)Code + Size));
     }
@@ -127,6 +127,7 @@
     executionEngine = ExecutionEngine::createJIT(globalModuleProvider, 0,
                                                  0, level, false);
 
+    Allocator = new BumpPtrAllocator();
     executionEngine->RegisterJITEventListener(&JITListener);    
     executionEngine->DisableLazyCompilation(false); 
     std::string str = 
@@ -447,7 +448,7 @@
 llvm::FunctionPassManager* MvmModule::globalFunctionPasses;
 llvm::ExecutionEngine* MvmModule::executionEngine;
 mvm::LockRecursive MvmModule::protectEngine;
-mvm::BumpPtrAllocator MvmModule::Allocator;
+mvm::BumpPtrAllocator* MvmModule::Allocator;
 
 uint64 MvmModule::getTypeSize(const llvm::Type* type) {
   return TheTargetData->getTypeAllocSize(type);
@@ -498,34 +499,35 @@
   addPass(PM, createPromoteMemoryToRegisterPass());// Kill useless allocas
   
   addPass(PM, createInstructionCombiningPass()); // Cleanup for scalarrepl.
+  addPass(PM, createScalarReplAggregatesPass()); // Break up aggregate allocas
+  addPass(PM, createInstructionCombiningPass()); // Cleanup for scalarrepl.
   addPass(PM, createJumpThreadingPass());        // Thread jumps.
   addPass(PM, createCFGSimplificationPass());    // Merge & remove BBs
-  addPass(PM, createScalarReplAggregatesPass()); // Break up aggregate allocas
   addPass(PM, createInstructionCombiningPass()); // Combine silly seq's
-  addPass(PM, createCondPropagationPass());      // Propagate conditionals
   
   addPass(PM, createCFGSimplificationPass());    // Merge & remove BBs
   addPass(PM, createReassociatePass());          // Reassociate expressions
+  addPass(PM, createLoopRotatePass());           // Rotate loops.
   addPass(PM, createLICMPass());                 // Hoist loop invariants
-  
   addPass(PM, createLoopUnswitchPass());         // Unswitch loops.
+  addPass(PM, createInstructionCombiningPass()); 
   addPass(PM, createIndVarSimplifyPass());       // Canonicalize indvars
   addPass(PM, createLoopDeletionPass());         // Delete dead loops
   addPass(PM, createLoopUnrollPass());           // Unroll small loops*/
   addPass(PM, createInstructionCombiningPass()); // Clean up after the unroller
   addPass(PM, createGVNPass());                  // Remove redundancies
+  addPass(PM, createMemCpyOptPass());             // Remove memcpy / form memset  
   addPass(PM, createSCCPPass());                 // Constant prop with SCCP
-  addPass(PM, createCFGSimplificationPass());    // Merge & remove BBs
- 
+
   // Run instcombine after redundancy elimination to exploit opportunities
   // opened up by them.
   addPass(PM, createInstructionCombiningPass());
-  addPass(PM, createCondPropagationPass());      // Propagate conditionals
+  addPass(PM, createJumpThreadingPass());         // Thread jumps
+  addPass(PM, createDeadStoreEliminationPass());  // Delete dead stores
+  addPass(PM, createAggressiveDCEPass());         // Delete dead instructions
+  addPass(PM, createCFGSimplificationPass());     // Merge & remove BBs
+
 
-  addPass(PM, createDeadStoreEliminationPass()); // Delete dead stores
-  addPass(PM, createAggressiveDCEPass());        // Delete dead instructions
-  addPass(PM, createCFGSimplificationPass());    // Merge & remove BBs
-  
   PM->doInitialization();
   
 }





More information about the vmkit-commits mailing list