--added support for implicit operands
authorRuchira Sasanka <sasanka@students.uiuc.edu>
Mon, 15 Oct 2001 16:58:50 +0000 (16:58 +0000)
committerRuchira Sasanka <sasanka@students.uiuc.edu>
Mon, 15 Oct 2001 16:58:50 +0000 (16:58 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@832 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/LiveVar/LiveVarSet.cpp
lib/Target/SparcV9/LiveVar/LiveVarSet.cpp

index 07dc1286014026940332791ba088e6c8c32cb6cf..1ca65f0a4bac3c1e1e94bc94d70698b228ea0dff 100644 (file)
@@ -14,27 +14,34 @@ void LiveVarSet::applyTranferFuncForMInst(const MachineInstr *const MInst)
 
   for( MachineInstr::val_op_const_iterator OpI(MInst); !OpI.done() ; OpI++) {
 
-    if( OpI.isDef() ) {     // kill only if this operand is a def
+    if( OpI.isDef() )      // kill only if this operand is a def
          remove(*OpI);        // this definition kills any uses
-    }
+  }
 
+  // do for implicit operands as well
+  for( unsigned i=0; i < MInst->getNumImplicitRefs(); ++i) {
+    if( MInst->implicitRefIsDefined(i) )
+      remove( MInst->getImplicitRef(i) );
   }
 
+
   for( MachineInstr::val_op_const_iterator OpI(MInst); !OpI.done() ; OpI++) {
 
     if ( ((*OpI)->getType())->isLabelType()) continue; // don't process labels
-
-    if( ! OpI.isDef() ) {     // add only if this operand is a use
+    
+    if( ! OpI.isDef() )      // add only if this operand is a use
        add( *OpI );            // An operand is a use - so add to use set
-    }
   }
-}
-
-  
-
 
+  // do for implicit operands as well
+  for( unsigned i=0; i < MInst->getNumImplicitRefs(); ++i) {
+    if(  ! MInst->implicitRefIsDefined(i) )
+      add( MInst->getImplicitRef(i) );
+  }
 
+}
 
+  
 
 #if 0
 void LiveVarSet::applyTranferFuncForInst(const Instruction *const Inst) 
index 07dc1286014026940332791ba088e6c8c32cb6cf..1ca65f0a4bac3c1e1e94bc94d70698b228ea0dff 100644 (file)
@@ -14,27 +14,34 @@ void LiveVarSet::applyTranferFuncForMInst(const MachineInstr *const MInst)
 
   for( MachineInstr::val_op_const_iterator OpI(MInst); !OpI.done() ; OpI++) {
 
-    if( OpI.isDef() ) {     // kill only if this operand is a def
+    if( OpI.isDef() )      // kill only if this operand is a def
          remove(*OpI);        // this definition kills any uses
-    }
+  }
 
+  // do for implicit operands as well
+  for( unsigned i=0; i < MInst->getNumImplicitRefs(); ++i) {
+    if( MInst->implicitRefIsDefined(i) )
+      remove( MInst->getImplicitRef(i) );
   }
 
+
   for( MachineInstr::val_op_const_iterator OpI(MInst); !OpI.done() ; OpI++) {
 
     if ( ((*OpI)->getType())->isLabelType()) continue; // don't process labels
-
-    if( ! OpI.isDef() ) {     // add only if this operand is a use
+    
+    if( ! OpI.isDef() )      // add only if this operand is a use
        add( *OpI );            // An operand is a use - so add to use set
-    }
   }
-}
-
-  
-
 
+  // do for implicit operands as well
+  for( unsigned i=0; i < MInst->getNumImplicitRefs(); ++i) {
+    if(  ! MInst->implicitRefIsDefined(i) )
+      add( MInst->getImplicitRef(i) );
+  }
 
+}
 
+  
 
 #if 0
 void LiveVarSet::applyTranferFuncForInst(const Instruction *const Inst)