Add register pairs to the list to check for local interferences.
authorOwen Anderson <resistor@mac.com>
Thu, 13 Dec 2007 05:53:03 +0000 (05:53 +0000)
committerOwen Anderson <resistor@mac.com>
Thu, 13 Dec 2007 05:53:03 +0000 (05:53 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44987 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/StrongPHIElimination.cpp

index eef10ef3c0df0228aedd3778712363bc8fe83e0e..9b1c163dcfba86485f41d23bdcd3dacd75784031 100644 (file)
@@ -99,7 +99,8 @@ namespace {
     std::vector<DomForestNode*> computeDomForest(std::set<unsigned>& instrs);
     void processPHIUnion(MachineInstr* Inst,
                          std::set<unsigned>& PHIUnion,
-                         std::vector<StrongPHIElimination::DomForestNode*>& DF);
+                         std::vector<StrongPHIElimination::DomForestNode*>& DF,
+                         std::vector<std::pair<unsigned, unsigned> >& locals);
     void breakCriticalEdges(MachineFunction &Fn);
     
   };
@@ -300,6 +301,10 @@ void StrongPHIElimination::processBlock(MachineBasicBlock* MBB) {
                                                      computeDomForest(PHIUnion);
     
     // Walk DomForest to resolve interferences
+    std::vector<std::pair<unsigned, unsigned> > localInterferences;
+    processPHIUnion(P, PHIUnion, DF, localInterferences);
+    
+    // FIXME: Check for local interferences
     
     ProcessedNames.insert(PHIUnion.begin(), PHIUnion.end());
     ++P;
@@ -308,7 +313,8 @@ void StrongPHIElimination::processBlock(MachineBasicBlock* MBB) {
 
 void StrongPHIElimination::processPHIUnion(MachineInstr* Inst,
                                            std::set<unsigned>& PHIUnion,
-                        std::vector<StrongPHIElimination::DomForestNode*>& DF) {
+                        std::vector<StrongPHIElimination::DomForestNode*>& DF,
+                        std::vector<std::pair<unsigned, unsigned> >& locals) {
   
   std::vector<DomForestNode*> worklist(DF.begin(), DF.end());
   SmallPtrSet<DomForestNode*, 4> visited;
@@ -323,7 +329,6 @@ void StrongPHIElimination::processPHIUnion(MachineInstr* Inst,
     visited.insert(DFNode);
     
     bool inserted = false;
-    SmallPtrSet<DomForestNode*, 4> interferences;
     for (DomForestNode::iterator CI = DFNode->begin(), CE = DFNode->end();
          CI != CE; ++CI) {
       DomForestNode* child = *CI;   
@@ -342,7 +347,8 @@ void StrongPHIElimination::processPHIUnion(MachineInstr* Inst,
         }
       } else if (isLiveIn(Info, CInfo.DefInst->getParent()) ||
                  Info.DefInst->getParent() == CInfo.DefInst->getParent()) {
-        // FIXME: Add (p, c) to possible local interferences
+        // Add (p, c) to possible local interferences
+        locals.push_back(std::make_pair(DFNode->getReg(), child->getReg()));
       }
         
       if (!visited.count(child)) {