diff options
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/LLVMTargetMachine.cpp | 2 | ||||
-rw-r--r-- | lib/CodeGen/Passes.cpp | 10 |
2 files changed, 9 insertions, 3 deletions
diff --git a/lib/CodeGen/LLVMTargetMachine.cpp b/lib/CodeGen/LLVMTargetMachine.cpp index 91ec038725..db2a54fcad 100644 --- a/lib/CodeGen/LLVMTargetMachine.cpp +++ b/lib/CodeGen/LLVMTargetMachine.cpp @@ -96,6 +96,8 @@ static MCContext *addPassesToGenerateCode(LLVMTargetMachine *TM, PassConfig->addIRPasses(); + PassConfig->addCodeGenPrepare(); + PassConfig->addPassesToHandleExceptions(); PassConfig->addISelPrepare(); diff --git a/lib/CodeGen/Passes.cpp b/lib/CodeGen/Passes.cpp index 526d994abb..36c60b415d 100644 --- a/lib/CodeGen/Passes.cpp +++ b/lib/CodeGen/Passes.cpp @@ -400,12 +400,16 @@ void TargetPassConfig::addPassesToHandleExceptions() { } } -/// Add common passes that perform LLVM IR to IR transforms in preparation for -/// instruction selection. -void TargetPassConfig::addISelPrepare() { +/// Add pass to prepare the LLVM IR for code generation. This should be done +/// before exception handling preparation passes. +void TargetPassConfig::addCodeGenPrepare() { if (getOptLevel() != CodeGenOpt::None && !DisableCGP) addPass(createCodeGenPreparePass(getTargetLowering())); +} +/// Add common passes that perform LLVM IR to IR transforms in preparation for +/// instruction selection. +void TargetPassConfig::addISelPrepare() { addPass(createStackProtectorPass(getTargetLowering())); addPreISel(); |