Move pass configuration out of pass constructors: StackSlotColoring.
[oota-llvm.git] / include / llvm / CodeGen / Passes.h
index 30abcd7b9254ccd2f323999474f1385ef9e1d208..204898f8d6475deff876593cddbe70222c4d69b8 100644 (file)
@@ -39,11 +39,16 @@ class TargetPassConfig : public ImmutablePass {
 protected:
   TargetMachine *TM;
   PassManagerBase ±
+  bool Initialized; // Flagged after all passes are configured.
 
   // Target Pass Options
+  // Targets provide a default setting, user flags override.
   //
   bool DisableVerify;
 
+  /// Default setting for -enable-tail-merge on this target.
+  bool EnableTailMerge;
+
 public:
   TargetPassConfig(TargetMachine *tm, PassManagerBase &pm);
   // Dummy constructor.
@@ -62,9 +67,14 @@ public:
     return TM->getTargetLowering();
   }
 
+  void setInitialized() { Initialized = true; }
+
   CodeGenOpt::Level getOptLevel() const { return TM->getOptLevel(); }
 
-  void setDisableVerify(bool disable) { DisableVerify = disable; }
+  void setDisableVerify(bool Disable) { setOpt(DisableVerify, Disable); }
+
+  bool getEnableTailMerge() const { return EnableTailMerge; }
+  void setEnableTailMerge(bool Enable) { setOpt(EnableTailMerge, Enable); }
 
   /// Add common target configurable passes that perform LLVM IR to IR
   /// transforms following machine independent optimization.
@@ -84,6 +94,9 @@ public:
   /// 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
@@ -112,10 +125,6 @@ protected:
     return false;
   }
 
-  /// getEnableTailMergeDefault - the default setting for -enable-tail-merge
-  /// on this target.  User flag overrides.
-  virtual bool getEnableTailMergeDefault() const { return true; }
-
   /// addPreSched2 - This method may be implemented by targets that want to
   /// run passes after prolog-epilog insertion and before the second instruction
   /// scheduling pass.  This should return true if -print-machineinstrs should
@@ -135,7 +144,7 @@ protected:
   ///
 
   /// Add a target-independent CodeGen pass at this point in the pipeline.
-  void addCommonPass(char &ID);
+  void addPass(char &ID);
 
   /// printNoVerify - Add a pass to dump the machine function, if debugging is
   /// enabled.
@@ -262,17 +271,17 @@ namespace llvm {
 
   /// createPostRAScheduler - This pass performs post register allocation
   /// scheduling.
-  FunctionPass *createPostRAScheduler(CodeGenOpt::Level OptLevel);
+  FunctionPass *createPostRAScheduler();
 
   /// BranchFolding Pass - This pass performs machine code CFG based
   /// optimizations to delete branches to branches, eliminate branches to
   /// successor blocks (creating fall throughs), and eliminating branches over
   /// branches.
-  FunctionPass *createBranchFoldingPass(bool DefaultEnableTailMerge);
+  extern char &BranchFolderPassID;
 
   /// TailDuplicate Pass - Duplicate blocks with unconditional branches
   /// into tails of their predecessors.
-  FunctionPass *createTailDuplicatePass(bool PreRegAlloc = false);
+  FunctionPass *createTailDuplicatePass();
 
   /// IfConverter Pass - This pass performs machine code if conversion.
   FunctionPass *createIfConverterPass();
@@ -333,7 +342,7 @@ namespace llvm {
   FunctionPass *createOptimizePHIsPass();
 
   /// createStackSlotColoringPass - This pass performs stack slot coloring.
-  FunctionPass *createStackSlotColoringPass(bool);
+  FunctionPass *createStackSlotColoringPass();
 
   /// createStackProtectorPass - This pass adds stack protectors to functions.
   FunctionPass *createStackProtectorPass(const TargetLowering *tli);