diff options
author | Anton Korobeynikov <asl@math.spbu.ru> | 2010-07-24 20:48:54 +0000 |
---|---|---|
committer | Anton Korobeynikov <asl@math.spbu.ru> | 2010-07-24 20:48:54 +0000 |
commit | 8c64b9766e654079339ea7f3a2da152f18d00179 (patch) | |
tree | d62766e7cee631cf10aa71a3322e6aa26bb5b0fc | |
parent | fee12b29851983ab536d46ed0fe85bddd665638a (diff) | |
download | external_llvm-8c64b9766e654079339ea7f3a2da152f18d00179.tar.gz external_llvm-8c64b9766e654079339ea7f3a2da152f18d00179.tar.bz2 external_llvm-8c64b9766e654079339ea7f3a2da152f18d00179.zip |
Add hook to insert late LLVM=>LLVM passes just before isel
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109354 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/Target/TargetMachine.h | 13 | ||||
-rw-r--r-- | lib/CodeGen/LLVMTargetMachine.cpp | 2 |
2 files changed, 11 insertions, 4 deletions
diff --git a/include/llvm/Target/TargetMachine.h b/include/llvm/Target/TargetMachine.h index 60c0064cec..42e99e0156 100644 --- a/include/llvm/Target/TargetMachine.h +++ b/include/llvm/Target/TargetMachine.h @@ -312,10 +312,15 @@ public: bool DisableVerify = true); /// Target-Independent Code Generator Pass Configuration Options. - - /// addInstSelector - This method should add any "last minute" LLVM->LLVM - /// passes, then install an instruction selector pass, which converts from - /// LLVM code to machine instructions. + + /// addPreISelPasses - This method should add any "last minute" LLVM->LLVM + /// passes (which are run just before instruction selector). + virtual bool addPreISel(PassManagerBase &, CodeGenOpt::Level) { + return true; + } + + /// addInstSelector - This method should install an instruction selector pass, + /// which converts from LLVM code to machine instructions. virtual bool addInstSelector(PassManagerBase &, CodeGenOpt::Level) { return true; } diff --git a/lib/CodeGen/LLVMTargetMachine.cpp b/lib/CodeGen/LLVMTargetMachine.cpp index fd102416d8..98d49ad65a 100644 --- a/lib/CodeGen/LLVMTargetMachine.cpp +++ b/lib/CodeGen/LLVMTargetMachine.cpp @@ -307,6 +307,8 @@ bool LLVMTargetMachine::addCommonCodeGenPasses(PassManagerBase &PM, PM.add(createStackProtectorPass(getTargetLowering())); + addPreISel(PM, OptLevel); + if (PrintISelInput) PM.add(createPrintFunctionPass("\n\n" "*** Final LLVM Code input to ISel ***\n", |