summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/LLVMContextImpl.cpp
diff options
context:
space:
mode:
authorFedor Sergeev <fedor.sergeev@azul.com>2018-04-05 10:29:37 +0000
committerFedor Sergeev <fedor.sergeev@azul.com>2018-04-05 10:29:37 +0000
commitd29884c7e6fac28d8af07ab6c818575c75664d3b (patch)
treec601cf05f93870f25ce0be44d33d4d6d4078054d /llvm/lib/IR/LLVMContextImpl.cpp
parent978502f4758216ef21ff478ea0d9eb5cc5b2369f (diff)
downloadbcm5719-llvm-d29884c7e6fac28d8af07ab6c818575c75664d3b.tar.gz
bcm5719-llvm-d29884c7e6fac28d8af07ab6c818575c75664d3b.zip
allow custom OptBisect classes set to LLVMContext
This patch introduces a way to set custom OptPassGate instances to LLVMContext. A new instance field OptBisector and a new method setOptBisect() are added to the LLVMContext classes. These changes allow to set a custom OptBisect class that can make its own decisions on skipping optional passes. Another important feature of this change is ability to set different instances of OptPassGate to different LLVMContexts. So the different contexts can be used independently in several compiling threads of one process. One unit test is added. Patch by Yevgeny Rouban. Reviewers: andrew.w.kaylor, fedor.sergeev, vsk, dberlin, Eugene.Zelenko, reames, skatkov Reviewed By: andrew.w.kaylor, fedor.sergeev Differential Revision: https://reviews.llvm.org/D44464 llvm-svn: 329267
Diffstat (limited to 'llvm/lib/IR/LLVMContextImpl.cpp')
-rw-r--r--llvm/lib/IR/LLVMContextImpl.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/IR/LLVMContextImpl.cpp b/llvm/lib/IR/LLVMContextImpl.cpp
index 7998f282a47..53dd4d57ab8 100644
--- a/llvm/lib/IR/LLVMContextImpl.cpp
+++ b/llvm/lib/IR/LLVMContextImpl.cpp
@@ -233,6 +233,12 @@ void LLVMContextImpl::getSyncScopeNames(
/// enabled in order to enable a consistent bisect count.
static ManagedStatic<OptBisect> OptBisector;
-OptPassGate &LLVMContextImpl::getOptPassGate() {
- return *OptBisector;
+OptPassGate &LLVMContextImpl::getOptPassGate() const {
+ if (!OPG)
+ OPG = &(*OptBisector);
+ return *OPG;
+}
+
+void LLVMContextImpl::setOptPassGate(OptPassGate& OPG) {
+ this->OPG = &OPG;
}
OpenPOWER on IntegriCloud