[llvm-commits] CVS: llvm/lib/Target/X86/X86FloatingPoint.cpp

Evan Cheng evan.cheng at apple.com
Wed Nov 15 12:56:53 PST 2006



Changes in directory llvm/lib/Target/X86:

X86FloatingPoint.cpp updated: 1.59 -> 1.60
---
Log message:

Kill / dead info has been moved to MI's.

---
Diffs of the changes:  (+11 -18)

 X86FloatingPoint.cpp |   29 +++++++++++------------------
 1 files changed, 11 insertions(+), 18 deletions(-)


Index: llvm/lib/Target/X86/X86FloatingPoint.cpp
diff -u llvm/lib/Target/X86/X86FloatingPoint.cpp:1.59 llvm/lib/Target/X86/X86FloatingPoint.cpp:1.60
--- llvm/lib/Target/X86/X86FloatingPoint.cpp:1.59	Tue Nov 14 13:20:33 2006
+++ llvm/lib/Target/X86/X86FloatingPoint.cpp	Wed Nov 15 14:56:39 2006
@@ -40,6 +40,7 @@
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/ADT/DepthFirstIterator.h"
+#include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/ADT/STLExtras.h"
 #include <algorithm>
@@ -213,20 +214,12 @@
 
     // Get dead variables list now because the MI pointer may be deleted as part
     // of processing!
-    LiveVariables::killed_iterator IB, IE;
-    tie(IB, IE) = LV->dead_range(MI);
-
-    DEBUG(
-      const MRegisterInfo *MRI = MF.getTarget().getRegisterInfo();
-      LiveVariables::killed_iterator I = LV->killed_begin(MI);
-      LiveVariables::killed_iterator E = LV->killed_end(MI);
-      if (I != E) {
-        std::cerr << "Killed Operands:";
-        for (; I != E; ++I)
-          std::cerr << " %" << MRI->getName(*I);
-        std::cerr << "\n";
-      }
-    );
+    SmallVector<unsigned, 8> DeadRegs;
+    for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
+      const MachineOperand &MO = MI->getOperand(i);
+      if (MO.isReg() && MO.isDead())
+        DeadRegs.push_back(MO.getReg());
+    }
 
     switch (Flags & X86II::FPTypeMask) {
     case X86II::ZeroArgFP:  handleZeroArgFP(I); break;
@@ -241,8 +234,8 @@
 
     // Check to see if any of the values defined by this instruction are dead
     // after definition.  If so, pop them.
-    for (; IB != IE; ++IB) {
-      unsigned Reg = *IB;
+    for (unsigned i = 0, e = DeadRegs.size(); i != e; ++i) {
+      unsigned Reg = DeadRegs[i];
       if (Reg >= X86::FP0 && Reg <= X86::FP6) {
         DEBUG(std::cerr << "Register FP#" << Reg-X86::FP0 << " is dead!\n");
         freeStackSlotAfter(I, Reg-X86::FP0);
@@ -762,6 +755,7 @@
 
   unsigned Op0 = getFPReg(MI->getOperand(0));
   unsigned Op1 = getFPReg(MI->getOperand(2));
+  bool KillsOp1 = LV->KillsRegister(MI, X86::FP0+Op1);
 
   // The first operand *must* be on the top of the stack.
   moveToTop(Op0, I);
@@ -773,9 +767,8 @@
   MI->getOperand(0).setReg(getSTReg(Op1));
   MI->setOpcode(getConcreteOpcode(MI->getOpcode()));
   
-  
   // If we kill the second operand, make sure to pop it from the stack.
-  if (Op0 != Op1 && LV->KillsRegister(MI, X86::FP0+Op1)) {
+  if (Op0 != Op1 && KillsOp1) {
     // Get this value off of the register stack.
     freeStackSlotAfter(I, Op1);
   }






More information about the llvm-commits mailing list