Skip to content

Commit ce678ec

Browse files
committed
Try to use non-volatile registers for preseve_none parameters
1 parent 04bf1a4 commit ce678ec

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

llvm/lib/Target/X86/X86CallingConv.td

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,11 +1063,13 @@ def CC_X86_64_Preserve_None : CallingConv<[
10631063
// - R10 'nest' parameter
10641064
// - RBX base pointer
10651065
// - R16 - R31 these are not available everywhere
1066-
CCIfType<[i32], CCAssignToReg<[EDI, ESI, EDX, ECX, R8D, R9D,
1067-
R11D, R12D, R13D, R14D, R15D, EAX]>>,
1066+
// Use non-volatile registers first, so functions using this convention can
1067+
// call "normal" functions without saving and restoring incoming values:
1068+
CCIfType<[i32], CCAssignToReg<[R12D, R13D, R14D, R15D, EDI, ESI,
1069+
EDX, ECX, R8D, R9D, R11D, EAX]>>,
10681070

1069-
CCIfType<[i64], CCAssignToReg<[RDI, RSI, RDX, RCX, R8, R9,
1070-
R11, R12, R13, R14, R15, RAX]>>,
1071+
CCIfType<[i64], CCAssignToReg<[R12, R13, R14, R15, RDI, RSI,
1072+
RDX, RCX, R8, R9, R11, RAX]>>,
10711073

10721074
// Otherwise it's the same as the regular C calling convention.
10731075
CCDelegateTo<CC_X86_64_C>

0 commit comments

Comments
 (0)