summaryrefslogtreecommitdiff
path: root/include/llvm
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2012-02-15 03:21:47 +0000
committerAndrew Trick <atrick@apple.com>2012-02-15 03:21:47 +0000
commit5e108eeeef34dd2afa00d1da77bca47188de4244 (patch)
tree7d563c9ce0de3bdfd6ff3a289d2aa601e9f54909 /include/llvm
parent5fd84a24e6bfccc31b6daff7b54b2b13fb2906f6 (diff)
downloadllvm-5e108eeeef34dd2afa00d1da77bca47188de4244.tar.gz
llvm-5e108eeeef34dd2afa00d1da77bca47188de4244.tar.bz2
llvm-5e108eeeef34dd2afa00d1da77bca47188de4244.tar.xz
Added TargetPassConfig::disablePass/substitutePass as a general mechanism to override specific passes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150562 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/CodeGen/Passes.h23
-rw-r--r--include/llvm/Pass.h2
2 files changed, 21 insertions, 4 deletions
diff --git a/include/llvm/CodeGen/Passes.h b/include/llvm/CodeGen/Passes.h
index e9778f66f6..2e4fb99081 100644
--- a/include/llvm/CodeGen/Passes.h
+++ b/include/llvm/CodeGen/Passes.h
@@ -33,6 +33,8 @@ namespace llvm {
extern char &NoPassID; // Allow targets to choose not to run a pass.
+class PassConfigImpl;
+
/// Target-Independent Code Generator Pass Configuration Options.
///
/// This is an ImmutablePass solely for the purpose of exposing CodeGen options
@@ -41,7 +43,8 @@ class TargetPassConfig : public ImmutablePass {
protected:
TargetMachine *TM;
PassManagerBase &PM;
- bool Initialized; // Flagged after all passes are configured.
+ PassConfigImpl *Impl; // Internal data structures
+ bool Initialized; // Flagged after all passes are configured.
// Target Pass Options
// Targets provide a default setting, user flags override.
@@ -69,6 +72,7 @@ public:
return TM->getTargetLowering();
}
+ //
void setInitialized() { Initialized = true; }
CodeGenOpt::Level getOptLevel() const { return TM->getOptLevel(); }
@@ -78,6 +82,18 @@ public:
bool getEnableTailMerge() const { return EnableTailMerge; }
void setEnableTailMerge(bool Enable) { setOpt(EnableTailMerge, Enable); }
+ /// Allow the target to override a specific pass without overriding the pass
+ /// pipeline. When passes are added to the standard pipeline at the
+ /// point where StadardID is expected, add TargetID in its place.
+ void substitutePass(char &StandardID, char &TargetID);
+
+ /// Allow the target to disable a specific standard pass.
+ void disablePass(char &ID) { substitutePass(ID, NoPassID); }
+
+ /// Return the pass ssubtituted for StandardID by the target.
+ /// If no substitution exists, return StandardID.
+ AnalysisID getPassSubstitution(AnalysisID StandardID) const;
+
/// Return true if the optimized regalloc pipeline is enabled.
bool getOptimizeRegAlloc() const;
@@ -187,8 +203,9 @@ protected:
/// Utilities for targets to add passes to the pass manager.
///
- /// Add a target-independent CodeGen pass at this point in the pipeline.
- void addPass(char &ID);
+ /// Add a CodeGen pass at this point in the pipeline after checking overrides.
+ /// Return the pass that was added, or NoPassID.
+ AnalysisID addPass(char &ID);
/// addMachinePasses helper to create the target-selected or overriden
/// regalloc pass.
diff --git a/include/llvm/Pass.h b/include/llvm/Pass.h
index a0cbca121d..888537daa4 100644
--- a/include/llvm/Pass.h
+++ b/include/llvm/Pass.h
@@ -177,7 +177,7 @@ public:
// createPass - Create a object for the specified pass class,
// or null if it is not known.
- static Pass *createPass(char &TI);
+ static Pass *createPass(AnalysisID ID);
/// getAnalysisIfAvailable<AnalysisType>() - Subclasses use this function to
/// get analysis information that might be around, for example to update it.