Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7632,7 +7632,7 @@ CCAssignFn *AArch64TargetLowering::CCAssignFnForCall(CallingConv::ID CC,
bool IsVarArg) const {
switch (CC) {
default:
report_fatal_error("Unsupported calling convention.");
reportFatalUsageError("unsupported calling convention");
case CallingConv::GHC:
return CC_AArch64_GHC;
case CallingConv::PreserveNone:
Expand Down Expand Up @@ -7741,6 +7741,12 @@ SDValue AArch64TargetLowering::LowerFormalArguments(
unsigned NumArgs = Ins.size();
Function::const_arg_iterator CurOrigArg = F.arg_begin();
unsigned CurArgIdx = 0;
bool UseVarArgCC = false;
if (IsWin64)
UseVarArgCC = isVarArg;

CCAssignFn *AssignFn = CCAssignFnForCall(CallConv, UseVarArgCC);

for (unsigned i = 0; i != NumArgs; ++i) {
MVT ValVT = Ins[i].VT;
if (Ins[i].isOrigArg()) {
Expand All @@ -7757,10 +7763,6 @@ SDValue AArch64TargetLowering::LowerFormalArguments(
else if (ActualMVT == MVT::i16)
ValVT = MVT::i16;
}
bool UseVarArgCC = false;
if (IsWin64)
UseVarArgCC = isVarArg;
CCAssignFn *AssignFn = CCAssignFnForCall(CallConv, UseVarArgCC);
bool Res =
AssignFn(i, ValVT, ValVT, CCValAssign::Full, Ins[i].Flags, CCInfo);
assert(!Res && "Call operand has unhandled type");
Expand Down Expand Up @@ -8429,6 +8431,8 @@ static void analyzeCallOperands(const AArch64TargetLowering &TLI,
ArgVT = MVT::i16;
}

// FIXME: CCAssignFnForCall should be called once, for the call and not per
// argument. This logic should exactly mirror LowerFormalArguments.
CCAssignFn *AssignFn = TLI.CCAssignFnForCall(CalleeCC, UseVarArgCC);
bool Res = AssignFn(i, ArgVT, ArgVT, CCValAssign::Full, ArgFlags, CCInfo);
assert(!Res && "Call operand has unhandled type");
Expand Down
8 changes: 8 additions & 0 deletions llvm/test/CodeGen/AArch64/unsupported-cc-call.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
; FIXME: This should error:
; RUN: llc -mtriple=aarch64-- -filetype=null %s
declare amdgpu_gfx void @amdgpu_gfx_func()

define void @call_amdgpu_gfx_func() {
call amdgpu_gfx void @amdgpu_gfx_func()
ret void
}
6 changes: 6 additions & 0 deletions llvm/test/CodeGen/AArch64/unsupported-cc-func.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
; RUN: not llc -mtriple=aarch64-- -filetype=null %s 2>&1 | FileCheck %s

; CHECK: LLVM ERROR: unsupported calling convention
define amdgpu_gfx void @amdgpu_gfx_func_definition() {
ret void
}
6 changes: 3 additions & 3 deletions llvm/test/MC/AArch64/coff-function-type-info.ll
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
; RUN: llc -mtriple arm64-windows -filetype asm -o - %s \
; RUN: llc -mtriple arm64-windows -filetype asm -o - %s \
; RUN: | FileCheck %s -check-prefix CHECK-ASM

; RUN: llc -mtriple arm64-windows -filetype obj -o - %s \
; RUN: | llvm-readobj --symbols - | FileCheck %s -check-prefix CHECK-OBJECT

define arm_aapcs_vfpcc void @external() {
define aarch64_vector_pcs void @external() {
entry:
ret void
}
Expand All @@ -15,7 +15,7 @@ entry:
; CHECK-ASM: .endef
; CHECK-ASM: .globl external

define internal arm_aapcs_vfpcc void @internal() {
define internal aarch64_vector_pcs void @internal() {
entry:
ret void
}
Expand Down