summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2011-02-08 21:13:03 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2011-02-08 21:13:03 +0000
commitf2b16dc84726755b3fb36d0ec2071b50863d2b8f (patch)
tree9583dc41314ddad50b3bf98330a0e2f172b8615c /llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
parent181376f29f9cb2301d565adc9a54a91e6107c4a0 (diff)
downloadbcm5719-llvm-f2b16dc84726755b3fb36d0ec2071b50863d2b8f.tar.gz
bcm5719-llvm-f2b16dc84726755b3fb36d0ec2071b50863d2b8f.zip
Add LiveIntervals::addKillFlags() to recompute kill flags after register allocation.
This is a lot easier than trying to get kill flags right during live range splitting and rematerialization. llvm-svn: 125113
Diffstat (limited to 'llvm/lib/CodeGen/LiveIntervalAnalysis.cpp')
-rw-r--r--llvm/lib/CodeGen/LiveIntervalAnalysis.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
index 4ff888a7fd0..3739d28bfdc 100644
--- a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
+++ b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
@@ -890,6 +890,29 @@ LiveIntervals::getLastSplitPoint(const LiveInterval &li,
return mbb->getFirstTerminator();
}
+void LiveIntervals::addKillFlags() {
+ for (iterator I = begin(), E = end(); I != E; ++I) {
+ unsigned Reg = I->first;
+ if (TargetRegisterInfo::isPhysicalRegister(Reg))
+ continue;
+ if (mri_->reg_nodbg_empty(Reg))
+ continue;
+ LiveInterval *LI = I->second;
+
+ // Every instruction that kills Reg corresponds to a live range end point.
+ for (LiveInterval::iterator RI = LI->begin(), RE = LI->end(); RI != RE;
+ ++RI) {
+ // A LOAD index indicates an MBB edge.
+ if (RI->end.isLoad())
+ continue;
+ MachineInstr *MI = getInstructionFromIndex(RI->end);
+ if (!MI)
+ continue;
+ MI->addRegisterKilled(Reg, NULL);
+ }
+ }
+}
+
/// getReMatImplicitUse - If the remat definition MI has one (for now, we only
/// allow one) virtual register operand, then its uses are implicitly using
/// the register. Returns the virtual register.
OpenPOWER on IntegriCloud