[vmkit-commits] [vmkit] r67196 - in /vmkit/trunk: lib/Mvm/Compiler/ lib/Mvm/Runtime/ tools/jnjvm/ tools/n3-mono/ tools/n3-pnetlib/ tools/vmjc/ tools/vmkit/

Nicolas Geoffray nicolas.geoffray at lip6.fr
Wed Mar 18 03:59:04 PDT 2009


Author: geoffray
Date: Wed Mar 18 05:58:51 2009
New Revision: 67196

URL: http://llvm.org/viewvc/llvm-project?rev=67196&view=rev
Log:
Move things around to separate runtime and compiler.


Added:
    vmkit/trunk/lib/Mvm/Compiler/
    vmkit/trunk/lib/Mvm/Compiler/Disassembler.cpp
      - copied unchanged from r67038, vmkit/trunk/lib/Mvm/Runtime/Disassembler.cpp
    vmkit/trunk/lib/Mvm/Compiler/EscapeAnalysis.cpp
      - copied unchanged from r67038, vmkit/trunk/lib/Mvm/Runtime/EscapeAnalysis.cpp
    vmkit/trunk/lib/Mvm/Compiler/JIT.cpp
      - copied unchanged from r67186, vmkit/trunk/lib/Mvm/Runtime/JIT.cpp
    vmkit/trunk/lib/Mvm/Compiler/LLVMAssembly.ll
      - copied unchanged from r67038, vmkit/trunk/lib/Mvm/Runtime/LLVMAssembly.ll
    vmkit/trunk/lib/Mvm/Compiler/LLVMAssembly64.ll
      - copied unchanged from r67038, vmkit/trunk/lib/Mvm/Runtime/LLVMAssembly64.ll
    vmkit/trunk/lib/Mvm/Compiler/LLVMRuntime.ll
      - copied unchanged from r67038, vmkit/trunk/lib/Mvm/Runtime/LLVMRuntime.ll
    vmkit/trunk/lib/Mvm/Compiler/Makefile
Removed:
    vmkit/trunk/lib/Mvm/Runtime/Disassembler.cpp
    vmkit/trunk/lib/Mvm/Runtime/EscapeAnalysis.cpp
    vmkit/trunk/lib/Mvm/Runtime/JIT.cpp
    vmkit/trunk/lib/Mvm/Runtime/LLVMAssembly.ll
    vmkit/trunk/lib/Mvm/Runtime/LLVMAssembly64.ll
    vmkit/trunk/lib/Mvm/Runtime/LLVMRuntime.ll
Modified:
    vmkit/trunk/lib/Mvm/Runtime/Makefile
    vmkit/trunk/tools/jnjvm/Makefile
    vmkit/trunk/tools/n3-mono/Makefile
    vmkit/trunk/tools/n3-pnetlib/Makefile
    vmkit/trunk/tools/vmjc/Makefile
    vmkit/trunk/tools/vmkit/Makefile

Added: vmkit/trunk/lib/Mvm/Compiler/Makefile
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Compiler/Makefile?rev=67196&view=auto

