[llvm-commits] CVS: llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
Alkis Evlogimenos
alkis at cs.uiuc.edu
Sun Feb 15 15:51:01 PST 2004
Changes in directory llvm/lib/CodeGen:
TwoAddressInstructionPass.cpp updated: 1.16 -> 1.17
---
Log message:
This pass should not require phi elimination or live variable
analysis. It should only preserve them and update LiveVariables if it
already ran.
---
Diffs of the changes: (+15 -15)
Index: llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
diff -u llvm/lib/CodeGen/TwoAddressInstructionPass.cpp:1.16 llvm/lib/CodeGen/TwoAddressInstructionPass.cpp:1.17
--- llvm/lib/CodeGen/TwoAddressInstructionPass.cpp:1.16 Fri Feb 13 19:18:34 2004
+++ llvm/lib/CodeGen/TwoAddressInstructionPass.cpp Sun Feb 15 15:50:32 2004
@@ -65,9 +65,7 @@
void TwoAddressInstructionPass::getAnalysisUsage(AnalysisUsage &AU) const
{
AU.addPreserved<LiveVariables>();
- AU.addRequired<LiveVariables>();
AU.addPreservedID(PHIEliminationID);
- AU.addRequiredID(PHIEliminationID);
MachineFunctionPass::getAnalysisUsage(AU);
}
@@ -79,7 +77,7 @@
const TargetMachine &TM = MF.getTarget();
const MRegisterInfo &MRI = *TM.getRegisterInfo();
const TargetInstrInfo &TII = TM.getInstrInfo();
- LiveVariables &LV = getAnalysis<LiveVariables>();
+ LiveVariables* LV = getAnalysisToUpdate<LiveVariables>();
bool MadeChange = false;
@@ -139,18 +137,20 @@
DEBUG(std::cerr << "\t\tadded instruction: ";
prevMi->print(std::cerr, TM));
- // update live variables for regA
- assert(Added == 1 &&
- "Cannot handle multi-instruction copies yet!");
- LiveVariables::VarInfo& varInfo = LV.getVarInfo(regA);
- varInfo.DefInst = prevMi;
-
- // update live variables for regB
- if (LV.removeVirtualRegisterKilled(regB, &*mbbi, mi))
- LV.addVirtualRegisterKilled(regB, &*mbbi, prevMi);
-
- if (LV.removeVirtualRegisterDead(regB, &*mbbi, mi))
- LV.addVirtualRegisterDead(regB, &*mbbi, prevMi);
+ if (LV) {
+ // update live variables for regA
+ assert(Added == 1 &&
+ "Cannot handle multi-instruction copies yet!");
+ LiveVariables::VarInfo& varInfo = LV->getVarInfo(regA);
+ varInfo.DefInst = prevMi;
+
+ // update live variables for regB
+ if (LV->removeVirtualRegisterKilled(regB, &*mbbi, mi))
+ LV->addVirtualRegisterKilled(regB, &*mbbi, prevMi);
+
+ if (LV->removeVirtualRegisterDead(regB, &*mbbi, mi))
+ LV->addVirtualRegisterDead(regB, &*mbbi, prevMi);
+ }
// replace all occurences of regB with regA
for (unsigned i = 1, e = mi->getNumOperands(); i != e; ++i) {
More information about the llvm-commits
mailing list