mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 11:42:57 +01:00
Get rid of the isKillInst predicate. LiveVariables already provides this information.
llvm-svn: 45797
This commit is contained in:
parent
b02074514e
commit
a0e5b9a317
@ -298,22 +298,18 @@ static bool isLiveOut(LiveVariables::VarInfo& V, MachineBasicBlock* MBB) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// isKillInst - helper method that determines, from a VarInfo, if an
|
|
||||||
/// instruction kills a given register
|
|
||||||
static bool isKillInst(LiveVariables::VarInfo& V, MachineInstr* MI) {
|
|
||||||
return std::find(V.Kills.begin(), V.Kills.end(), MI) != V.Kills.end();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// interferes - checks for local interferences by scanning a block. The only
|
/// interferes - checks for local interferences by scanning a block. The only
|
||||||
/// trick parameter is 'mode' which tells it the relationship of the two
|
/// trick parameter is 'mode' which tells it the relationship of the two
|
||||||
/// registers. 0 - defined in the same block, 1 - first properly dominates
|
/// registers. 0 - defined in the same block, 1 - first properly dominates
|
||||||
/// second, 2 - second properly dominates first
|
/// second, 2 - second properly dominates first
|
||||||
static bool interferes(LiveVariables::VarInfo& First,
|
static bool interferes(unsigned a, unsigned b, MachineBasicBlock* scan,
|
||||||
LiveVariables::VarInfo& Second,
|
LiveVariables& LV, unsigned mode) {
|
||||||
MachineBasicBlock* scan, unsigned mode) {
|
|
||||||
MachineInstr* def = 0;
|
MachineInstr* def = 0;
|
||||||
MachineInstr* kill = 0;
|
MachineInstr* kill = 0;
|
||||||
|
|
||||||
|
LiveVariables::VarInfo& First = LV.getVarInfo(a);
|
||||||
|
LiveVariables::VarInfo& Second = LV.getVarInfo(b);
|
||||||
|
|
||||||
bool interference = false;
|
bool interference = false;
|
||||||
|
|
||||||
// Wallk the block, checking for interferences
|
// Wallk the block, checking for interferences
|
||||||
@ -350,10 +346,10 @@ static bool interferes(LiveVariables::VarInfo& First,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Store KillInsts if they match up with the DefInst
|
// Store KillInsts if they match up with the DefInst
|
||||||
} else if (isKillInst(First, curr)) {
|
} else if (LV.KillsRegister(curr, a)) {
|
||||||
if (def == First.DefInst) {
|
if (def == First.DefInst) {
|
||||||
kill = curr;
|
kill = curr;
|
||||||
} else if (isKillInst(Second, curr)) {
|
} else if (LV.KillsRegister(curr, b)) {
|
||||||
if (def == Second.DefInst) {
|
if (def == Second.DefInst) {
|
||||||
kill = curr;
|
kill = curr;
|
||||||
}
|
}
|
||||||
@ -372,7 +368,7 @@ static bool interferes(LiveVariables::VarInfo& First,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Save KillInsts of First
|
// Save KillInsts of First
|
||||||
} else if (isKillInst(First, curr)) {
|
} else if (LV.KillsRegister(curr, a)) {
|
||||||
kill = curr;
|
kill = curr;
|
||||||
}
|
}
|
||||||
// Symmetric with the above
|
// Symmetric with the above
|
||||||
@ -385,7 +381,7 @@ static bool interferes(LiveVariables::VarInfo& First,
|
|||||||
interference = false;
|
interference = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (isKillInst(Second, curr)) {
|
} else if (LV.KillsRegister(curr, b)) {
|
||||||
kill = curr;
|
kill = curr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -468,7 +464,7 @@ void StrongPHIElimination::processBlock(MachineBasicBlock* MBB) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If there's an interference, we need to insert copies
|
// If there's an interference, we need to insert copies
|
||||||
if (interferes(FirstInfo, SecondInfo, scan, mode)) {
|
if (interferes(p.first, p.second, scan, LV, mode)) {
|
||||||
// Insert copies for First
|
// Insert copies for First
|
||||||
for (int i = P->getNumOperands() - 1; i >= 2; i-=2) {
|
for (int i = P->getNumOperands() - 1; i >= 2; i-=2) {
|
||||||
if (P->getOperand(i-1).getReg() == p.first) {
|
if (P->getOperand(i-1).getReg() == p.first) {
|
||||||
|
Loading…
Reference in New Issue
Block a user