diff options
author | Andrew Trick <atrick@apple.com> | 2012-02-04 02:56:45 +0000 |
---|---|---|
committer | Andrew Trick <atrick@apple.com> | 2012-02-04 02:56:45 +0000 |
commit | 7461334084aa77286b6f9af596fb0f6ba0465685 (patch) | |
tree | a4b8dfa2062e677f30ef79d81591a892899f09fd /lib/CodeGen/LLVMTargetMachine.cpp | |
parent | 2b2c7b9c5256d7cfc7786ed8012bc90c3d50c176 (diff) |
Make TargetPassConfig an ImmutablePass so CodeGenPasses can query options
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149752 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LLVMTargetMachine.cpp')
-rw-r--r-- | lib/CodeGen/LLVMTargetMachine.cpp | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/lib/CodeGen/LLVMTargetMachine.cpp b/lib/CodeGen/LLVMTargetMachine.cpp index 3490e8f26f..ff729baf80 100644 --- a/lib/CodeGen/LLVMTargetMachine.cpp +++ b/lib/CodeGen/LLVMTargetMachine.cpp @@ -125,27 +125,14 @@ LLVMTargetMachine::LLVMTargetMachine(const Target &T, StringRef Triple, "and that InitializeAllTargetMCs() is being invoked!"); } -TargetPassConfig::TargetPassConfig(TargetMachine *tm, PassManagerBase &pm, - bool DisableVerifyFlag) - : TM(tm), PM(pm), DisableVerify(DisableVerifyFlag) { - // Register all target independent codegen passes to activate their PassIDs. - initializeCodeGen(*PassRegistry::getPassRegistry()); -} - -/// createPassConfig - Create a pass configuration object to be used by -/// addPassToEmitX methods for generating a pipeline of CodeGen passes. -TargetPassConfig *LLVMTargetMachine::createPassConfig(PassManagerBase &PM, - bool DisableVerify) { - return new TargetPassConfig(this, PM, DisableVerify); -} - bool LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM, formatted_raw_ostream &Out, CodeGenFileType FileType, bool DisableVerify) { // Add common CodeGen passes. MCContext *Context = 0; - OwningPtr<TargetPassConfig> PassConfig(createPassConfig(PM, DisableVerify)); + TargetPassConfig *PassConfig = createPassConfig(PM, DisableVerify); + PM.add(PassConfig); if (PassConfig->addCodeGenPasses(Context)) return true; assert(Context != 0 && "Failed to get MCContext"); |