[llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervals.cpp
Alkis Evlogimenos
alkis at cs.uiuc.edu
Sat Jan 31 17:14:01 PST 2004
Changes in directory llvm/lib/CodeGen:
LiveIntervals.cpp updated: 1.36 -> 1.37
---
Log message:
Be a little smarter on the way we handle physical register defs.
---
Diffs of the changes: (+13 -26)
Index: llvm/lib/CodeGen/LiveIntervals.cpp
diff -u llvm/lib/CodeGen/LiveIntervals.cpp:1.36 llvm/lib/CodeGen/LiveIntervals.cpp:1.37
--- llvm/lib/CodeGen/LiveIntervals.cpp:1.36 Sat Jan 31 13:59:32 2004
+++ llvm/lib/CodeGen/LiveIntervals.cpp Sat Jan 31 17:13:30 2004
@@ -210,49 +210,36 @@
MachineBasicBlock::iterator mi,
unsigned reg)
{
+ typedef LiveVariables::killed_iterator KillIter;
+
DEBUG(std::cerr << "\t\tregister: "; printRegName(reg));
+ MachineBasicBlock::iterator e = mbb->end();
unsigned start = getInstructionIndex(*mi);
- unsigned end = start;
-
- // register can be dead by the instruction defining it but it can
- // only be killed by subsequent instructions
+ unsigned end = start + 1;
- for (LiveVariables::killed_iterator
- ki = lv_->dead_begin(*mi),
- ke = lv_->dead_end(*mi);
+ // a variable can be dead by the instruction defining it
+ for (KillIter ki = lv_->dead_begin(*mi), ke = lv_->dead_end(*mi);
ki != ke; ++ki) {
if (reg == ki->second) {
- end = getInstructionIndex(ki->first) + 1;
DEBUG(std::cerr << " dead\n");
goto exit;
}
}
- ++mi;
-
- for (MachineBasicBlock::iterator e = mbb->end(); mi != e; ++mi) {
- for (LiveVariables::killed_iterator
- ki = lv_->dead_begin(*mi),
- ke = lv_->dead_end(*mi);
- ki != ke; ++ki) {
- if (reg == ki->second) {
- end = getInstructionIndex(ki->first) + 1;
- DEBUG(std::cerr << " dead\n");
- goto exit;
- }
- }
- for (LiveVariables::killed_iterator
- ki = lv_->killed_begin(*mi),
- ke = lv_->killed_end(*mi);
+ // a variable can only be killed by subsequent instructions
+ do {
+ ++mi;
+ ++end;
+ for (KillIter ki = lv_->killed_begin(*mi), ke = lv_->killed_end(*mi);
ki != ke; ++ki) {
if (reg == ki->second) {
- end = getInstructionIndex(ki->first) + 1;
DEBUG(std::cerr << " killed\n");
goto exit;
}
}
- }
+ } while (mi != e);
+
exit:
assert(start < end && "did not find end of interval?");
More information about the llvm-commits
mailing list