summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/LLVMTargetMachine.cpp
diff options
context:
space:
mode:
authorQuentin Colombet <qcolombet@apple.com>2016-02-11 17:57:22 +0000
committerQuentin Colombet <qcolombet@apple.com>2016-02-11 17:57:22 +0000
commit37a09a8428f895161fe8e11001d319ca199582e1 (patch)
treeaac38e39b039468c7b21e51247d702e639c60e41 /llvm/lib/CodeGen/LLVMTargetMachine.cpp
parent622410431157917c488dcdc7b1d64261e3b39e54 (diff)
downloadbcm5719-llvm-37a09a8428f895161fe8e11001d319ca199582e1.tar.gz
bcm5719-llvm-37a09a8428f895161fe8e11001d319ca199582e1.zip
[GlobalISel] Add a hook in TargetConfigPass to run GlobalISel.
llvm-svn: 260553
Diffstat (limited to 'llvm/lib/CodeGen/LLVMTargetMachine.cpp')
-rw-r--r--llvm/lib/CodeGen/LLVMTargetMachine.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/LLVMTargetMachine.cpp b/llvm/lib/CodeGen/LLVMTargetMachine.cpp
index 16357de83cf..0e6171607d5 100644
--- a/llvm/lib/CodeGen/LLVMTargetMachine.cpp
+++ b/llvm/lib/CodeGen/LLVMTargetMachine.cpp
@@ -42,6 +42,12 @@ static cl::opt<cl::boolOrDefault>
EnableFastISelOption("fast-isel", cl::Hidden,
cl::desc("Enable the \"fast\" instruction selector"));
+#ifdef LLVM_BUILD_GLOBAL_ISEL
+static cl::opt<bool>
+ EnableGlobalISel("global-isel", cl::Hidden, cl::init(false),
+ cl::desc("Enable the \"global\" instruction selector"));
+#endif
+
void LLVMTargetMachine::initAsmInfo() {
MRI = TheTarget.createMCRegInfo(getTargetTriple().str());
MII = TheTarget.createMCInstrInfo();
@@ -135,8 +141,14 @@ addPassesToGenerateCode(LLVMTargetMachine *TM, PassManagerBase &PM,
TM->getO0WantsFastISel()))
TM->setFastISel(true);
- // Ask the target for an isel.
- if (PassConfig->addInstSelector())
+#ifdef LLVM_BUILD_GLOBAL_ISEL
+ if (EnableGlobalISel) {
+ if (PassConfig->addIRTranslator())
+ return nullptr;
+ } else
+#endif
+ // Ask the target for an isel.
+ if (PassConfig->addInstSelector())
return nullptr;
PassConfig->addMachinePasses();
OpenPOWER on IntegriCloud