[llvm-commits] [llvm] r144020 - /llvm/trunk/lib/CodeGen/ExecutionDepsFix.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Mon Nov 7 13:40:27 PST 2011


Author: stoklund
Date: Mon Nov  7 15:40:27 2011
New Revision: 144020

URL: http://llvm.org/viewvc/llvm-project?rev=144020&view=rev
Log:
Extract two methods.  No functional change.

Modified:
    llvm/trunk/lib/CodeGen/ExecutionDepsFix.cpp

Modified: llvm/trunk/lib/CodeGen/ExecutionDepsFix.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ExecutionDepsFix.cpp?rev=144020&r1=144019&r2=144020&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/ExecutionDepsFix.cpp (original)
+++ llvm/trunk/lib/CodeGen/ExecutionDepsFix.cpp Mon Nov  7 15:40:27 2011
@@ -149,6 +149,8 @@
   bool Merge(DomainValue *A, DomainValue *B);
 
   void enterBasicBlock(MachineBasicBlock*);
+  void leaveBasicBlock(MachineBasicBlock*);
+  void visitInstr(MachineInstr*);
   void visitGenericInstr(MachineInstr*);
   void visitSoftInstr(MachineInstr*, unsigned mask);
   void visitHardInstr(MachineInstr*, unsigned domain);
@@ -305,6 +307,27 @@
   }
 }
 
+void ExeDepsFix::leaveBasicBlock(MachineBasicBlock *MBB) {
+  // Save live registers at end of MBB - used by enterBasicBlock().
+  if (LiveRegs)
+    LiveOuts.insert(std::make_pair(MBB, LiveRegs));
+  LiveRegs = 0;
+}
+
+void ExeDepsFix::visitInstr(MachineInstr *MI) {
+  if (MI->isDebugValue())
+    return;
+  ++Distance;
+  std::pair<uint16_t, uint16_t> domp = TII->getExecutionDomain(MI);
+  if (domp.first)
+    if (domp.second)
+      visitSoftInstr(MI, domp.second);
+    else
+      visitHardInstr(MI, domp.first);
+  else if (LiveRegs)
+    visitGenericInstr(MI);
+}
+
 // A hard instruction only works in one domain. All input registers will be
 // forced into that domain.
 void ExeDepsFix::visitHardInstr(MachineInstr *mi, unsigned domain) {
@@ -483,24 +506,9 @@
     MachineBasicBlock *MBB = *DFI;
     enterBasicBlock(MBB);
     for (MachineBasicBlock::iterator I = MBB->begin(), E = MBB->end(); I != E;
-        ++I) {
-      MachineInstr *mi = I;
-      if (mi->isDebugValue()) continue;
-      ++Distance;
-      std::pair<uint16_t, uint16_t> domp = TII->getExecutionDomain(mi);
-      if (domp.first)
-        if (domp.second)
-          visitSoftInstr(mi, domp.second);
-        else
-          visitHardInstr(mi, domp.first);
-      else if (LiveRegs)
-        visitGenericInstr(mi);
-    }
-
-    // Save live registers at end of MBB - used by enterBasicBlock().
-    if (LiveRegs)
-      LiveOuts.insert(std::make_pair(MBB, LiveRegs));
-    LiveRegs = 0;
+        ++I)
+      visitInstr(I);
+    leaveBasicBlock(MBB);
   }
 
   // Clear the LiveOuts vectors. Should we also collapse any remaining





More information about the llvm-commits mailing list