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

Alkis Evlogimenos alkis at cs.uiuc.edu
Sun Dec 14 07:25:01 PST 2003


Changes in directory llvm/lib/Target/X86:

Printer.cpp updated: 1.74 -> 1.75
PeepholeOptimizer.cpp updated: 1.8 -> 1.9

---
Log message:

Change interface of MachineOperand as follows:

    a) remove opIsUse(), opIsDefOnly(), opIsDefAndUse()
    b) add isUse(), isDef()
    c) rename opHiBits32() to isHiBits32(),
              opLoBits32() to isLoBits32(),
              opHiBits64() to isHiBits64(),
              opLoBits64() to isLoBits64().

This results to much more readable code, for example compare
"op.opIsDef() || op.opIsDefAndUse()" to "op.isDef()" a pattern used
very often in the code.


---
Diffs of the changes:  (+5 -8)

Index: llvm/lib/Target/X86/Printer.cpp
diff -u llvm/lib/Target/X86/Printer.cpp:1.74 llvm/lib/Target/X86/Printer.cpp:1.75
--- llvm/lib/Target/X86/Printer.cpp:1.74	Sun Nov 30 23:13:56 2003
+++ llvm/lib/Target/X86/Printer.cpp	Sun Dec 14 07:24:14 2003
@@ -551,8 +551,7 @@
       }
     } else {
       unsigned i = 0;
-      if (MI->getNumOperands() && (MI->getOperand(0).opIsDefOnly() || 
-                                   MI->getOperand(0).opIsDefAndUse())) {
+      if (MI->getNumOperands() && MI->getOperand(0).isDef()) {
 	printOp(MI->getOperand(0));
 	O << " = ";
 	++i;
@@ -561,11 +560,9 @@
 
       for (unsigned e = MI->getNumOperands(); i != e; ++i) {
 	O << " ";
-	if (MI->getOperand(i).opIsDefOnly() || 
-            MI->getOperand(i).opIsDefAndUse()) O << "*";
+	if (MI->getOperand(i).isDef()) O << "*";
 	printOp(MI->getOperand(i));
-	if (MI->getOperand(i).opIsDefOnly() || 
-            MI->getOperand(i).opIsDefAndUse()) O << "*";
+	if (MI->getOperand(i).isDef()) O << "*";
       }
     }
     O << "\n";


Index: llvm/lib/Target/X86/PeepholeOptimizer.cpp
diff -u llvm/lib/Target/X86/PeepholeOptimizer.cpp:1.8 llvm/lib/Target/X86/PeepholeOptimizer.cpp:1.9
--- llvm/lib/Target/X86/PeepholeOptimizer.cpp:1.8	Sun Nov 30 23:15:28 2003
+++ llvm/lib/Target/X86/PeepholeOptimizer.cpp	Sun Dec 14 07:24:15 2003
@@ -174,7 +174,7 @@
           MachineInstr *MI = *I;
           for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
             MachineOperand &MO = MI->getOperand(i);
-            if (MO.isVirtualRegister() && MO.opIsDefOnly())
+            if (MO.isVirtualRegister() && MO.isDef() && !MO.isUse())
               setDefinition(MO.getReg(), MI);
           }
         }
@@ -233,7 +233,7 @@
     /// register, return the machine instruction defining it, otherwise, return
     /// null.
     MachineInstr *getDefiningInst(MachineOperand &MO) {
-      if (!MO.opIsUse() || !MO.isVirtualRegister()) return 0;
+      if (MO.isDef() || !MO.isVirtualRegister()) return 0;
       return UDC->getDefinition(MO.getReg());
     }
 





More information about the llvm-commits mailing list