mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-01 00:17:01 +00:00
Fix the recently added anyregcc convention to handle spilled operands.
Fixes <rdar://15432754> [JS] Assertion: "Folded a def to a non-store!" The primary purpose of anyregcc is to prevent a patchpoint's call arguments and return value from being spilled. They must be available in a register, although the calling convention does not pin the register. It's up to the front end to avoid using this convention for calls with more arguments than allocatable registers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194428 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -4207,10 +4207,19 @@ static MachineInstr* foldPatchpoint(MachineFunction &MF,
|
||||
MachineInstrBuilder MIB(MF, NewMI);
|
||||
|
||||
bool isPatchPoint = MI->getOpcode() == TargetOpcode::PATCHPOINT;
|
||||
// For PatchPoint, the call args are not foldable.
|
||||
unsigned NumCallArgs = MI->getOperand(StartIdx+3).getImm();
|
||||
StartIdx = isPatchPoint ?
|
||||
StartIdx + MI->getOperand(StartIdx+3).getImm() + 5 :
|
||||
StartIdx + NumCallArgs + 5 :
|
||||
StartIdx + 2;
|
||||
|
||||
// Return false if any operands requested for folding are not foldable (not
|
||||
// part of the stackmap's live values).
|
||||
for (SmallVectorImpl<unsigned>::const_iterator I = Ops.begin(), E = Ops.end();
|
||||
I != E; ++I) {
|
||||
if (*I < StartIdx)
|
||||
return 0;
|
||||
}
|
||||
// No need to fold return, the meta data, and function arguments
|
||||
for (unsigned i = 0; i < StartIdx; ++i)
|
||||
MIB.addOperand(MI->getOperand(i));
|
||||
|
||||
Reference in New Issue
Block a user