From 977dfcefa1b139de56fd17e108b263e39e16504f Mon Sep 17 00:00:00 2001 From: Anton Korobeynikov Date: Wed, 7 Apr 2010 18:18:42 +0000 Subject: [PATCH] Add hook to insert late LLVM=>LLVM passes just before isel git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100640 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Target/TargetMachine.h | 13 +++++++++---- 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 d1d665f870f..2f29de55be2 100644 --- a/include/llvm/Target/TargetMachine.h +++ b/include/llvm/Target/TargetMachine.h @@ -264,10 +264,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 ced6664c4a3..714ad73e790 100644 --- a/lib/CodeGen/LLVMTargetMachine.cpp +++ b/lib/CodeGen/LLVMTargetMachine.cpp @@ -268,6 +268,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", -- 2.11.0