[llvm-commits] [llvm] r149926 - in /llvm/trunk/lib: CodeGen/LLVMTargetMachine.cpp Target/PTX/PTXTargetMachine.cpp
Andrew Trick
atrick at apple.com
Mon Feb 6 14:51:16 PST 2012
Author: atrick
Date: Mon Feb 6 16:51:15 2012
New Revision: 149926
URL: http://llvm.org/viewvc/llvm-project?rev=149926&view=rev
Log:
Add TargetPassConfig to the PassManager for use inside passes
Modified:
llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp
llvm/trunk/lib/Target/PTX/PTXTargetMachine.cpp
Modified: llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp?rev=149926&r1=149925&r2=149926&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp (original)
+++ llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Mon Feb 6 16:51:15 2012
@@ -116,6 +116,8 @@
// Set PassConfig options provided by TargetMachine.
PassConfig->setDisableVerify(DisableVerify);
+ PM.add(PassConfig);
+
PassConfig->addIRPasses();
addPassesToHandleExceptions(TM, PM);
@@ -145,8 +147,6 @@
PassConfig->addMachinePasses();
- delete PassConfig;
-
return Context;
}
Modified: llvm/trunk/lib/Target/PTX/PTXTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PTX/PTXTargetMachine.cpp?rev=149926&r1=149925&r2=149926&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PTX/PTXTargetMachine.cpp (original)
+++ llvm/trunk/lib/Target/PTX/PTXTargetMachine.cpp Mon Feb 6 16:51:15 2012
@@ -105,7 +105,7 @@
: PTXTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, true) {
}
-namespace {
+namespace llvm {
/// PTX Code Generator Pass Configuration Options.
class PTXPassConfig : public TargetPassConfig {
public:
@@ -147,11 +147,13 @@
MCContext *Context = 0;
// FIXME: soon this will be converted to use the exposed TargetPassConfig API.
- OwningPtr<PTXPassConfig> PassConfig(
- static_cast<PTXPassConfig*>(createPassConfig(PM)));
+ PTXPassConfig *PassConfig =
+ static_cast<PTXPassConfig*>(createPassConfig(PM));
PassConfig->setDisableVerify(DisableVerify);
+ PM.add(PassConfig);
+
if (PassConfig->addCodeGenPasses(Context))
return true;
assert(Context != 0 && "Failed to get MCContext");
More information about the llvm-commits
mailing list