forked from OSchip/llvm-project
Don't assign new registers created during a split to the same stack slot, but
give them individual stack slots once the are actually spilled. llvm-svn: 117945
This commit is contained in:
parent
31fffb62d9
commit
ba9a4985a2
|
@ -369,11 +369,11 @@ void InlineSpiller::spill(LiveRangeEdit &edit) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
rc_ = mri_.getRegClass(edit.getReg());
|
rc_ = mri_.getRegClass(edit.getReg());
|
||||||
stackSlot_ = edit.assignStackSlot(vrm_);
|
stackSlot_ = vrm_.assignVirt2StackSlot(edit_->getReg());
|
||||||
|
|
||||||
// Update LiveStacks now that we are committed to spilling.
|
// Update LiveStacks now that we are committed to spilling.
|
||||||
LiveInterval &stacklvr = lss_.getOrCreateInterval(stackSlot_, rc_);
|
LiveInterval &stacklvr = lss_.getOrCreateInterval(stackSlot_, rc_);
|
||||||
if (!stacklvr.hasAtLeastOneValue())
|
assert(stacklvr.empty() && "Just created stack slot not empty");
|
||||||
stacklvr.getNextValue(SlotIndex(), 0, lss_.getVNInfoAllocator());
|
stacklvr.getNextValue(SlotIndex(), 0, lss_.getVNInfoAllocator());
|
||||||
stacklvr.MergeRangesInAsValue(edit_->getParent(), stacklvr.getValNumInfo(0));
|
stacklvr.MergeRangesInAsValue(edit_->getParent(), stacklvr.getValNumInfo(0));
|
||||||
|
|
||||||
|
|
|
@ -19,21 +19,12 @@
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
int LiveRangeEdit::assignStackSlot(VirtRegMap &vrm) {
|
|
||||||
int ss = vrm.getStackSlot(getReg());
|
|
||||||
if (ss != VirtRegMap::NO_STACK_SLOT)
|
|
||||||
return ss;
|
|
||||||
return vrm.assignVirt2StackSlot(getReg());
|
|
||||||
}
|
|
||||||
|
|
||||||
LiveInterval &LiveRangeEdit::create(MachineRegisterInfo &mri,
|
LiveInterval &LiveRangeEdit::create(MachineRegisterInfo &mri,
|
||||||
LiveIntervals &lis,
|
LiveIntervals &lis,
|
||||||
VirtRegMap &vrm) {
|
VirtRegMap &vrm) {
|
||||||
const TargetRegisterClass *RC = mri.getRegClass(parent_.reg);
|
const TargetRegisterClass *RC = mri.getRegClass(parent_.reg);
|
||||||
unsigned VReg = mri.createVirtualRegister(RC);
|
unsigned VReg = mri.createVirtualRegister(RC);
|
||||||
vrm.grow();
|
vrm.grow();
|
||||||
// Immediately assign to the same stack slot as parent.
|
|
||||||
vrm.assignVirt2StackSlot(VReg, assignStackSlot(vrm));
|
|
||||||
LiveInterval &li = lis.getOrCreateInterval(VReg);
|
LiveInterval &li = lis.getOrCreateInterval(VReg);
|
||||||
newRegs_.push_back(&li);
|
newRegs_.push_back(&li);
|
||||||
return li;
|
return li;
|
||||||
|
|
|
@ -80,10 +80,6 @@ public:
|
||||||
unsigned size() const { return newRegs_.size()-firstNew_; }
|
unsigned size() const { return newRegs_.size()-firstNew_; }
|
||||||
LiveInterval *get(unsigned idx) const { return newRegs_[idx+firstNew_]; }
|
LiveInterval *get(unsigned idx) const { return newRegs_[idx+firstNew_]; }
|
||||||
|
|
||||||
/// assignStackSlot - Ensure a stack slot is assigned to parent.
|
|
||||||
/// @return the assigned stack slot number.
|
|
||||||
int assignStackSlot(VirtRegMap&);
|
|
||||||
|
|
||||||
/// create - Create a new register with the same class and stack slot as
|
/// create - Create a new register with the same class and stack slot as
|
||||||
/// parent.
|
/// parent.
|
||||||
LiveInterval &create(MachineRegisterInfo&, LiveIntervals&, VirtRegMap&);
|
LiveInterval &create(MachineRegisterInfo&, LiveIntervals&, VirtRegMap&);
|
||||||
|
|
Loading…
Reference in New Issue