==============================================================================
--- vmkit/trunk/lib/Mvm/Compiler/Makefile (added)
+++ vmkit/trunk/lib/Mvm/Compiler/Makefile Wed Mar 18 05:58:51 2009
@@ -0,0 +1,25 @@
+##===- lib/Mvm/Runtime/Makefile ----------------------------*- Makefile -*-===##
+# 
+#                     The vmkit project
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+# 
+##===----------------------------------------------------------------------===##
+LEVEL = ../../..
+
+include $(LEVEL)/Makefile.config
+
+LIBRARYNAME = MvmCompiler
+VMKIT_RUNTIME = $(PROJ_SRC_DIR)/LLVMRuntime.ll
+VMKIT_ASSEMBLY = $(PROJ_SRC_DIR)/LLVMAssembly.ll
+BUILT_SOURCES = LLVMRuntime.inc LLVMAssembly.s
+
+ifeq ($(WITH_64), 1)
+  VMKIT_ASSEMBLY += $(PROJ_SRC_DIR)/LLVMAssembly64.ll
+endif
+
+
+SOURCES = LLVMAssembly.s $(notdir $(wildcard $(PROJ_SRC_DIR)/*.cpp))
+
+include $(LEVEL)/Makefile.common

Removed: vmkit/trunk/lib/Mvm/Runtime/Disassembler.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Runtime/Disassembler.cpp?rev=67195&view=auto

==============================================================================
--- vmkit/trunk/lib/Mvm/Runtime/Disassembler.cpp (original)
+++ vmkit/trunk/lib/Mvm/Runtime/Disassembler.cpp (removed)
@@ -1,91 +0,0 @@
-//===--------- Disassembler.cc - Intefarce to disassembler ----------------===//
-//
-//                      Micro Virtual Machine
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "mvm/JIT.h"
-
-#ifdef HAVE_DISASSEMBLER
-
-#if defined(__PPC__)
-extern "C"
-{
-# include <dis-asm.h>
-# include <bfd.h>
-}
-
-
-
-static struct disassemble_info  info;
-static int      initialised= 0;  
-
-// this is the only function exported from this file
-
-int mvm::MvmModule::disassemble(unsigned int *addr)
-{
-  
-  if (!initialised)
-    {   
-      INIT_DISASSEMBLE_INFO(info, stdout, fprintf);
-      info.flavour=   bfd_target_elf_flavour;
-      info.arch=    bfd_arch_powerpc;
-      info.mach=    bfd_mach_ppc_750; // generic(ish) == PPC G3
-      info.endian=    BFD_ENDIAN_BIG;
-      info.buffer_length= 65536;
-    }   
-  info.buffer=     (bfd_byte *)addr;
-  info.buffer_vma= (bfd_vma)(long)addr;
-  return print_insn_big_powerpc((bfd_vma)(long)addr, &info);
-  
-}
-
-#elif defined(__i386__)
-extern "C"
-{
-# include <bfd.h>	// bfd types
-# include <dis-asm.h>	// disassemble_info
-  int print_insn_i386_att(bfd_vma, disassemble_info *);
-}
-
-
-static struct disassemble_info	info;
-static int			initialised= 0;
-
-
-int mvm::MvmModule::disassemble(unsigned int *addr)
-{
-  if (!initialised)
-    {
-      INIT_DISASSEMBLE_INFO(info, stdout, fprintf);
-      info.flavour=	  bfd_target_elf_flavour;
-      info.arch=	  bfd_arch_i386;
-      info.mach=	  bfd_mach_i386_i386;
-      info.endian=	  BFD_ENDIAN_LITTLE;
-      info.buffer_length= 65536;
-    }
-  info.buffer=	   (bfd_byte *)addr;
-  info.buffer_vma= (bfd_vma)(long)addr;
-  return print_insn_i386_att((bfd_vma)(long)addr, &info);
-}
-
-#else
-
-int mvm::MvmModule::disassemble(unsigned int* addr) {
-  return 0;
-}
-
-#endif
-
-#else
-
-int mvm::MvmModule::disassemble(unsigned int* addr) {
-  return 0;
-}
-
-#endif
-
-

Removed: vmkit/trunk/lib/Mvm/Runtime/EscapeAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Runtime/EscapeAnalysis.cpp?rev=67195&view=auto

==============================================================================
--- vmkit/trunk/lib/Mvm/Runtime/EscapeAnalysis.cpp (original)
+++ vmkit/trunk/lib/Mvm/Runtime/EscapeAnalysis.cpp (removed)
@@ -1,148 +0,0 @@
-//===------EscapeAnalysis.cpp - Simple LLVM escape analysis ---------------===//
-//
-//                     The Micro Virtual Machine
-//
-// This file is distributed under the University of Illinois Open Source 
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-
-#include "llvm/Constants.h"
-#include "llvm/Pass.h"
-#include "llvm/Function.h"
-#include "llvm/Instructions.h"
-#include "llvm/Support/Compiler.h"
-#include "llvm/Support/Debug.h"
-
-#include <map>
-#include "unistd.h"
-
-#include "mvm/GC/GC.h"
-
-using namespace llvm;
-
-namespace {
-
-  class VISIBILITY_HIDDEN EscapeAnalysis : public FunctionPass {
-  public:
-    static char ID;
-    uint64_t pageSize;
-    EscapeAnalysis(Function* alloc = 0) : 
-      FunctionPass((intptr_t)&ID) {
-      Allocator = alloc;
-      pageSize = getpagesize();
-    }
-
-    virtual bool runOnFunction(Function &F);
-  private:
-    Function* Allocator;
-    bool processMalloc(Instruction* I, Value* Size, Value* VT);
-  };
-  char EscapeAnalysis::ID = 0;
-  RegisterPass<EscapeAnalysis> X("EscapeAnalysis", "Escape Analysis Pass");
-
-bool EscapeAnalysis::runOnFunction(Function& F) {
-  bool Changed = false;
-  for (Function::iterator BI = F.begin(), BE = F.end(); BI != BE; BI++) { 
-    BasicBlock *Cur = BI; 
-
-    for (BasicBlock::iterator II = Cur->begin(), IE = Cur->end(); II != IE;) {
-      Instruction *I = II;
-      II++;
-      if (CallInst *CI = dyn_cast<CallInst>(I)) {
-        if (CI->getOperand(0) == Allocator) {
-          Changed |= processMalloc(CI, CI->getOperand(1), CI->getOperand(2));
-        }
-      } else if (InvokeInst *CI = dyn_cast<InvokeInst>(I)) {
-        if (CI->getOperand(0) == Allocator) {
-          Changed |= processMalloc(CI, CI->getOperand(3), CI->getOperand(4));
-        }
-      }
-    }
-  }
-  return Changed;
-}
-
-
-
-
-static bool escapes(Instruction* Ins, std::map<Instruction*, bool>& visited) {
-  for (Value::use_iterator I = Ins->use_begin(), E = Ins->use_end(); 
-       I != E; ++I) {
-    if (Instruction* II = dyn_cast<Instruction>(I)) {
-      if (dyn_cast<CallInst>(II)) return true;
-      else if (dyn_cast<InvokeInst>(II)) return true;
-      else if (dyn_cast<BitCastInst>(II)) {
-        if (escapes(II, visited)) return true;
-      }
-      else if (StoreInst* SI = dyn_cast<StoreInst>(II)) {
-        if (AllocaInst * AI = dyn_cast<AllocaInst>(SI->getOperand(1))) {
-          if (!visited[AI]) {
-            visited[AI] = true;
-            if (escapes(AI, visited)) return true;
-          }
-        } else if (SI->getOperand(0) == Ins) {
-          return true;
-        }
-      }
-      else if (dyn_cast<LoadInst>(II)) {
-        if (isa<PointerType>(II->getType())) {
-          if (escapes(II, visited)) return true; // allocas
-        }
-      }
-      else if (dyn_cast<GetElementPtrInst>(II)) {
-        if (escapes(II, visited)) return true;
-      }
-      else if (dyn_cast<ReturnInst>(II)) return true;
-      else if (dyn_cast<PHINode>(II)) {
-        if (!visited[II]) {
-          visited[II] = true;
-          if (escapes(II, visited)) return true;
-        }
-      }
-    } else {
-      return true;
-    }
-  }
-  return false;
-}
-
-bool EscapeAnalysis::processMalloc(Instruction* I, Value* Size, Value* VT) {
-  Instruction* Alloc = I;
-  
-  ConstantExpr* CE = dyn_cast<ConstantExpr>(VT);
-  if (CE) {
-    ConstantInt* C = dyn_cast<ConstantInt>(CE->getOperand(0));
-    if (!C) return false;
-
-    VirtualTable* Table = (VirtualTable*)C->getZExtValue();
-    ConstantInt* CI = dyn_cast<ConstantInt>(Size);
-    // If the class has a finalize method, do not stack allocate the object.
-    if (!((void**)Table)[0] && CI) {
-      std::map<Instruction*, bool> visited;
-      uint64_t NSize = CI->getZExtValue();
-      if (NSize < pageSize && !(escapes(Alloc, visited))) {
-        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);
-        // If it's an invoke, replace the invoke with a direct branch.
-        if (InvokeInst *CI = dyn_cast<InvokeInst>(Alloc)) {
-          BranchInst::Create(CI->getNormalDest(), Alloc);
-        }
-        Alloc->eraseFromParent();
-        return true;
-      }
-    }
-  }
-  return false;
-}
-}
-
-namespace mvm {
-FunctionPass* createEscapeAnalysisPass(llvm::Function* alloc) {
-
-  return new EscapeAnalysis(alloc);
-}
-}

Removed: vmkit/trunk/lib/Mvm/Runtime/JIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Runtime/JIT.cpp?rev=67195&view=auto

==============================================================================
--- vmkit/trunk/lib/Mvm/Runtime/JIT.cpp (original)
+++ vmkit/trunk/lib/Mvm/Runtime/JIT.cpp (removed)
@@ -1,337 +0,0 @@
-//===---------------- JIT.cc - Initialize the JIT -------------------------===//
-//
-//                     The Micro Virtual Machine
-//
-// This file is distributed under the University of Illinois Open Source 
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include <llvm/CallingConv.h>
-#include <llvm/Constants.h>
-#include <llvm/DerivedTypes.h>
-#include <llvm/Instructions.h>
-#include <llvm/LinkAllPasses.h>
-#include <llvm/Module.h>
-#include <llvm/ModuleProvider.h>
-#include <llvm/PassManager.h>
-#include <llvm/Type.h>
-#include <llvm/Analysis/LoopPass.h>
-#include <llvm/Analysis/Verifier.h>
-#include <llvm/ExecutionEngine/ExecutionEngine.h>
-#include <llvm/Support/MutexGuard.h>
-#include <llvm/Target/TargetData.h>
-#include <llvm/Target/TargetMachine.h>
-#include <llvm/Target/TargetOptions.h>
-
-
-#include "mvm/CompilationUnit.h"
-#include "mvm/JIT.h"
-#include "mvm/Object.h"
-#include "mvm/Threads/Locks.h"
-#include "mvm/Threads/Thread.h"
-
-using namespace mvm;
-using namespace llvm;
-
-
-namespace mvm {
-  namespace llvm_runtime {
-    #include "LLVMRuntime.inc"
-  }
-}
-
-void MvmModule::initialise(bool Fast, Module* M, TargetMachine* T) {
-  llvm::NoFramePointerElim = true;
-#if DWARF_EXCEPTIONS
-  llvm::ExceptionHandling = true;
-#else
-  llvm::ExceptionHandling = false;
-#endif
-  if (!M) {
-    globalModule = new llvm::Module("bootstrap module");
-    globalModuleProvider = new ExistingModuleProvider (globalModule);
-
-    executionEngine = ExecutionEngine::createJIT(globalModuleProvider, 0,
-                                                 0, Fast);
-  
-    std::string str = 
-      executionEngine->getTargetData()->getStringRepresentation();
-    globalModule->setDataLayout(str);
-  
-    TheTargetData = executionEngine->getTargetData();
-  } else {
-    globalModule = M;
-    globalModuleProvider = new ExistingModuleProvider (globalModule);
-    TheTargetData = T->getTargetData();
-  }
-
-  globalFunctionPasses = new FunctionPassManager(globalModuleProvider);
-
-  mvm::llvm_runtime::makeLLVMModuleContents(globalModule);
-  
-  // Type declaration
-  ptrType = PointerType::getUnqual(Type::Int8Ty);
-  ptr32Type = PointerType::getUnqual(Type::Int32Ty);
-  ptrPtrType = PointerType::getUnqual(ptrType);
-  pointerSizeType = globalModule->getPointerSize() == Module::Pointer32 ?
-    Type::Int32Ty : Type::Int64Ty;
-  
-  // Constant declaration
-  constantLongMinusOne = ConstantInt::get(Type::Int64Ty, (uint64_t)-1);
-  constantLongZero = ConstantInt::get(Type::Int64Ty, 0);
-  constantLongOne = ConstantInt::get(Type::Int64Ty, 1);
-  constantZero = ConstantInt::get(Type::Int32Ty, 0);
-  constantInt8Zero = ConstantInt::get(Type::Int8Ty, 0);
-  constantOne = ConstantInt::get(Type::Int32Ty, 1);
-  constantTwo = ConstantInt::get(Type::Int32Ty, 2);
-  constantThree = ConstantInt::get(Type::Int32Ty, 3);
-  constantFour = ConstantInt::get(Type::Int32Ty, 4);
-  constantFive = ConstantInt::get(Type::Int32Ty, 5);
-  constantSix = ConstantInt::get(Type::Int32Ty, 6);
-  constantSeven = ConstantInt::get(Type::Int32Ty, 7);
-  constantEight = ConstantInt::get(Type::Int32Ty, 8);
-  constantMinusOne = ConstantInt::get(Type::Int32Ty, (uint64_t)-1);
-  constantMinInt = ConstantInt::get(Type::Int32Ty, MinInt);
-  constantMaxInt = ConstantInt::get(Type::Int32Ty, MaxInt);
-  constantMinLong = ConstantInt::get(Type::Int64Ty, MinLong);
-  constantMaxLong = ConstantInt::get(Type::Int64Ty, MaxLong);
-  constantFloatZero = ConstantFP::get(Type::FloatTy, 0.0f);
-  constantFloatOne = ConstantFP::get(Type::FloatTy, 1.0f);
-  constantFloatTwo = ConstantFP::get(Type::FloatTy, 2.0f);
-  constantDoubleZero = ConstantFP::get(Type::DoubleTy, 0.0);
-  constantDoubleOne = ConstantFP::get(Type::DoubleTy, 1.0);
-  constantMaxIntFloat = ConstantFP::get(Type::FloatTy, MaxIntFloat);
-  constantMinIntFloat = ConstantFP::get(Type::FloatTy, MinIntFloat);
-  constantMinLongFloat = ConstantFP::get(Type::FloatTy, MinLongFloat);
-  constantMinLongDouble = ConstantFP::get(Type::DoubleTy, MinLongDouble);
-  constantMaxLongFloat = ConstantFP::get(Type::FloatTy, MaxLongFloat);
-  constantMaxIntDouble = ConstantFP::get(Type::DoubleTy, MaxIntDouble);
-  constantMinIntDouble = ConstantFP::get(Type::DoubleTy, MinIntDouble);
-  constantMaxLongDouble = ConstantFP::get(Type::DoubleTy, MaxLongDouble);
-  constantMaxLongDouble = ConstantFP::get(Type::DoubleTy, MaxLongDouble);
-  constantFloatInfinity = ConstantFP::get(Type::FloatTy, MaxFloat);
-  constantFloatMinusInfinity = ConstantFP::get(Type::FloatTy, MinFloat);
-  constantDoubleInfinity = ConstantFP::get(Type::DoubleTy, MaxDouble);
-  constantDoubleMinusInfinity = ConstantFP::get(Type::DoubleTy, MinDouble);
-  constantDoubleMinusZero = ConstantFP::get(Type::DoubleTy, -0.0);
-  constantFloatMinusZero = ConstantFP::get(Type::FloatTy, -0.0f);
-  constantThreadIDMask = ConstantInt::get(pointerSizeType, mvm::Thread::IDMask);
-  constantLockedMask = ConstantInt::get(pointerSizeType, ThinMask);
-  constantThreadFreeMask = ConstantInt::get(pointerSizeType, ReservedMask);
-  constantPtrOne = ConstantInt::get(pointerSizeType, 1);
-
-  constantPtrNull = Constant::getNullValue(ptrType); 
-  constantPtrSize = ConstantInt::get(Type::Int32Ty, sizeof(void*));
-  arrayPtrType = PointerType::getUnqual(ArrayType::get(Type::Int8Ty, 0));
-}
-
-
-MvmModule::MvmModule(llvm::Module* module) {
-
-  module->setDataLayout(globalModule->getDataLayout());
-  module->setTargetTriple(globalModule->getTargetTriple());
-  
-  copyDefinitions(module, globalModule); 
-    
-  printFloatLLVM = module->getFunction("printFloat");
-  printDoubleLLVM = module->getFunction("printDouble");
-  printLongLLVM = module->getFunction("printLong");
-  printIntLLVM = module->getFunction("printInt");
-  printObjectLLVM = module->getFunction("printObject");
-
-  unwindResume = module->getFunction("_Unwind_Resume_or_Rethrow");
-  
-  llvmGetException = module->getFunction("llvm.eh.exception");
-  exceptionSelector = (module->getPointerSize() == Module::Pointer32 ?
-                module->getFunction("llvm.eh.selector.i32") : 
-                module->getFunction("llvm.eh.selector.i64"));
-  
-  personality = module->getFunction("__gxx_personality_v0");
-  exceptionEndCatch = module->getFunction("__cxa_end_catch");
-  exceptionBeginCatch = module->getFunction("__cxa_begin_catch");
-
-  func_llvm_sqrt_f64 = module->getFunction("llvm.sqrt.f64");
-  func_llvm_sin_f64 = module->getFunction("llvm.sin.f64");
-  func_llvm_cos_f64 = module->getFunction("llvm.cos.f64");
-  
-  func_llvm_tan_f64 = module->getFunction("tan");
-  func_llvm_asin_f64 = module->getFunction("asin");
-  func_llvm_acos_f64 = module->getFunction("acos");
-  func_llvm_atan_f64 = module->getFunction("atan");
-  func_llvm_exp_f64 = module->getFunction("exp");
-  func_llvm_log_f64 = module->getFunction("log");
-  func_llvm_ceil_f64 = module->getFunction("ceil");
-  func_llvm_floor_f64 = module->getFunction("floor");
-  func_llvm_cbrt_f64 = module->getFunction("cbrt");
-  func_llvm_cosh_f64 = module->getFunction("cosh");
-  func_llvm_expm1_f64 = module->getFunction("expm1");
-  func_llvm_log10_f64 = module->getFunction("log10");
-  func_llvm_log1p_f64 = module->getFunction("log1p");
-  func_llvm_sinh_f64 = module->getFunction("sinh");
-  func_llvm_tanh_f64 = module->getFunction("tanh");
-  func_llvm_fabs_f64 = module->getFunction("fabs");
-  func_llvm_rint_f64 = module->getFunction("rint");
-    
-  func_llvm_hypot_f64 = module->getFunction("hypot");
-  func_llvm_pow_f64 = module->getFunction("pow");
-  func_llvm_atan2_f64 = module->getFunction("atan2");
-    
-  func_llvm_fabs_f32 = module->getFunction("fabsf");
-
-  setjmpLLVM = module->getFunction("setjmp");
-  
-  llvm_memcpy_i32 = module->getFunction("llvm.memcpy.i32");
-  llvm_memset_i32 = module->getFunction("llvm.memset.i32");
-  llvm_frameaddress = module->getFunction("llvm.frameaddress");
-
-  llvm_atomic_lcs_i8 = module->getFunction("llvm.atomic.cmp.swap.i8.p0i8");
-  llvm_atomic_lcs_i16 = module->getFunction("llvm.atomic.cmp.swap.i16.p0i16");
-  llvm_atomic_lcs_i32 = module->getFunction("llvm.atomic.cmp.swap.i32.p0i32");
-  llvm_atomic_lcs_i64 = module->getFunction("llvm.atomic.cmp.swap.i64.p0i64");
-}
-
-
-llvm::ConstantInt* MvmModule::constantInt8Zero;
-llvm::ConstantInt* MvmModule::constantZero;
-llvm::ConstantInt* MvmModule::constantOne;
-llvm::ConstantInt* MvmModule::constantTwo;
-llvm::ConstantInt* MvmModule::constantThree;
-llvm::ConstantInt* MvmModule::constantFour;
-llvm::ConstantInt* MvmModule::constantFive;
-llvm::ConstantInt* MvmModule::constantSix;
-llvm::ConstantInt* MvmModule::constantSeven;
-llvm::ConstantInt* MvmModule::constantEight;
-llvm::ConstantInt* MvmModule::constantMinusOne;
-llvm::ConstantInt* MvmModule::constantLongMinusOne;
-llvm::ConstantInt* MvmModule::constantLongZero;
-llvm::ConstantInt* MvmModule::constantLongOne;
-llvm::ConstantInt* MvmModule::constantMinInt;
-llvm::ConstantInt* MvmModule::constantMaxInt;
-llvm::ConstantInt* MvmModule::constantMinLong;
-llvm::ConstantInt* MvmModule::constantMaxLong;
-llvm::ConstantFP*  MvmModule::constantFloatZero;
-llvm::ConstantFP*  MvmModule::constantFloatOne;
-llvm::ConstantFP*  MvmModule::constantFloatTwo;
-llvm::ConstantFP*  MvmModule::constantDoubleZero;
-llvm::ConstantFP*  MvmModule::constantDoubleOne;
-llvm::ConstantFP*  MvmModule::constantMaxIntFloat;
-llvm::ConstantFP*  MvmModule::constantMinIntFloat;
-llvm::ConstantFP*  MvmModule::constantMinLongFloat;
-llvm::ConstantFP*  MvmModule::constantMinLongDouble;
-llvm::ConstantFP*  MvmModule::constantMaxLongFloat;
-llvm::ConstantFP*  MvmModule::constantMaxIntDouble;
-llvm::ConstantFP*  MvmModule::constantMinIntDouble;
-llvm::ConstantFP*  MvmModule::constantMaxLongDouble;
-llvm::ConstantFP*  MvmModule::constantDoubleInfinity;
-llvm::ConstantFP*  MvmModule::constantDoubleMinusInfinity;
-llvm::ConstantFP*  MvmModule::constantFloatInfinity;
-llvm::ConstantFP*  MvmModule::constantFloatMinusInfinity;
-llvm::ConstantFP*  MvmModule::constantFloatMinusZero;
-llvm::ConstantFP*  MvmModule::constantDoubleMinusZero;
-llvm::Constant*    MvmModule::constantPtrNull;
-llvm::ConstantInt* MvmModule::constantPtrSize;
-llvm::ConstantInt* MvmModule::constantThreadIDMask;
-llvm::ConstantInt* MvmModule::constantLockedMask;
-llvm::ConstantInt* MvmModule::constantThreadFreeMask;
-llvm::ConstantInt* MvmModule::constantPtrOne;
-const llvm::PointerType* MvmModule::ptrType;
-const llvm::PointerType* MvmModule::ptr32Type;
-const llvm::PointerType* MvmModule::ptrPtrType;
-const llvm::Type* MvmModule::pointerSizeType;
-const llvm::Type* MvmModule::arrayPtrType;
-
-const llvm::TargetData* MvmModule::TheTargetData;
-llvm::Module *MvmModule::globalModule;
-llvm::ExistingModuleProvider *MvmModule::globalModuleProvider;
-llvm::FunctionPassManager* MvmModule::globalFunctionPasses;
-llvm::ExecutionEngine* MvmModule::executionEngine;
-mvm::LockNormal MvmModule::protectEngine;
-
-
-uint64 MvmModule::getTypeSize(const llvm::Type* type) {
-  return TheTargetData->getTypePaddedSize(type);
-}
-
-void MvmModule::runPasses(llvm::Function* func,
-                          llvm::FunctionPassManager* pm) {
-  pm->run(*func);
-}
-
-static void addPass(FunctionPassManager *PM, Pass *P) {
-  // Add the pass to the pass manager...
-  PM->add(P);
-}
-
-// This is equivalent to:
-// opt -simplifycfg -mem2reg -instcombine -jump-threading -simplifycfg
-//     -scalarrepl -instcombine -condprop -simplifycfg -predsimplify 
-//     -reassociate -licm -loop-unswitch -indvars -loop-deletion -loop-unroll 
-//     -instcombine -gvn -sccp -simplifycfg -instcombine -condprop -dse -adce 
-//     -simplifycfg
-//
-void MvmModule::AddStandardCompilePasses() {
-  // TODO: enable this when
-  // - each module will have its declaration of external functions
-  // 
-  //PM->add(llvm::createVerifierPass());        // Verify that input is correct
- 
-  FunctionPassManager* PM = globalFunctionPasses;
-  PM->add(new TargetData(*MvmModule::TheTargetData));
-
-  addPass(PM, createCFGSimplificationPass()); // Clean up disgusting code
-  addPass(PM, createPromoteMemoryToRegisterPass());// Kill useless 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, createPredicateSimplifierPass());
-  addPass(PM, createReassociatePass());          // Reassociate expressions
-  addPass(PM, createLICMPass());                 // Hoist loop invariants
-  
-  addPass(PM, createLoopUnswitchPass());         // Unswitch loops.
-  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, 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, createDeadStoreEliminationPass()); // Delete dead stores
-  addPass(PM, createAggressiveDCEPass());        // Delete dead instructions
-  addPass(PM, createCFGSimplificationPass());    // Merge & remove BBs
-
-}
-
-// We protect the creation of IR with the executionEngine lock because
-// codegen'ing a function may also create IR objects.
-void MvmModule::protectIR() {
-  if (executionEngine) executionEngine->lock.acquire();
-}
-
-void MvmModule::unprotectIR() {
-  if (executionEngine) executionEngine->lock.release();
-}
-
-
-void MvmModule::copyDefinitions(Module* Dst, Module* Src) {
-  // Loop over all of the functions in the src module, mapping them over
-  for (Module::const_iterator I = Src->begin(), E = Src->end(); I != E; ++I) {
-    const Function *SF = I;   // SrcFunction
-    assert(SF->isDeclaration() && 
-           "Don't know how top copy functions with body");
-    Function::Create(SF->getFunctionType(), GlobalValue::ExternalLinkage,
-                     SF->getName(), Dst);
-  }
-}

Removed: vmkit/trunk/lib/Mvm/Runtime/LLVMAssembly.ll
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Runtime/LLVMAssembly.ll?rev=67195&view=auto

==============================================================================
--- vmkit/trunk/lib/Mvm/Runtime/LLVMAssembly.ll (original)
+++ vmkit/trunk/lib/Mvm/Runtime/LLVMAssembly.ll (removed)
@@ -1,31 +0,0 @@
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Atomic ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-declare i8  @llvm.atomic.cmp.swap.i8.p0i8(i8*, i8, i8) nounwind
-declare i16 @llvm.atomic.cmp.swap.i16.p0i16(i16*, i16, i16) nounwind
-declare i32 @llvm.atomic.cmp.swap.i32.p0i32(i32*, i32, i32) nounwind
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;Helper functions for gcc < 4.2 ;;;;;;;;;;;;;;;;;;;;;;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-define i8 @llvm_atomic_cmp_swap_i8(i8* %ptr, i8 %cmp, i8 %swap) 
-nounwind {
-  %A = call i8 @llvm.atomic.cmp.swap.i8.p0i8( i8* %ptr, i8 %cmp, i8 %swap)
-  ret i8 %A
-}
-
-define i16 @llvm_atomic_cmp_swap_i16(i16* %ptr, i16 %cmp, i16 %swap)
-nounwind {
-  %A = call i16 @llvm.atomic.cmp.swap.i16.p0i16( i16* %ptr, i16 %cmp, i16 %swap)
-  ret i16 %A
-}
-
-define i32 @llvm_atomic_cmp_swap_i32(i32* %ptr, i32 %cmp, i32 %swap)
-nounwind {
-  %A = call i32 @llvm.atomic.cmp.swap.i32.p0i32(i32* %ptr, i32 %cmp, i32 %swap)
-  ret i32 %A
-}
-
-

Removed: vmkit/trunk/lib/Mvm/Runtime/LLVMAssembly64.ll
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Runtime/LLVMAssembly64.ll?rev=67195&view=auto

==============================================================================
--- vmkit/trunk/lib/Mvm/Runtime/LLVMAssembly64.ll (original)
+++ vmkit/trunk/lib/Mvm/Runtime/LLVMAssembly64.ll (removed)
@@ -1,7 +0,0 @@
-declare i64 @llvm.atomic.cmp.swap.i64.p0i64(i64*, i64, i64) nounwind
-
-define i64 @llvm_atomic_cmp_swap_i64(i64* %ptr, i64 %cmp, i64 %swap)
-nounwind {
-  %A = call i64 @llvm.atomic.cmp.swap.i64.p0i64( i64* %ptr, i64 %cmp, i64 %swap)
-  ret i64 %A
-}

Removed: vmkit/trunk/lib/Mvm/Runtime/LLVMRuntime.ll
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Runtime/LLVMRuntime.ll?rev=67195&view=auto

==============================================================================
--- vmkit/trunk/lib/Mvm/Runtime/LLVMRuntime.ll (original)
+++ vmkit/trunk/lib/Mvm/Runtime/LLVMRuntime.ll (removed)
@@ -1,75 +0,0 @@
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Common types ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-;;; A virtual table is an array of function pointers.
-%VT = type [0 x i32 (...)*]
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Printing functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-declare void @printFloat(float)
-declare void @printDouble(double)
-declare void @printLong(i64)
-declare void @printInt(i32)
-declare void @printObject(i8*)
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Exceptions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-declare void @_Unwind_Resume_or_Rethrow(i8*)
-declare i8*  @llvm.eh.exception() nounwind
-declare i32  @llvm.eh.selector.i32(i8*, i8*, ...) nounwind
-declare i64  @llvm.eh.selector.i64(i8*, i8*, ...) nounwind
-declare void @__gxx_personality_v0()
-declare i8*  @__cxa_begin_catch(i8*)
-declare void @__cxa_end_catch()
-declare i32  @setjmp(i8*)
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Math ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-declare double @llvm.sqrt.f64(double) nounwind
-declare double @llvm.sin.f64(double) nounwind
-declare double @llvm.cos.f64(double) nounwind
-declare double @tan(double)
-declare double @asin(double)
-declare double @acos(double)
-declare double @atan(double)
-declare double @exp(double)
-declare double @log(double)
-declare double @ceil(double)
-declare double @floor(double)
-declare double @cbrt(double)
-declare double @cosh(double)
-declare double @expm1(double)
-declare double @log10(double)
-declare double @log1p(double)
-declare double @sinh(double)
-declare double @tanh(double)
-declare double @fabs(double)
-declare double @rint(double)
-declare double @hypot(double, double)
-declare double @pow(double, double)
-declare double @atan2(double, double)
-declare float  @fabsf(float)
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Memory ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-declare void @llvm.memcpy.i32(i8 *, i8 *, i32, i32) nounwind
-declare void @llvm.memset.i32(i8 *, i8, i32, i32) nounwind
-declare i8*  @llvm.frameaddress(i32) nounwind readnone
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Atomic ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-declare i8  @llvm.atomic.cmp.swap.i8.p0i8(i8*, i8, i8) nounwind
-declare i16 @llvm.atomic.cmp.swap.i16.p0i16(i16*, i16, i16) nounwind
-declare i32 @llvm.atomic.cmp.swap.i32.p0i32(i32*, i32, i32) nounwind
-declare i64 @llvm.atomic.cmp.swap.i64.p0i64(i64*, i64, i64) nounwind

Modified: vmkit/trunk/lib/Mvm/Runtime/Makefile
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Runtime/Makefile?rev=67196&r1=67195&r2=67196&view=diff

==============================================================================
--- vmkit/trunk/lib/Mvm/Runtime/Makefile (original)
+++ vmkit/trunk/lib/Mvm/Runtime/Makefile Wed Mar 18 05:58:51 2009
@@ -11,15 +11,5 @@
 include $(LEVEL)/Makefile.config
 
 LIBRARYNAME = Mvm
-VMKIT_RUNTIME = $(PROJ_SRC_DIR)/LLVMRuntime.ll
-VMKIT_ASSEMBLY = $(PROJ_SRC_DIR)/LLVMAssembly.ll
-BUILT_SOURCES = LLVMRuntime.inc LLVMAssembly.s
-
-ifeq ($(WITH_64), 1)
-  VMKIT_ASSEMBLY += $(PROJ_SRC_DIR)/LLVMAssembly64.ll
-endif
-
-
-SOURCES = LLVMAssembly.s $(notdir $(wildcard $(PROJ_SRC_DIR)/*.cpp))
 
 include $(LEVEL)/Makefile.common

Modified: vmkit/trunk/tools/jnjvm/Makefile
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/tools/jnjvm/Makefile?rev=67196&r1=67195&r2=67196&view=diff

==============================================================================
--- vmkit/trunk/tools/jnjvm/Makefile (original)
+++ vmkit/trunk/tools/jnjvm/Makefile Wed Mar 18 05:58:51 2009
@@ -11,7 +11,8 @@
 include $(LEVEL)/Makefile.config
 
 TOOLNAME = jnjvm
-USEDLIBS = Allocator CommonThread Mvm JnJVM Classpath JnjvmCompiler $(GCLIB)
+USEDLIBS = Allocator CommonThread Mvm MvmCompiler JnJVM Classpath JnjvmCompiler \
+	   $(GCLIB)
 LINK_COMPONENTS = jit nativecodegen scalaropts instrumentation ipa ipo
 
 ifeq ($(ISOLATE_SHARING_BUILD), 1) 

Modified: vmkit/trunk/tools/n3-mono/Makefile
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/tools/n3-mono/Makefile?rev=67196&r1=67195&r2=67196&view=diff

==============================================================================
--- vmkit/trunk/tools/n3-mono/Makefile (original)
+++ vmkit/trunk/tools/n3-mono/Makefile Wed Mar 18 05:58:51 2009
@@ -12,7 +12,7 @@
 
 TOOLNAME = n3-mono
 LINK_COMPONENTS = jit nativecodegen scalaropts instrumentation ipa ipo
-USEDLIBS = Allocator CommonThread Mvm N3 $(GCLIB) Mono
+USEDLIBS = Allocator CommonThread Mvm MvmCompiler N3 $(GCLIB) Mono
 
 include $(LEVEL)/Makefile.common
 

Modified: vmkit/trunk/tools/n3-pnetlib/Makefile
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/tools/n3-pnetlib/Makefile?rev=67196&r1=67195&r2=67196&view=diff

==============================================================================
--- vmkit/trunk/tools/n3-pnetlib/Makefile (original)
+++ vmkit/trunk/tools/n3-pnetlib/Makefile Wed Mar 18 05:58:51 2009
@@ -12,7 +12,7 @@
 
 TOOLNAME = n3-pnetlib
 LINK_COMPONENTS = jit nativecodegen scalaropts instrumentation ipa ipo
-USEDLIBS = Allocator CommonThread Mvm N3 $(GCLIB) PNetLib
+USEDLIBS = Allocator CommonThread Mvm MvmCompiler N3 $(GCLIB) PNetLib
 
 include $(LEVEL)/Makefile.common
 

Modified: vmkit/trunk/tools/vmjc/Makefile
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/tools/vmjc/Makefile?rev=67196&r1=67195&r2=67196&view=diff

==============================================================================
--- vmkit/trunk/tools/vmjc/Makefile (original)
+++ vmkit/trunk/tools/vmjc/Makefile Wed Mar 18 05:58:51 2009
@@ -13,7 +13,8 @@
 EXTRA_DIST = libvmjc
 
 TOOLNAME = vmjc
-USEDLIBS = Allocator CommonThread Mvm JnJVM Classpath JnjvmCompiler $(GCLIB)
+USEDLIBS = Allocator CommonThread Mvm MvmCompiler JnJVM Classpath \
+	   JnjvmCompiler $(GCLIB)
 LINK_COMPONENTS = jit nativecodegen scalaropts instrumentation ipa ipo bitwriter
 
 include $(LEVEL)/Makefile.common

Modified: vmkit/trunk/tools/vmkit/Makefile
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/tools/vmkit/Makefile?rev=67196&r1=67195&r2=67196&view=diff

==============================================================================
--- vmkit/trunk/tools/vmkit/Makefile (original)
+++ vmkit/trunk/tools/vmkit/Makefile Wed Mar 18 05:58:51 2009
@@ -11,7 +11,7 @@
 include $(LEVEL)/Makefile.config
 
 TOOLNAME = vmkit
-USEDLIBS = Allocator CommonThread Mvm $(GCLIB) 
+USEDLIBS = Allocator CommonThread Mvm MvmCompiler $(GCLIB)
 
 ifeq ($(WITH_JNJVM), 1)
 USEDLIBS += JnJVM Classpath JnjvmCompiler





More information about the vmkit-commits mailing list