mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-25 10:27:04 +00:00
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:
@@ -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
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user