[llvm-commits] CVS: llvm/lib/Analysis/LiveVar/BBLiveVar.cpp FunctionLiveVarInfo.cpp

Vikram Adve vadve at cs.uiuc.edu
Mon May 26 19:07:01 PDT 2003


Changes in directory llvm/lib/Analysis/LiveVar:

BBLiveVar.cpp updated: 1.34 -> 1.35
FunctionLiveVarInfo.cpp updated: 1.42 -> 1.43

---
Log message:

Renamed MachienOperand::opIsDef to MachineOperand::opIsDefOnly()
and related functions and flags.  Fixed several bugs where only
"isDef" was being checked, not "isDefAndUse".


---
Diffs of the changes:

Index: llvm/lib/Analysis/LiveVar/BBLiveVar.cpp
diff -u llvm/lib/Analysis/LiveVar/BBLiveVar.cpp:1.34 llvm/lib/Analysis/LiveVar/BBLiveVar.cpp:1.35
--- llvm/lib/Analysis/LiveVar/BBLiveVar.cpp:1.34	Tue May 20 15:36:39 2003
+++ llvm/lib/Analysis/LiveVar/BBLiveVar.cpp	Mon May 26 19:06:00 2003
@@ -64,12 +64,12 @@
     // iterate over  MI operands to find defs
     for (MachineInstr::const_val_op_iterator OpI = MI->begin(), OpE = MI->end();
          OpI != OpE; ++OpI)
-      if (OpI.isDef())      // add to Defs only if this operand is a def
+      if (OpI.isDefOnly() || OpI.isDefAndUse()) // add to Defs if this operand is a def
 	addDef(*OpI);
 
     // do for implicit operands as well
     for (unsigned i = 0; i < MI->getNumImplicitRefs(); ++i)
-      if (MI->implicitRefIsDefined(i))
+      if (MI->getImplicitOp(i).opIsDefOnly() || MI->getImplicitOp(i).opIsDefAndUse())
 	addDef(MI->getImplicitRef(i));
     
     // iterate over MI operands to find uses
@@ -80,7 +80,7 @@
       if (isa<BasicBlock>(Op))
 	continue;             // don't process labels
 
-      if (!OpI.isDef() || OpI.isDefAndUse()) {
+      if (OpI.isUseOnly() || OpI.isDefAndUse()) {
                                 // add to Uses only if this operand is a use
         //
         // *** WARNING: The following code for handling dummy PHI machine
@@ -116,7 +116,7 @@
       if (Op->getType() == Type::LabelTy)             // don't process labels
 	continue;
 
-      if (!MI->implicitRefIsDefined(i) || MI->implicitRefIsDefinedAndUsed(i) )
+      if (MI->getImplicitOp(i).opIsUse() || MI->getImplicitOp(i).opIsDefAndUse())
 	addUse(Op);
     }
   } // for all machine instructions


Index: llvm/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp
diff -u llvm/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp:1.42 llvm/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp:1.43
--- llvm/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp:1.42	Tue Jan 14 17:05:00 2003
+++ llvm/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp	Mon May 26 19:06:00 2003
@@ -213,13 +213,14 @@
 static void applyTranferFuncForMInst(ValueSet &LVS, const MachineInstr *MInst) {
   for (MachineInstr::const_val_op_iterator OpI = MInst->begin(),
          OpE = MInst->end(); OpI != OpE; ++OpI) {
-    if (OpI.isDef())           // kill only if this operand is a def
-      LVS.erase(*OpI);         // this definition kills any uses
+    if (OpI.isDefOnly() || OpI.isDefAndUse()) // kill if this operand is a def
+      LVS.erase(*OpI);                        // this definition kills any uses
   }
 
   // do for implicit operands as well
   for (unsigned i=0; i < MInst->getNumImplicitRefs(); ++i) {
-    if (MInst->implicitRefIsDefined(i))
+    if (MInst->getImplicitOp(i).opIsDefOnly() ||
+        MInst->getImplicitOp(i).opIsDefAndUse())
       LVS.erase(MInst->getImplicitRef(i));
   }
 
@@ -227,14 +228,14 @@
          OpE = MInst->end(); OpI != OpE; ++OpI) {
     if (!isa<BasicBlock>(*OpI))      // don't process labels
       // add only if this operand is a use
-      if (!OpI.isDef() || OpI.isDefAndUse() )
+      if (!OpI.isDefOnly() || OpI.isDefAndUse() )
         LVS.insert(*OpI);            // An operand is a use - so add to use set
   }
 
   // do for implicit operands as well
   for (unsigned i = 0, e = MInst->getNumImplicitRefs(); i != e; ++i)
-    if (!MInst->implicitRefIsDefined(i) ||
-        MInst->implicitRefIsDefinedAndUsed(i))
+    if (MInst->getImplicitOp(i).opIsUse() ||
+        MInst->getImplicitOp(i).opIsDefAndUse())
       LVS.insert(MInst->getImplicitRef(i));
 }
 





More information about the llvm-commits mailing list