From ebe69fe11e48d322045d5949c83283927a0d790b Mon Sep 17 00:00:00 2001 From: Stephen Hines Date: Mon, 23 Mar 2015 12:10:34 -0700 Subject: Update aosp/master LLVM for rebase to r230699. Change-Id: I2b5be30509658cb8266be782de0ab24f9099f9b9 --- tools/lli/Android.mk | 3 ++- tools/lli/CMakeLists.txt | 4 +++- tools/lli/ChildTarget/ChildTarget.cpp | 14 +++++++------- tools/lli/Makefile | 4 ++-- tools/lli/RemoteMemoryManager.cpp | 3 +-- tools/lli/RemoteMemoryManager.h | 3 ++- tools/lli/lli.cpp | 26 +++++++++++++++----------- 7 files changed, 32 insertions(+), 25 deletions(-) (limited to 'tools/lli') diff --git a/tools/lli/Android.mk b/tools/lli/Android.mk index 1b09102..d771e56 100644 --- a/tools/lli/Android.mk +++ b/tools/lli/Android.mk @@ -46,7 +46,6 @@ lli_STATIC_LIBRARIES := \ libLLVMSelectionDAG \ libLLVMCodeGen \ libLLVMInstrumentation \ - libLLVMExecutionEngine \ libLLVMLinker \ libLLVMInterpreter \ libLLVMScalarOpts \ @@ -55,6 +54,8 @@ lli_STATIC_LIBRARIES := \ libLLVMTarget \ libLLVMMC \ libLLVMMCJIT \ + libLLVMOrcJIT \ + libLLVMExecutionEngine \ libLLVMRuntimeDyld \ libLLVMMCParser \ libLLVMObject \ diff --git a/tools/lli/CMakeLists.txt b/tools/lli/CMakeLists.txt index 3610d76..463c853 100644 --- a/tools/lli/CMakeLists.txt +++ b/tools/lli/CMakeLists.txt @@ -10,6 +10,8 @@ set(LLVM_LINK_COMPONENTS MC MCJIT Object + OrcJIT + RuntimeDyld SelectionDAG Support native @@ -25,7 +27,7 @@ endif( LLVM_USE_OPROFILE ) if( LLVM_USE_INTEL_JITEVENTS ) set(LLVM_LINK_COMPONENTS ${LLVM_LINK_COMPONENTS} - DebugInfo + DebugInfoDWARF IntelJITEvents Object ) diff --git a/tools/lli/ChildTarget/ChildTarget.cpp b/tools/lli/ChildTarget/ChildTarget.cpp index 0d71b17..6c537d4 100644 --- a/tools/lli/ChildTarget/ChildTarget.cpp +++ b/tools/lli/ChildTarget/ChildTarget.cpp @@ -97,15 +97,15 @@ void LLIChildTarget::handleMessage(LLIMessageType messageType) { // Incoming message handlers void LLIChildTarget::handleAllocateSpace() { // Read and verify the message data size. - uint32_t DataSize; + uint32_t DataSize = 0; int rc = ReadBytes(&DataSize, 4); (void)rc; assert(rc == 4); assert(DataSize == 8); // Read the message arguments. - uint32_t Alignment; - uint32_t AllocSize; + uint32_t Alignment = 0; + uint32_t AllocSize = 0; rc = ReadBytes(&Alignment, 4); assert(rc == 4); rc = ReadBytes(&AllocSize, 4); @@ -121,13 +121,13 @@ void LLIChildTarget::handleAllocateSpace() { void LLIChildTarget::handleLoadSection(bool IsCode) { // Read the message data size. - uint32_t DataSize; + uint32_t DataSize = 0; int rc = ReadBytes(&DataSize, 4); (void)rc; assert(rc == 4); // Read the target load address. - uint64_t Addr; + uint64_t Addr = 0; rc = ReadBytes(&Addr, 8); assert(rc == 8); size_t BufferSize = DataSize - 8; @@ -150,14 +150,14 @@ void LLIChildTarget::handleLoadSection(bool IsCode) { void LLIChildTarget::handleExecute() { // Read the message data size. - uint32_t DataSize; + uint32_t DataSize = 0; int rc = ReadBytes(&DataSize, 4); (void)rc; assert(rc == 4); assert(DataSize == 8); // Read the target address. - uint64_t Addr; + uint64_t Addr = 0; rc = ReadBytes(&Addr, 8); assert(rc == 8); diff --git a/tools/lli/Makefile b/tools/lli/Makefile index 94d6f06..70d8c80 100644 --- a/tools/lli/Makefile +++ b/tools/lli/Makefile @@ -14,12 +14,12 @@ PARALLEL_DIRS := ChildTarget include $(LEVEL)/Makefile.config -LINK_COMPONENTS := mcjit instrumentation interpreter nativecodegen bitreader asmparser irreader selectiondag native +LINK_COMPONENTS := mcjit orcjit instrumentation interpreter nativecodegen bitreader asmparser irreader selectiondag native # If Intel JIT Events support is confiured, link against the LLVM Intel JIT # Events interface library ifeq ($(USE_INTEL_JITEVENTS), 1) - LINK_COMPONENTS += debuginfo inteljitevents object + LINK_COMPONENTS += debuginfodwarf inteljitevents object endif # If oprofile support is confiured, link against the LLVM oprofile interface diff --git a/tools/lli/RemoteMemoryManager.cpp b/tools/lli/RemoteMemoryManager.cpp index 5a135ea..47da8fb 100644 --- a/tools/lli/RemoteMemoryManager.cpp +++ b/tools/lli/RemoteMemoryManager.cpp @@ -14,7 +14,6 @@ #include "RemoteMemoryManager.h" #include "llvm/ExecutionEngine/ExecutionEngine.h" -#include "llvm/ExecutionEngine/ObjectImage.h" #include "llvm/Support/Debug.h" #include "llvm/Support/Format.h" @@ -78,7 +77,7 @@ sys::MemoryBlock RemoteMemoryManager::allocateSection(uintptr_t Size) { } void RemoteMemoryManager::notifyObjectLoaded(ExecutionEngine *EE, - const ObjectImage *Obj) { + const object::ObjectFile &Obj) { // The client should have called setRemoteTarget() before triggering any // code generation. assert(Target); diff --git a/tools/lli/RemoteMemoryManager.h b/tools/lli/RemoteMemoryManager.h index 0bdb4e2..895bcda 100644 --- a/tools/lli/RemoteMemoryManager.h +++ b/tools/lli/RemoteMemoryManager.h @@ -80,7 +80,8 @@ public: // symbols from Modules it contains. uint64_t getSymbolAddress(const std::string &Name) override { return 0; } - void notifyObjectLoaded(ExecutionEngine *EE, const ObjectImage *Obj) override; + void notifyObjectLoaded(ExecutionEngine *EE, + const object::ObjectFile &Obj) override; bool finalizeMemory(std::string *ErrMsg) override; diff --git a/tools/lli/lli.cpp b/tools/lli/lli.cpp index 276740b..9c2b781 100644 --- a/tools/lli/lli.cpp +++ b/tools/lli/lli.cpp @@ -25,6 +25,7 @@ #include "llvm/ExecutionEngine/JITEventListener.h" #include "llvm/ExecutionEngine/MCJIT.h" #include "llvm/ExecutionEngine/ObjectCache.h" +#include "llvm/ExecutionEngine/OrcMCJITReplacement.h" #include "llvm/ExecutionEngine/SectionMemoryManager.h" #include "llvm/IR/IRBuilder.h" #include "llvm/IR/Module.h" @@ -74,9 +75,12 @@ namespace { cl::desc("Force interpretation: disable JIT"), cl::init(false)); - cl::opt DebugIR( - "debug-ir", cl::desc("Generate debug information to allow debugging IR."), - cl::init(false)); + cl::opt UseOrcMCJITReplacement("use-orcmcjit", + cl::desc("Use the experimental " + "OrcMCJITReplacement as a " + "drop-in replacement for " + "MCJIT."), + cl::init(false)); // The MCJIT supports building for a target address space separate from // the JIT compilation process. Use a forked process and a copying @@ -414,11 +418,6 @@ int main(int argc, char **argv, char * const *envp) { } } - if (DebugIR) { - ModulePass *DebugIRPass = createDebugIRPass(); - DebugIRPass->runOnModule(*Mod); - } - std::string ErrorMsg; EngineBuilder builder(std::move(Owner)); builder.setMArch(MArch); @@ -430,6 +429,7 @@ int main(int argc, char **argv, char * const *envp) { builder.setEngineKind(ForceInterpreter ? EngineKind::Interpreter : EngineKind::JIT); + builder.setUseOrcMCJITReplacement(UseOrcMCJITReplacement); // If we are supposed to override the target triple, do so now. if (!TargetTriple.empty()) @@ -442,7 +442,11 @@ int main(int argc, char **argv, char * const *envp) { RTDyldMM = new RemoteMemoryManager(); else RTDyldMM = new SectionMemoryManager(); - builder.setMCJITMemoryManager(RTDyldMM); + + // Deliberately construct a temp std::unique_ptr to pass in. Do not null out + // RTDyldMM: We still use it below, even though we don't own it. + builder.setMCJITMemoryManager( + std::unique_ptr(RTDyldMM)); } else if (RemoteMCJIT) { errs() << "error: Remote process execution does not work with the " "interpreter.\n"; @@ -561,7 +565,7 @@ int main(int argc, char **argv, char * const *envp) { // If the user specifically requested an argv[0] to pass into the program, // do it now. if (!FakeArgv0.empty()) { - InputFile = FakeArgv0; + InputFile = static_cast(FakeArgv0); } else { // Otherwise, if there is a .bc suffix on the executable strip it off, it // might confuse the program. @@ -593,7 +597,7 @@ int main(int argc, char **argv, char * const *envp) { // function later on to make an explicit call, so get the function now. Constant *Exit = Mod->getOrInsertFunction("exit", Type::getVoidTy(Context), Type::getInt32Ty(Context), - NULL); + nullptr); // Run static constructors. if (!ForceInterpreter) { -- cgit v1.1