Skip to content
This repository was archived by the owner on Dec 20, 2019. It is now read-only.

Commit 8415fd8

Browse files
committed
Fix the mono calling convention on arm64+linux.
1 parent 117a508 commit 8415fd8

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

lib/Target/AArch64/AArch64CallingConvention.td

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,3 +357,12 @@ def CC_AArch64_Mono_DarwinPCS : CallingConv<[
357357

358358
CCDelegateTo<CC_AArch64_DarwinPCS>
359359
]>;
360+
361+
def CC_AArch64_Mono_AAPCS : CallingConv<[
362+
363+
// Mono marks the parameter it wants to pass in this non-abi register with
364+
// the 'inreg' attribute.
365+
CCIfInReg<CCAssignToReg<[X15]>>,
366+
367+
CCDelegateTo<CC_AArch64_AAPCS>
368+
]>;

lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2717,7 +2717,12 @@ CCAssignFn *AArch64TargetLowering::CCAssignFnForCall(CallingConv::ID CC,
27172717
case CallingConv::Win64:
27182718
return IsVarArg ? CC_AArch64_Win64_VarArg : CC_AArch64_AAPCS;
27192719
case CallingConv::Mono:
2720-
return CC_AArch64_Mono_DarwinPCS;
2720+
if (Subtarget->isTargetDarwin())
2721+
return CC_AArch64_Mono_DarwinPCS;
2722+
else if (Subtarget->isTargetWindows())
2723+
report_fatal_error("Unsupported calling convention.");
2724+
else
2725+
return CC_AArch64_Mono_AAPCS;
27212726
}
27222727
}
27232728

0 commit comments

Comments
 (0)