Added LLVM project notice to the top of every C++ source file.
[oota-llvm.git] / lib / Target / SparcV9 / LiveVar / BBLiveVar.cpp
index fceb6bb8e4648400474b91fa1fb2d4c4e1c7dccc..c3716c99064365bfb984c74566a3cd6db927a2f1 100644 (file)
@@ -1,4 +1,11 @@
 //===-- BBLiveVar.cpp - Live Variable Analysis for a BasicBlock -----------===//
+// 
+//                     The LLVM Compiler Infrastructure
+//
+// This file was developed by the LLVM research group and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
+// 
+//===----------------------------------------------------------------------===//
 //
 // This is a wrapper class for BasicBlock which is used by live var analysis.
 //
@@ -64,12 +71,12 @@ void BBLiveVar::calcDefUseSets() {
     // 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 +87,7 @@ void BBLiveVar::calcDefUseSets() {
       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
@@ -110,13 +117,13 @@ void BBLiveVar::calcDefUseSets() {
 
     // do for implicit operands as well
     for (unsigned i = 0; i < MI->getNumImplicitRefs(); ++i) {
-      assert(MI->getOpCode() != V9::PHI && "Phi cannot have implicit opeands");
+      assert(MI->getOpCode() != V9::PHI && "Phi cannot have implicit operands");
       const Value *Op = MI->getImplicitRef(i);
 
       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