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

Commit 37e14bd

Browse files
vargazlewurm
authored andcommitted
Fix the mono calling convention on arm64+linux.
1 parent acb33f3 commit 37e14bd

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
@@ -262,3 +262,12 @@ def CC_AArch64_Mono_DarwinPCS : CallingConv<[
262262

263263
CCDelegateTo<CC_AArch64_DarwinPCS>
264264
]>;
265+
266+
def CC_AArch64_Mono_AAPCS : CallingConv<[
267+
268+
// Mono marks the parameter it wants to pass in this non-abi register with
269+
// the 'inreg' attribute.
270+
CCIfInReg<CCAssignToReg<[X15]>>,
271+
272+
CCDelegateTo<CC_AArch64_AAPCS>
273+
]>;

lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1796,7 +1796,12 @@ CCAssignFn *AArch64TargetLowering::CCAssignFnForCall(CallingConv::ID CC,
17961796
return CC_AArch64_AAPCS;
17971797
return IsVarArg ? CC_AArch64_DarwinPCS_VarArg : CC_AArch64_DarwinPCS;
17981798
case CallingConv::Mono:
1799-
return CC_AArch64_Mono_DarwinPCS;
1799+
if (Subtarget->isTargetDarwin())
1800+
return CC_AArch64_Mono_DarwinPCS;
1801+
else if (Subtarget->isTargetWindows())
1802+
report_fatal_error("Unsupported calling convention.");
1803+
else
1804+
return CC_AArch64_Mono_AAPCS;
18001805
}
18011806
}
18021807

0 commit comments

Comments
 (0)