summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2014-04-18 06:48:23 +0000
committerLang Hames <lhames@gmail.com>2014-04-18 06:48:23 +0000
commitc3097bfd9b2b47474b502efea8f0755bfe4e9d56 (patch)
tree7ef775db97b7d0a8ad0cbc05f58d5098f9e1f46e /include
parentbc3655f9c831ae9b7b111cd193e732fc9f341a71 (diff)
downloadllvm-c3097bfd9b2b47474b502efea8f0755bfe4e9d56.tar.gz
llvm-c3097bfd9b2b47474b502efea8f0755bfe4e9d56.tar.bz2
llvm-c3097bfd9b2b47474b502efea8f0755bfe4e9d56.tar.xz
[ExecutionEngine] Allow JIT clients to enable/disable module verification.
Previously module verification was always enabled, with no way to turn it off. As of this commit, module verification is on by default in Debug builds, and off by default in release builds. The default behaviour can be overridden by calling setVerifyModules(bool) on the JIT instance (this works for both the old JIT, and MCJIT). <rdar://problem/16150008> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206561 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/ExecutionEngine/ExecutionEngine.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/llvm/ExecutionEngine/ExecutionEngine.h b/include/llvm/ExecutionEngine/ExecutionEngine.h
index 5bd34e8556..70440d725d 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:
@@ -525,6 +528,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,6 +586,7 @@ private:
std::string MCPU;
SmallVector<std::string, 4> MAttrs;
bool UseMCJIT;
+ bool VerifyModules;
/// InitEngine - Does the common initialization of default options.
void InitEngine() {
@@ -585,6 +600,14 @@ private:
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:
@@ -694,6 +717,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) {