mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-17 21:29:20 +00:00
Always reserve space for 8 spilled GPRs. GCC apparently assumes that this
space will be available, even if the callee isn't varargs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28571 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ac28588def
commit
7b05350906
@ -916,18 +916,13 @@ static SDOperand LowerCALL(SDOperand Op, SelectionDAG &DAG) {
|
|||||||
for (unsigned i = 0; i != NumOps; ++i)
|
for (unsigned i = 0; i != NumOps; ++i)
|
||||||
NumBytes += MVT::getSizeInBits(Op.getOperand(5+2*i).getValueType())/8;
|
NumBytes += MVT::getSizeInBits(Op.getOperand(5+2*i).getValueType())/8;
|
||||||
|
|
||||||
// If we are calling what looks like a varargs function on the caller side,
|
// The prolog code of the callee may store up to 8 GPR argument registers to
|
||||||
// there are two cases:
|
// the stack, allowing va_start to index over them in memory if its varargs.
|
||||||
// 1) The callee uses va_start.
|
// Because we cannot tell if this is needed on the caller side, we have to
|
||||||
// 2) The callee doesn't use va_start.
|
// conservatively assume that it is needed. As such, make sure we have at
|
||||||
//
|
// least enough stack space for the caller to store the 8 GPRs.
|
||||||
// In the case of #1, the prolog code will store up to 8 GPR argument
|
if (NumBytes < 24+8*4)
|
||||||
// registers to the stack, allowing va_start to index over them in memory.
|
NumBytes = 24+8*4;
|
||||||
// Because we cannot tell the difference (on the caller side) between #1/#2,
|
|
||||||
// we have to conservatively assume we have #1. As such, make sure we have
|
|
||||||
// at least enough stack space for the caller to store the 8 GPRs.
|
|
||||||
if (isVarArg && Op.getNumOperands() > 5 && NumBytes < 56)
|
|
||||||
NumBytes = 56;
|
|
||||||
|
|
||||||
// Adjust the stack pointer for the new arguments...
|
// Adjust the stack pointer for the new arguments...
|
||||||
// These operations are automatically eliminated by the prolog/epilog pass
|
// These operations are automatically eliminated by the prolog/epilog pass
|
||||||
|
Loading…
Reference in New Issue
Block a user