[llvm-commits] CVS: llvm/lib/CodeGen/LiveVariables.cpp
Evan Cheng
evan.cheng at apple.com
Tue May 8 12:00:23 PDT 2007
Changes in directory llvm/lib/CodeGen:
LiveVariables.cpp updated: 1.82 -> 1.83
---
Log message:
Eliminate MarkVirtRegAliveInBlock recursion.
---
Diffs of the changes: (+17 -4)
LiveVariables.cpp | 21 +++++++++++++++++----
1 files changed, 17 insertions(+), 4 deletions(-)
Index: llvm/lib/CodeGen/LiveVariables.cpp
diff -u llvm/lib/CodeGen/LiveVariables.cpp:1.82 llvm/lib/CodeGen/LiveVariables.cpp:1.83
--- llvm/lib/CodeGen/LiveVariables.cpp:1.82 Wed May 2 20:11:53 2007
+++ llvm/lib/CodeGen/LiveVariables.cpp Tue May 8 14:00:00 2007
@@ -112,7 +112,8 @@
}
void LiveVariables::MarkVirtRegAliveInBlock(VarInfo &VRInfo,
- MachineBasicBlock *MBB) {
+ MachineBasicBlock *MBB,
+ std::vector<MachineBasicBlock*> &WorkList) {
unsigned BBNum = MBB->getNumber();
// Check to see if this basic block is one of the killing blocks. If so,
@@ -131,11 +132,23 @@
// Mark the variable known alive in this bb
VRInfo.AliveBlocks[BBNum] = true;
- for (MachineBasicBlock::const_pred_iterator PI = MBB->pred_begin(),
- E = MBB->pred_end(); PI != E; ++PI)
- MarkVirtRegAliveInBlock(VRInfo, *PI);
+ for (MachineBasicBlock::const_pred_reverse_iterator PI = MBB->pred_rbegin(),
+ E = MBB->pred_rend(); PI != E; ++PI)
+ WorkList.push_back(*PI);
}
+void LiveVariables::MarkVirtRegAliveInBlock(VarInfo &VRInfo,
+ MachineBasicBlock *MBB) {
+ std::vector<MachineBasicBlock*> WorkList;
+ MarkVirtRegAliveInBlock(VRInfo, MBB, WorkList);
+ while (!WorkList.empty()) {
+ MachineBasicBlock *Pred = WorkList.back();
+ WorkList.pop_back();
+ MarkVirtRegAliveInBlock(VRInfo, Pred, WorkList);
+ }
+}
+
+
void LiveVariables::HandleVirtRegUse(VarInfo &VRInfo, MachineBasicBlock *MBB,
MachineInstr *MI) {
assert(VRInfo.DefInst && "Register use before def!");
More information about the llvm-commits
mailing list