diff options
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/LLVMTargetMachine.cpp | 16 |
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(); |

