Skip to content

Commit 82605b2

Browse files
author
Ruchira Sasanka
committed
--added support for implicit operands
llvm-svn: 832
1 parent 2a6cc83 commit 82605b2

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

llvm/lib/Analysis/LiveVar/LiveVarSet.cpp

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,34 @@ void LiveVarSet::applyTranferFuncForMInst(const MachineInstr *const MInst)
1414

1515
for( MachineInstr::val_op_const_iterator OpI(MInst); !OpI.done() ; OpI++) {
1616

17-
if( OpI.isDef() ) { // kill only if this operand is a def
17+
if( OpI.isDef() ) // kill only if this operand is a def
1818
remove(*OpI); // this definition kills any uses
19-
}
19+
}
2020

21+
// do for implicit operands as well
22+
for( unsigned i=0; i < MInst->getNumImplicitRefs(); ++i) {
23+
if( MInst->implicitRefIsDefined(i) )
24+
remove( MInst->getImplicitRef(i) );
2125
}
2226

27+
2328
for( MachineInstr::val_op_const_iterator OpI(MInst); !OpI.done() ; OpI++) {
2429

2530
if ( ((*OpI)->getType())->isLabelType()) continue; // don't process labels
26-
27-
if( ! OpI.isDef() ) { // add only if this operand is a use
31+
32+
if( ! OpI.isDef() ) // add only if this operand is a use
2833
add( *OpI ); // An operand is a use - so add to use set
29-
}
3034
}
31-
}
32-
33-
34-
3535

36+
// do for implicit operands as well
37+
for( unsigned i=0; i < MInst->getNumImplicitRefs(); ++i) {
38+
if( ! MInst->implicitRefIsDefined(i) )
39+
add( MInst->getImplicitRef(i) );
40+
}
3641

42+
}
3743

44+
3845

3946
#if 0
4047
void LiveVarSet::applyTranferFuncForInst(const Instruction *const Inst)

0 commit comments

Comments
 (0)