Don't recalculate the loop info and loop dominators analyses if they're
authorBill Wendling <isanbard@gmail.com>
Fri, 4 Jan 2008 20:54:55 +0000 (20:54 +0000)
committerBill Wendling <isanbard@gmail.com>
Fri, 4 Jan 2008 20:54:55 +0000 (20:54 +0000)
preserved.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45596 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/Passes.h
lib/CodeGen/LiveIntervalAnalysis.cpp
lib/CodeGen/MachineDominators.cpp
lib/CodeGen/MachineLoopInfo.cpp
lib/CodeGen/PHIElimination.cpp
lib/CodeGen/RegAllocLinearScan.cpp
lib/CodeGen/SimpleRegisterCoalescing.cpp
lib/CodeGen/TwoAddressInstructionPass.cpp

index 8899a21922dc23e9f33c62897f749b6f0af05adf..be7857c657c2993ab913a82794fa73e781ffb09c 100644 (file)
@@ -38,6 +38,14 @@ namespace llvm {
   FunctionPass *createMachineFunctionPrinterPass(std::ostream *OS,
                                                  const std::string &Banner ="");
 
+  /// MachineLoopInfo pass - This pass is a loop analysis pass.
+  /// 
+  extern const PassInfo *MachineLoopInfoID;
+
+  /// MachineDominators pass - This pass is a machine dominators analysis pass.
+  /// 
+  extern const PassInfo *MachineDominatorsID;
+
   /// PHIElimination pass - This pass eliminates machine instruction PHI nodes
   /// by inserting copy instructions.  This destroys SSA information, but is the
   /// desired input for some register allocators.  This pass is "required" by
index 46cdec7bd6d8421e6c1396299298a4f4bea08bb5..5c9d69a231f4a8497c568e7618c74d582fe869ad 100644 (file)
@@ -60,6 +60,8 @@ namespace {
 void LiveIntervals::getAnalysisUsage(AnalysisUsage &AU) const {
   AU.addPreserved<LiveVariables>();
   AU.addRequired<LiveVariables>();
+  AU.addPreservedID(MachineLoopInfoID);
+  AU.addPreservedID(MachineDominatorsID);
   AU.addPreservedID(PHIEliminationID);
   AU.addRequiredID(PHIEliminationID);
   AU.addRequiredID(TwoAddressInstructionPassID);
index e343240ea2741570a276b88bfebbf41068f4e15a..7c521ccb0e86bcfd71920cee2ec106053c427168 100644 (file)
 //===----------------------------------------------------------------------===//
 
 #include "llvm/CodeGen/MachineDominators.h"
+#include "llvm/CodeGen/Passes.h"
 
 using namespace llvm;
 
 TEMPLATE_INSTANTIATION(class DomTreeNodeBase<MachineBasicBlock>);
 TEMPLATE_INSTANTIATION(class DominatorTreeBase<MachineBasicBlock>);
 
-char MachineDominatorTree::ID = 0;
-static RegisterPass<MachineDominatorTree>
-E("machinedomtree", "MachineDominator Tree Construction", true);
+namespace {
+  char MachineDominatorTree::ID = 0;
+  RegisterPass<MachineDominatorTree>
+  E("machinedomtree", "MachineDominator Tree Construction", true);
+}
+
+const PassInfo *llvm::MachineDominatorsID = E.getPassInfo();
index d134357d2af9eff96d9ea919ffc91e486e711132..ad4ad1cea9e47f3c3651fa79e9871039f158a0f6 100644 (file)
 
 #include "llvm/CodeGen/MachineLoopInfo.h"
 #include "llvm/CodeGen/MachineDominators.h"
+#include "llvm/CodeGen/Passes.h"
 
 using namespace llvm;
 
 TEMPLATE_INSTANTIATION(class LoopBase<MachineBasicBlock>);
 TEMPLATE_INSTANTIATION(class LoopInfoBase<MachineBasicBlock>);
 
-char MachineLoopInfo::ID = 0;
-static RegisterPass<MachineLoopInfo>
-X("machine-loops", "Machine Natural Loop Construction", true);
+namespace {
+  char MachineLoopInfo::ID = 0;
+  RegisterPass<MachineLoopInfo>
+  X("machine-loops", "Machine Natural Loop Construction", true);
+}
+
+const PassInfo *llvm::MachineLoopInfoID = X.getPassInfo();
 
 bool MachineLoopInfo::runOnMachineFunction(MachineFunction &) {
   releaseMemory();
index 07c4ef3f50948c3b13e38ebdb0b25ffa226c0777..9276937561b093a24beacb3a18a1970f8c90a018 100644 (file)
@@ -51,6 +51,8 @@ namespace {
 
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
       AU.addPreserved<LiveVariables>();
+      AU.addPreservedID(MachineLoopInfoID);
+      AU.addPreservedID(MachineDominatorsID);
       MachineFunctionPass::getAnalysisUsage(AU);
     }
 
index 17d416a4a6345e4d44debef3a0c690d06e7277c8..6f850eb1b355abff0be400e490c0c0ec848b0e4e 100644 (file)
@@ -104,6 +104,8 @@ namespace {
       // to coalescing and which analyses coalescing invalidates.
       AU.addRequiredTransitive<RegisterCoalescer>();
       AU.addRequired<MachineLoopInfo>();
+      AU.addPreserved<MachineLoopInfo>();
+      AU.addPreservedID(MachineDominatorsID);
       MachineFunctionPass::getAnalysisUsage(AU);
     }
 
index 69dd56d8439b48d779070c29cc3cc0be8c5ad7df..de94688e3abf7525034b5a5a09a8c8a3c734731c 100644 (file)
@@ -67,6 +67,8 @@ const PassInfo *llvm::SimpleRegisterCoalescingID = X.getPassInfo();
 
 void SimpleRegisterCoalescing::getAnalysisUsage(AnalysisUsage &AU) const {
   AU.addPreserved<LiveIntervals>();
+  AU.addPreserved<MachineLoopInfo>();
+  AU.addPreservedID(MachineDominatorsID);
   AU.addPreservedID(PHIEliminationID);
   AU.addPreservedID(TwoAddressInstructionPassID);
   AU.addRequired<LiveVariables>();
index dd71bec7eb8a247282d1304c0597f22c7ef30730..8f0c473d48da3efc32467a7e69959a3cf463294f 100644 (file)
@@ -69,6 +69,8 @@ const PassInfo *llvm::TwoAddressInstructionPassID = X.getPassInfo();
 void TwoAddressInstructionPass::getAnalysisUsage(AnalysisUsage &AU) const {
   AU.addRequired<LiveVariables>();
   AU.addPreserved<LiveVariables>();
+  AU.addPreservedID(MachineLoopInfoID);
+  AU.addPreservedID(MachineDominatorsID);
   AU.addPreservedID(PHIEliminationID);
   MachineFunctionPass::getAnalysisUsage(AU);
 }