Renamed MachienOperand::opIsDef to MachineOperand::opIsDefOnly()

and related functions and flags.  Fixed several bugs where only
"isDef" was being checked, not "isDefAndUse".


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6342 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Vikram S. Adve
2003-05-27 00:06:48 +00:00
parent 5f2180c533
commit a22eace55b
5 changed files with 49 additions and 66 deletions

View File

@@ -64,12 +64,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 +80,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
@@ -116,7 +116,7 @@ void BBLiveVar::calcDefUseSets() {
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

View File

@@ -213,13 +213,14 @@ FunctionLiveVarInfo::getLiveVarSetAfterMInst(const MachineInstr *MI,
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 @@ static void applyTranferFuncForMInst(ValueSet &LVS, const MachineInstr *MInst) {
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));
}