mirror of
https://github.com/RPCSX/llvm.git
synced 2025-03-01 01:15:55 +00:00
Fix Win64 va_arg.
--- Merging r127328 into '.': U test/CodeGen/X86/win64_vararg.ll U lib/Target/X86/X86ISelLowering.cpp git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_29@128044 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
fcce259185
commit
17678da4db
@ -1750,8 +1750,8 @@ X86TargetLowering::LowerFormalArguments(SDValue Chain,
|
|||||||
// If the function takes variable number of arguments, make a frame index for
|
// If the function takes variable number of arguments, make a frame index for
|
||||||
// the start of the first vararg value... for expansion of llvm.va_start.
|
// the start of the first vararg value... for expansion of llvm.va_start.
|
||||||
if (isVarArg) {
|
if (isVarArg) {
|
||||||
if (!IsWin64 && (Is64Bit || (CallConv != CallingConv::X86_FastCall &&
|
if (Is64Bit || (CallConv != CallingConv::X86_FastCall &&
|
||||||
CallConv != CallingConv::X86_ThisCall))) {
|
CallConv != CallingConv::X86_ThisCall)) {
|
||||||
FuncInfo->setVarArgsFrameIndex(MFI->CreateFixedObject(1, StackSize,true));
|
FuncInfo->setVarArgsFrameIndex(MFI->CreateFixedObject(1, StackSize,true));
|
||||||
}
|
}
|
||||||
if (Is64Bit) {
|
if (Is64Bit) {
|
||||||
@ -1803,7 +1803,9 @@ X86TargetLowering::LowerFormalArguments(SDValue Chain,
|
|||||||
int HomeOffset = TFI.getOffsetOfLocalArea() + 8;
|
int HomeOffset = TFI.getOffsetOfLocalArea() + 8;
|
||||||
FuncInfo->setRegSaveFrameIndex(
|
FuncInfo->setRegSaveFrameIndex(
|
||||||
MFI->CreateFixedObject(1, NumIntRegs * 8 + HomeOffset, false));
|
MFI->CreateFixedObject(1, NumIntRegs * 8 + HomeOffset, false));
|
||||||
FuncInfo->setVarArgsFrameIndex(FuncInfo->getRegSaveFrameIndex());
|
// Fixup to set vararg frame on shadow area (4 x i64).
|
||||||
|
if (NumIntRegs < 4)
|
||||||
|
FuncInfo->setVarArgsFrameIndex(FuncInfo->getRegSaveFrameIndex());
|
||||||
} else {
|
} else {
|
||||||
// For X86-64, if there are vararg parameters that are passed via
|
// For X86-64, if there are vararg parameters that are passed via
|
||||||
// registers, then we must store them to their spots on the stack so they
|
// registers, then we must store them to their spots on the stack so they
|
||||||
|
@ -18,3 +18,36 @@ entry:
|
|||||||
}
|
}
|
||||||
|
|
||||||
declare void @llvm.va_start(i8*) nounwind
|
declare void @llvm.va_start(i8*) nounwind
|
||||||
|
|
||||||
|
; CHECK: f5:
|
||||||
|
; CHECK: pushq
|
||||||
|
; CHECK: leaq 56(%rsp),
|
||||||
|
define i8* @f5(i64 %a0, i64 %a1, i64 %a2, i64 %a3, i64 %a4, ...) nounwind {
|
||||||
|
entry:
|
||||||
|
%ap = alloca i8*, align 8
|
||||||
|
%ap1 = bitcast i8** %ap to i8*
|
||||||
|
call void @llvm.va_start(i8* %ap1)
|
||||||
|
ret i8* %ap1
|
||||||
|
}
|
||||||
|
|
||||||
|
; CHECK: f4:
|
||||||
|
; CHECK: pushq
|
||||||
|
; CHECK: leaq 48(%rsp),
|
||||||
|
define i8* @f4(i64 %a0, i64 %a1, i64 %a2, i64 %a3, ...) nounwind {
|
||||||
|
entry:
|
||||||
|
%ap = alloca i8*, align 8
|
||||||
|
%ap1 = bitcast i8** %ap to i8*
|
||||||
|
call void @llvm.va_start(i8* %ap1)
|
||||||
|
ret i8* %ap1
|
||||||
|
}
|
||||||
|
|
||||||
|
; CHECK: f3:
|
||||||
|
; CHECK: pushq
|
||||||
|
; CHECK: leaq 40(%rsp),
|
||||||
|
define i8* @f3(i64 %a0, i64 %a1, i64 %a2, ...) nounwind {
|
||||||
|
entry:
|
||||||
|
%ap = alloca i8*, align 8
|
||||||
|
%ap1 = bitcast i8** %ap to i8*
|
||||||
|
call void @llvm.va_start(i8* %ap1)
|
||||||
|
ret i8* %ap1
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user