mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
Fix issue in regscavenger when scavenging a callee-saved register that has not been spilled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77912 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7b4e503cdc
commit
b36eb9df20
@ -471,9 +471,16 @@ unsigned RegScavenger::scavengeRegister(const TargetRegisterClass *RC,
|
|||||||
Reg = Candidates.find_next(Reg);
|
Reg = Candidates.find_next(Reg);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(ScavengedReg == 0 &&
|
assert(ScavengedReg == 0 &&
|
||||||
"Scavenger slot is live, unable to scavenge another register!");
|
"Scavenger slot is live, unable to scavenge another register!");
|
||||||
|
|
||||||
|
// Make sure SReg is marked as used. It could be considered available if it is
|
||||||
|
// one of the callee saved registers, but hasn't been spilled.
|
||||||
|
if (!isUsed(SReg)) {
|
||||||
|
MBB->addLiveIn(SReg);
|
||||||
|
setUsed(SReg);
|
||||||
|
}
|
||||||
|
|
||||||
// Spill the scavenged register before I.
|
// Spill the scavenged register before I.
|
||||||
TII->storeRegToStackSlot(*MBB, I, SReg, true, ScavengingFrameIndex, RC);
|
TII->storeRegToStackSlot(*MBB, I, SReg, true, ScavengingFrameIndex, RC);
|
||||||
MachineBasicBlock::iterator II = prior(I);
|
MachineBasicBlock::iterator II = prior(I);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
; RUN: llvm-as < %s | llc -march=bfin -verify-machineinstrs
|
; RUN: llvm-as < %s | llc -march=bfin -verify-machineinstrs
|
||||||
; XFAIL: *
|
|
||||||
; Assertion failed: (isUsed(Reg) && "Using an undefined register!"),
|
; These functions have just the right size to annoy the register scavenger: They
|
||||||
; function forward, file RegisterScavenging.cpp, line 182.
|
; use all the scratch registers, but not all the callee-saved registers.
|
||||||
|
|
||||||
define void @test_add(i64 %AL, i64 %AH, i64 %BL, i64 %BH, i64* %RL, i64* %RH) {
|
define void @test_add(i64 %AL, i64 %AH, i64 %BL, i64 %BH, i64* %RL, i64* %RH) {
|
||||||
entry:
|
entry:
|
||||||
|
Loading…
Reference in New Issue
Block a user