mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-22 18:35:45 +00:00
Fix eabi calling convention when a 64 bit value shadows r3.
Without this what was happening was: * R3 is not marked as "used" * ARM backend thinks it has to save it to the stack because of vaarg * Offset computation correctly ignores it * Offsets are wrong git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110446 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e52e9d6045
commit
55e9587469
@ -275,6 +275,12 @@ public:
|
||||
return Result;
|
||||
}
|
||||
|
||||
/// Version of AllocateStack with extra register to be shadowed.
|
||||
unsigned AllocateStack(unsigned Size, unsigned Align, unsigned ShadowReg) {
|
||||
MarkAllocated(ShadowReg);
|
||||
return AllocateStack(Size, Align);
|
||||
}
|
||||
|
||||
// HandleByVal - Allocate a stack slot large enough to pass an argument by
|
||||
// value. The size and alignment information of the argument is encoded in its
|
||||
// parameter attribute.
|
||||
|
@ -89,6 +89,13 @@ class CCAssignToStack<int size, int align> : CCAction {
|
||||
int Align = align;
|
||||
}
|
||||
|
||||
/// CCAssignToStackWithShadow - Same as CCAssignToStack, but with a register
|
||||
/// to be shadowed.
|
||||
class CCAssignToStackWithShadow<int size, int align, Register reg> :
|
||||
CCAssignToStack<size, align> {
|
||||
Register ShadowReg = reg;
|
||||
}
|
||||
|
||||
/// CCPassByVal - This action always matches: it assigns the value to a stack
|
||||
/// slot to implement ByVal aggregate parameter passing. Size and alignment
|
||||
/// specify the minimum size and alignment for the stack slot.
|
||||
|
@ -68,7 +68,7 @@ def CC_ARM_AAPCS_Common : CallingConv<[
|
||||
"ArgFlags.getOrigAlign() != 8",
|
||||
CCAssignToReg<[R0, R1, R2, R3]>>>,
|
||||
|
||||
CCIfType<[i32], CCIfAlign<"8", CCAssignToStack<4, 8>>>,
|
||||
CCIfType<[i32], CCIfAlign<"8", CCAssignToStackWithShadow<4, 8, R3>>>,
|
||||
CCIfType<[i32, f32], CCAssignToStack<4, 4>>,
|
||||
CCIfType<[f64], CCAssignToStack<8, 8>>,
|
||||
CCIfType<[v2f64], CCAssignToStack<16, 8>>
|
||||
|
@ -24,6 +24,20 @@ entry:
|
||||
ret i32 %.0
|
||||
}
|
||||
|
||||
; test that on gnueabi a 64 bit value at this position will cause r3 to go
|
||||
; unused and the value stored in [sp]
|
||||
; ELF: f3:
|
||||
; ELF: ldr r0, [sp]
|
||||
; ELF-NEXT: mov pc, lr
|
||||
; DARWIN: f3:
|
||||
; DARWIN: mov r0, r3
|
||||
; DARWIN-NEXT: mov pc, lr
|
||||
define i32 @f3(i32 %i, i32 %j, i32 %k, i64 %l, ...) {
|
||||
entry:
|
||||
%0 = trunc i64 %l to i32
|
||||
ret i32 %0
|
||||
}
|
||||
|
||||
declare i32 @g1(i64)
|
||||
|
||||
declare i32 @g2(i32 %i, ...)
|
||||
|
@ -169,6 +169,8 @@ void CallingConvEmitter::EmitAction(Record *Action,
|
||||
else
|
||||
O << "\n" << IndentStr << " State.getTarget().getTargetData()"
|
||||
"->getABITypeAlignment(LocVT.getTypeForEVT(State.getContext()))";
|
||||
if (Action->isSubClassOf("CCAssignToStackWithShadow"))
|
||||
O << ", " << getQualifiedName(Action->getValueAsDef("ShadowReg"));
|
||||
O << ");\n" << IndentStr
|
||||
<< "State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset"
|
||||
<< Counter << ", LocVT, LocInfo));\n";
|
||||
|
Loading…
x
Reference in New Issue
Block a user