mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-28 19:31:58 +00:00
This pass should not require phi elimination or live variable
analysis. It should only preserve them and update LiveVariables if it already ran. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11479 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5aaf1d2820
commit
f11800b718
@ -65,9 +65,7 @@ const PassInfo *llvm::TwoAddressInstructionPassID = X.getPassInfo();
|
|||||||
void TwoAddressInstructionPass::getAnalysisUsage(AnalysisUsage &AU) const
|
void TwoAddressInstructionPass::getAnalysisUsage(AnalysisUsage &AU) const
|
||||||
{
|
{
|
||||||
AU.addPreserved<LiveVariables>();
|
AU.addPreserved<LiveVariables>();
|
||||||
AU.addRequired<LiveVariables>();
|
|
||||||
AU.addPreservedID(PHIEliminationID);
|
AU.addPreservedID(PHIEliminationID);
|
||||||
AU.addRequiredID(PHIEliminationID);
|
|
||||||
MachineFunctionPass::getAnalysisUsage(AU);
|
MachineFunctionPass::getAnalysisUsage(AU);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,7 +77,7 @@ bool TwoAddressInstructionPass::runOnMachineFunction(MachineFunction &MF) {
|
|||||||
const TargetMachine &TM = MF.getTarget();
|
const TargetMachine &TM = MF.getTarget();
|
||||||
const MRegisterInfo &MRI = *TM.getRegisterInfo();
|
const MRegisterInfo &MRI = *TM.getRegisterInfo();
|
||||||
const TargetInstrInfo &TII = TM.getInstrInfo();
|
const TargetInstrInfo &TII = TM.getInstrInfo();
|
||||||
LiveVariables &LV = getAnalysis<LiveVariables>();
|
LiveVariables* LV = getAnalysisToUpdate<LiveVariables>();
|
||||||
|
|
||||||
bool MadeChange = false;
|
bool MadeChange = false;
|
||||||
|
|
||||||
@ -139,18 +137,20 @@ bool TwoAddressInstructionPass::runOnMachineFunction(MachineFunction &MF) {
|
|||||||
DEBUG(std::cerr << "\t\tadded instruction: ";
|
DEBUG(std::cerr << "\t\tadded instruction: ";
|
||||||
prevMi->print(std::cerr, TM));
|
prevMi->print(std::cerr, TM));
|
||||||
|
|
||||||
// update live variables for regA
|
if (LV) {
|
||||||
assert(Added == 1 &&
|
// update live variables for regA
|
||||||
"Cannot handle multi-instruction copies yet!");
|
assert(Added == 1 &&
|
||||||
LiveVariables::VarInfo& varInfo = LV.getVarInfo(regA);
|
"Cannot handle multi-instruction copies yet!");
|
||||||
varInfo.DefInst = prevMi;
|
LiveVariables::VarInfo& varInfo = LV->getVarInfo(regA);
|
||||||
|
varInfo.DefInst = prevMi;
|
||||||
|
|
||||||
// update live variables for regB
|
// update live variables for regB
|
||||||
if (LV.removeVirtualRegisterKilled(regB, &*mbbi, mi))
|
if (LV->removeVirtualRegisterKilled(regB, &*mbbi, mi))
|
||||||
LV.addVirtualRegisterKilled(regB, &*mbbi, prevMi);
|
LV->addVirtualRegisterKilled(regB, &*mbbi, prevMi);
|
||||||
|
|
||||||
if (LV.removeVirtualRegisterDead(regB, &*mbbi, mi))
|
if (LV->removeVirtualRegisterDead(regB, &*mbbi, mi))
|
||||||
LV.addVirtualRegisterDead(regB, &*mbbi, prevMi);
|
LV->addVirtualRegisterDead(regB, &*mbbi, prevMi);
|
||||||
|
}
|
||||||
|
|
||||||
// replace all occurences of regB with regA
|
// replace all occurences of regB with regA
|
||||||
for (unsigned i = 1, e = mi->getNumOperands(); i != e; ++i) {
|
for (unsigned i = 1, e = mi->getNumOperands(); i != e; ++i) {
|
||||||
|
Loading…
Reference in New Issue
Block a user