[llvm-commits] [llvm] r150093 - in /llvm/trunk: include/llvm/CodeGen/Passes.h lib/CodeGen/LLVMTargetMachine.cpp lib/CodeGen/Passes.cpp lib/Target/PTX/PTXTargetMachine.cpp
Andrew Trick
atrick at apple.com
Wed Feb 8 13:22:39 PST 2012
Author: atrick
Date: Wed Feb 8 15:22:39 2012
New Revision: 150093
URL: http://llvm.org/viewvc/llvm-project?rev=150093&view=rev
Log:
Added TargetPassConfig::setOpt
Modified:
llvm/trunk/include/llvm/CodeGen/Passes.h
llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp
llvm/trunk/lib/CodeGen/Passes.cpp
llvm/trunk/lib/Target/PTX/PTXTargetMachine.cpp
Modified: llvm/trunk/include/llvm/CodeGen/Passes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/Passes.h?rev=150093&r1=150092&r2=150093&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/Passes.h (original)
+++ llvm/trunk/include/llvm/CodeGen/Passes.h Wed Feb 8 15:22:39 2012
@@ -39,6 +39,7 @@
protected:
TargetMachine *TM;
PassManagerBase ±
+ bool Initialized; // Flagged after all passes are configured.
// Target Pass Options
//
@@ -62,6 +63,8 @@
return TM->getTargetLowering();
}
+ void setInitialized() { Initialized = true; }
+
CodeGenOpt::Level getOptLevel() const { return TM->getOptLevel(); }
void setDisableVerify(bool disable) { DisableVerify = disable; }
@@ -84,6 +87,9 @@
/// Fully developed targets will not generally override this.
virtual void addMachinePasses();
protected:
+ // Helper to verify the analysis is really immutable.
+ void setOpt(bool &Opt, bool Val);
+
/// Methods with trivial inline returns are convenient points in the common
/// codegen pass pipeline where targets may insert passes. Methods with
/// out-of-line standard implementations are major CodeGen stages called by
Modified: llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp?rev=150093&r1=150092&r2=150093&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp (original)
+++ llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Wed Feb 8 15:22:39 2012
@@ -147,6 +147,8 @@
PassConfig->addMachinePasses();
+ PassConfig->setInitialized();
+
return Context;
}
Modified: llvm/trunk/lib/CodeGen/Passes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/Passes.cpp?rev=150093&r1=150092&r2=150093&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/Passes.cpp (original)
+++ llvm/trunk/lib/CodeGen/Passes.cpp Wed Feb 8 15:22:39 2012
@@ -84,7 +84,10 @@
TargetPassConfig::~TargetPassConfig() {}
TargetPassConfig::TargetPassConfig(TargetMachine *tm, PassManagerBase &pm)
- : ImmutablePass(ID), TM(tm), PM(pm), DisableVerify(false) {
+ : ImmutablePass(ID), TM(tm), PM(pm), Initialized(false),
+ DisableVerify(false),
+ EnableTailMerge(true) {
+
// Register all target independent codegen passes to activate their PassIDs,
// including this pass itself.
initializeCodeGen(*PassRegistry::getPassRegistry());
@@ -103,6 +106,12 @@
llvm_unreachable("TargetPassConfig should not be constructed on-the-fly");
}
+// Helper to verify the analysis is really immutable.
+void TargetPassConfig::setOpt(bool &Opt, bool Val) {
+ assert(!Initialized && "PassConfig is immutable");
+ Opt = Val;
+}
+
void TargetPassConfig::addPass(char &ID) {
// FIXME: check user overrides
Pass *P = Pass::createPass(ID);
Modified: llvm/trunk/lib/Target/PTX/PTXTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PTX/PTXTargetMachine.cpp?rev=150093&r1=150092&r2=150093&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PTX/PTXTargetMachine.cpp (original)
+++ llvm/trunk/lib/Target/PTX/PTXTargetMachine.cpp Wed Feb 8 15:22:39 2012
@@ -385,5 +385,7 @@
PM.add(createPTXMFInfoExtract(getPTXTargetMachine(), getOptLevel()));
PM.add(createPTXFPRoundingModePass(getPTXTargetMachine(), getOptLevel()));
+ setInitialized();
+
return false;
}
More information about the llvm-commits
mailing list