summaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2010-10-15 00:34:01 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2010-10-15 00:34:01 +0000
commit9d5d48bc41b182a1b76b1df25069ad4fb6fc45a7 (patch)
tree4239a1b0706966874a9943be0da3c262e360c8aa /lib/CodeGen
parent2a0180fbff4870995482d96986ad780ab9de8af4 (diff)
downloadllvm-9d5d48bc41b182a1b76b1df25069ad4fb6fc45a7.tar.gz
llvm-9d5d48bc41b182a1b76b1df25069ad4fb6fc45a7.tar.bz2
llvm-9d5d48bc41b182a1b76b1df25069ad4fb6fc45a7.tar.xz
Eliminate curli from SplitEditor. Use the LiveRangeEdit reference instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116547 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/SplitKit.cpp28
-rw-r--r--lib/CodeGen/SplitKit.h3
2 files changed, 13 insertions, 18 deletions
diff --git a/lib/CodeGen/SplitKit.cpp b/lib/CodeGen/SplitKit.cpp
index 96ccf3031e..278a91d97d 100644
--- a/lib/CodeGen/SplitKit.cpp
+++ b/lib/CodeGen/SplitKit.cpp
@@ -586,11 +586,9 @@ SplitEditor::SplitEditor(SplitAnalysis &sa, LiveIntervals &lis, VirtRegMap &vrm,
mri_(vrm.getMachineFunction().getRegInfo()),
tii_(*vrm.getMachineFunction().getTarget().getInstrInfo()),
edit_(edit),
- curli_(sa_.getCurLI()),
- dupli_(lis_, *curli_),
- openli_(lis_, *curli_)
+ dupli_(lis_, edit.getParent()),
+ openli_(lis_, edit.getParent())
{
- assert(curli_ && "SplitEditor created from empty SplitAnalysis");
}
bool SplitEditor::intervalsLiveAt(SlotIndex Idx) const {
@@ -615,7 +613,7 @@ void SplitEditor::openIntv() {
void SplitEditor::enterIntvBefore(SlotIndex Idx) {
assert(openli_.getLI() && "openIntv not called before enterIntvBefore");
DEBUG(dbgs() << " enterIntvBefore " << Idx);
- VNInfo *ParentVNI = curli_->getVNInfoAt(Idx.getUseIndex());
+ VNInfo *ParentVNI = edit_.getParent().getVNInfoAt(Idx.getUseIndex());
if (!ParentVNI) {
DEBUG(dbgs() << ": not live\n");
return;
@@ -624,7 +622,7 @@ void SplitEditor::enterIntvBefore(SlotIndex Idx) {
truncatedValues.insert(ParentVNI);
MachineInstr *MI = lis_.getInstructionFromIndex(Idx);
assert(MI && "enterIntvBefore called with invalid index");
- VNInfo *VNI = openli_.defByCopyFrom(curli_->reg, ParentVNI,
+ VNInfo *VNI = openli_.defByCopyFrom(edit_.getReg(), ParentVNI,
*MI->getParent(), MI);
openli_.getLI()->addRange(LiveRange(VNI->def, Idx.getDefIndex(), VNI));
DEBUG(dbgs() << ": " << *openli_.getLI() << '\n');
@@ -635,14 +633,14 @@ void SplitEditor::enterIntvAtEnd(MachineBasicBlock &MBB) {
assert(openli_.getLI() && "openIntv not called before enterIntvAtEnd");
SlotIndex End = lis_.getMBBEndIdx(&MBB);
DEBUG(dbgs() << " enterIntvAtEnd BB#" << MBB.getNumber() << ", " << End);
- VNInfo *ParentVNI = curli_->getVNInfoAt(End.getPrevSlot());
+ VNInfo *ParentVNI = edit_.getParent().getVNInfoAt(End.getPrevSlot());
if (!ParentVNI) {
DEBUG(dbgs() << ": not live\n");
return;
}
DEBUG(dbgs() << ": valno " << ParentVNI->id);
truncatedValues.insert(ParentVNI);
- VNInfo *VNI = openli_.defByCopyFrom(curli_->reg, ParentVNI,
+ VNInfo *VNI = openli_.defByCopyFrom(edit_.getReg(), ParentVNI,
MBB, MBB.getFirstTerminator());
// Make sure openli is live out of MBB.
openli_.getLI()->addRange(LiveRange(VNI->def, End, VNI));
@@ -667,7 +665,7 @@ void SplitEditor::leaveIntvAfter(SlotIndex Idx) {
DEBUG(dbgs() << " leaveIntvAfter " << Idx);
// The interval must be live beyond the instruction at Idx.
- VNInfo *ParentVNI = curli_->getVNInfoAt(Idx.getBoundaryIndex());
+ VNInfo *ParentVNI = edit_.getParent().getVNInfoAt(Idx.getBoundaryIndex());
if (!ParentVNI) {
DEBUG(dbgs() << ": not live\n");
return;
@@ -692,7 +690,7 @@ void SplitEditor::leaveIntvAtTop(MachineBasicBlock &MBB) {
SlotIndex Start = lis_.getMBBStartIdx(&MBB);
DEBUG(dbgs() << " leaveIntvAtTop BB#" << MBB.getNumber() << ", " << Start);
- VNInfo *ParentVNI = curli_->getVNInfoAt(Start);
+ VNInfo *ParentVNI = edit_.getParent().getVNInfoAt(Start);
if (!ParentVNI) {
DEBUG(dbgs() << ": not live\n");
return;
@@ -804,13 +802,13 @@ void SplitEditor::computeRemainder() {
// If values were partially rematted, we should shrink to uses.
// If values were fully rematted, they should be omitted.
// FIXME: If a single value is redefined, just move the def and truncate.
+ LiveInterval &parent = edit_.getParent();
// Values that are fully contained in the split intervals.
SmallPtrSet<const VNInfo*, 8> deadValues;
-
// Map all curli values that should have live defs in dupli.
- for (LiveInterval::const_vni_iterator I = curli_->vni_begin(),
- E = curli_->vni_end(); I != E; ++I) {
+ for (LiveInterval::const_vni_iterator I = parent.vni_begin(),
+ E = parent.vni_end(); I != E; ++I) {
const VNInfo *VNI = *I;
// Original def is contained in the split intervals.
if (intervalsLiveAt(VNI->def)) {
@@ -827,7 +825,7 @@ void SplitEditor::computeRemainder() {
}
// Add all ranges to dupli.
- for (LiveInterval::const_iterator I = curli_->begin(), E = curli_->end();
+ for (LiveInterval::const_iterator I = parent.begin(), E = parent.end();
I != E; ++I) {
const LiveRange &LR = *I;
if (truncatedValues.count(LR.valno)) {
@@ -868,7 +866,7 @@ void SplitEditor::finish() {
}
// Rewrite instructions.
- rewrite(curli_->reg);
+ rewrite(edit_.getReg());
// Calculate spill weight and allocation hints for new intervals.
VirtRegAuxInfo vrai(vrm_.getMachineFunction(), lis_, sa_.loops_);
diff --git a/lib/CodeGen/SplitKit.h b/lib/CodeGen/SplitKit.h
index 005ceda3c2..717b520b34 100644
--- a/lib/CodeGen/SplitKit.h
+++ b/lib/CodeGen/SplitKit.h
@@ -242,9 +242,6 @@ class SplitEditor {
/// edit_ - The current parent register and new intervals created.
LiveRangeEdit &edit_;
- /// curli_ - The immutable interval we are currently splitting.
- const LiveInterval *const curli_;
-
/// dupli_ - Created as a copy of curli_, ranges are carved out as new
/// intervals get added through openIntv / closeIntv. This is used to avoid
/// editing curli_.