diff options
author | Stephen Hines <srhines@google.com> | 2014-05-29 02:49:00 -0700 |
---|---|---|
committer | Stephen Hines <srhines@google.com> | 2014-05-29 02:49:00 -0700 |
commit | dce4a407a24b04eebc6a376f8e62b41aaa7b071f (patch) | |
tree | dcebc53f2b182f145a2e659393bf9a0472cedf23 /include/llvm/ExecutionEngine | |
parent | 220b921aed042f9e520c26cffd8282a94c66c3d5 (diff) | |
download | external_llvm-dce4a407a24b04eebc6a376f8e62b41aaa7b071f.zip external_llvm-dce4a407a24b04eebc6a376f8e62b41aaa7b071f.tar.gz external_llvm-dce4a407a24b04eebc6a376f8e62b41aaa7b071f.tar.bz2 |
Update LLVM for 3.5 rebase (r209712).
Change-Id: I149556c940fb7dc92d075273c87ff584f400941f
Diffstat (limited to 'include/llvm/ExecutionEngine')
-rw-r--r-- | include/llvm/ExecutionEngine/ExecutionEngine.h | 55 | ||||
-rw-r--r-- | include/llvm/ExecutionEngine/JITEventListener.h | 8 | ||||
-rw-r--r-- | include/llvm/ExecutionEngine/ObjectImage.h | 8 | ||||
-rw-r--r-- | include/llvm/ExecutionEngine/RTDyldMemoryManager.h | 2 | ||||
-rw-r--r-- | include/llvm/ExecutionEngine/RuntimeDyld.h | 2 | ||||
-rw-r--r-- | include/llvm/ExecutionEngine/SectionMemoryManager.h | 2 |
6 files changed, 56 insertions, 21 deletions
diff --git a/include/llvm/ExecutionEngine/ExecutionEngine.h b/include/llvm/ExecutionEngine/ExecutionEngine.h index 4dca870..7518c1e 100644 --- a/include/llvm/ExecutionEngine/ExecutionEngine.h +++ b/include/llvm/ExecutionEngine/ExecutionEngine.h @@ -123,6 +123,9 @@ class ExecutionEngine { /// using dlsym). bool SymbolSearchingDisabled; + /// Whether the JIT should verify IR modules during compilation. + bool VerifyModules; + friend class EngineBuilder; // To allow access to JITCtor and InterpCtor. protected: @@ -181,7 +184,7 @@ public: /// freeMachineCodeForFunction works. static ExecutionEngine *create(Module *M, bool ForceInterpreter = false, - std::string *ErrorStr = 0, + std::string *ErrorStr = nullptr, CodeGenOpt::Level OptLevel = CodeGenOpt::Default, bool GVsWithCode = true); @@ -193,8 +196,8 @@ public: /// Clients should make sure to initialize targets prior to calling this /// function. static ExecutionEngine *createJIT(Module *M, - std::string *ErrorStr = 0, - JITMemoryManager *JMM = 0, + std::string *ErrorStr = nullptr, + JITMemoryManager *JMM = nullptr, CodeGenOpt::Level OptLevel = CodeGenOpt::Default, bool GVsWithCode = true, @@ -219,10 +222,7 @@ public: /// needed by another object. /// /// MCJIT will take ownership of the ObjectFile. - virtual void addObjectFile(object::ObjectFile *O) { - llvm_unreachable( - "ExecutionEngine subclass doesn't implement addObjectFile."); - } + virtual void addObjectFile(std::unique_ptr<object::ObjectFile> O); /// addArchive - Add an Archive to the execution engine. /// @@ -411,7 +411,7 @@ public: } // The JIT overrides a version that actually does this. - virtual void runJITOnFunction(Function *, MachineCodeInfo * = 0) { } + virtual void runJITOnFunction(Function *, MachineCodeInfo * = nullptr) { } /// getGlobalValueAtAddress - Return the LLVM global value object that starts /// at the specified address. @@ -478,7 +478,7 @@ public: } /// Return the target machine (if available). - virtual TargetMachine *getTargetMachine() { return NULL; } + virtual TargetMachine *getTargetMachine() { return nullptr; } /// DisableLazyCompilation - When lazy compilation is off (the default), the /// JIT will eagerly compile every function reachable from the argument to @@ -525,6 +525,17 @@ public: return SymbolSearchingDisabled; } + /// Enable/Disable IR module verification. + /// + /// Note: Module verification is enabled by default in Debug builds, and + /// disabled by default in Release. Use this method to override the default. + void setVerifyModules(bool Verify) { + VerifyModules = Verify; + } + bool getVerifyModules() const { + return VerifyModules; + } + /// InstallLazyFunctionCreator - If an unknown function is needed, the /// specified function pointer is invoked to create it. If it returns null, /// the JIT will abort. @@ -572,19 +583,28 @@ private: std::string MCPU; SmallVector<std::string, 4> MAttrs; bool UseMCJIT; + bool VerifyModules; /// InitEngine - Does the common initialization of default options. void InitEngine() { WhichEngine = EngineKind::Either; - ErrorStr = NULL; + ErrorStr = nullptr; OptLevel = CodeGenOpt::Default; - MCJMM = NULL; - JMM = NULL; + MCJMM = nullptr; + JMM = nullptr; Options = TargetOptions(); AllocateGVsWithCode = false; RelocModel = Reloc::Default; CMModel = CodeModel::JITDefault; UseMCJIT = false; + + // IR module verification is enabled by default in debug builds, and disabled + // by default in release builds. +#ifndef NDEBUG + VerifyModules = true; +#else + VerifyModules = false; +#endif } public: @@ -610,7 +630,7 @@ public: /// the setJITMemoryManager() option. EngineBuilder &setMCJITMemoryManager(RTDyldMemoryManager *mcjmm) { MCJMM = mcjmm; - JMM = NULL; + JMM = nullptr; return *this; } @@ -622,7 +642,7 @@ public: /// memory manager. This option defaults to NULL. This option overrides /// setMCJITMemoryManager() as well. EngineBuilder &setJITMemoryManager(JITMemoryManager *jmm) { - MCJMM = NULL; + MCJMM = nullptr; JMM = jmm; return *this; } @@ -694,6 +714,13 @@ public: return *this; } + /// setVerifyModules - Set whether the JIT implementation should verify + /// IR modules during compilation. + EngineBuilder &setVerifyModules(bool Verify) { + VerifyModules = Verify; + return *this; + } + /// setMAttrs - Set cpu-specific attributes. template<typename StringSequence> EngineBuilder &setMAttrs(const StringSequence &mattrs) { diff --git a/include/llvm/ExecutionEngine/JITEventListener.h b/include/llvm/ExecutionEngine/JITEventListener.h index 8daf2bd..99fe36c 100644 --- a/include/llvm/ExecutionEngine/JITEventListener.h +++ b/include/llvm/ExecutionEngine/JITEventListener.h @@ -98,11 +98,11 @@ public: static JITEventListener *createIntelJITEventListener( IntelJITEventsWrapper* AlternativeImpl); #else - static JITEventListener *createIntelJITEventListener() { return 0; } + static JITEventListener *createIntelJITEventListener() { return nullptr; } static JITEventListener *createIntelJITEventListener( IntelJITEventsWrapper* AlternativeImpl) { - return 0; + return nullptr; } #endif // USE_INTEL_JITEVENTS @@ -115,11 +115,11 @@ public: OProfileWrapper* AlternativeImpl); #else - static JITEventListener *createOProfileJITEventListener() { return 0; } + static JITEventListener *createOProfileJITEventListener() { return nullptr; } static JITEventListener *createOProfileJITEventListener( OProfileWrapper* AlternativeImpl) { - return 0; + return nullptr; } #endif // USE_OPROFILE diff --git a/include/llvm/ExecutionEngine/ObjectImage.h b/include/llvm/ExecutionEngine/ObjectImage.h index 1a13647..1fcedd8 100644 --- a/include/llvm/ExecutionEngine/ObjectImage.h +++ b/include/llvm/ExecutionEngine/ObjectImage.h @@ -36,9 +36,17 @@ public: virtual object::symbol_iterator begin_symbols() const = 0; virtual object::symbol_iterator end_symbols() const = 0; + iterator_range<object::symbol_iterator> symbols() const { + return iterator_range<object::symbol_iterator>(begin_symbols(), + end_symbols()); + } virtual object::section_iterator begin_sections() const = 0; virtual object::section_iterator end_sections() const = 0; + iterator_range<object::section_iterator> sections() const { + return iterator_range<object::section_iterator>(begin_sections(), + end_sections()); + } virtual /* Triple::ArchType */ unsigned getArch() const = 0; diff --git a/include/llvm/ExecutionEngine/RTDyldMemoryManager.h b/include/llvm/ExecutionEngine/RTDyldMemoryManager.h index 70dd1cb..b1d6810 100644 --- a/include/llvm/ExecutionEngine/RTDyldMemoryManager.h +++ b/include/llvm/ExecutionEngine/RTDyldMemoryManager.h @@ -114,7 +114,7 @@ public: /// operations needed to reliably use the memory are also performed. /// /// Returns true if an error occurred, false otherwise. - virtual bool finalizeMemory(std::string *ErrMsg = 0) = 0; + virtual bool finalizeMemory(std::string *ErrMsg = nullptr) = 0; }; // Create wrappers for C Binding types (see CBindingWrapping.h). diff --git a/include/llvm/ExecutionEngine/RuntimeDyld.h b/include/llvm/ExecutionEngine/RuntimeDyld.h index 8d7b81b..30c0d49 100644 --- a/include/llvm/ExecutionEngine/RuntimeDyld.h +++ b/include/llvm/ExecutionEngine/RuntimeDyld.h @@ -55,7 +55,7 @@ public: /// Ownership of the input object is transferred to the ObjectImage /// instance returned from this function if successful. In the case of load /// failure, the input object will be deleted. - ObjectImage *loadObject(object::ObjectFile *InputObject); + ObjectImage *loadObject(std::unique_ptr<object::ObjectFile> InputObject); /// Get the address of our local copy of the symbol. This may or may not /// be the address used for relocation (clients can copy the data around diff --git a/include/llvm/ExecutionEngine/SectionMemoryManager.h b/include/llvm/ExecutionEngine/SectionMemoryManager.h index f68028b..f24bb4d 100644 --- a/include/llvm/ExecutionEngine/SectionMemoryManager.h +++ b/include/llvm/ExecutionEngine/SectionMemoryManager.h @@ -72,7 +72,7 @@ public: /// operations needed to reliably use the memory are also performed. /// /// \returns true if an error occurred, false otherwise. - bool finalizeMemory(std::string *ErrMsg = 0) override; + bool finalizeMemory(std::string *ErrMsg = nullptr) override; /// \brief Invalidate instruction cache for code sections. /// |