
The new experimental calling convention preserve_none is the opposite side of existing preserve_all. It tries to preserve as few general registers as possible. So all general registers are caller saved registers. It can also uses more general registers to pass arguments. This attribute doesn't impact floating-point registers. Floating-point registers still follow the c calling convention. Currently preserve_none is supported on X86-64 only. It changes the c calling convention in following fields: * RSP and RBP are the only preserved general registers, all other general registers are caller saved registers. * We can use [RDI, RSI, RDX, RCX, R8, R9, R11, R12, R13, R14, R15, RAX] to pass arguments. It can improve the performance of hot tailcall chain, because many callee saved registers' save/restore instructions can be removed if the tail functions are using preserve_none. In my experiment in protocol buffer, the parsing functions are improved by 3% to 10%.
17 lines
549 B
LLVM
17 lines
549 B
LLVM
; RUN: not llc -mtriple=x86_64 %s -o - 2>&1 | FileCheck %s
|
|
|
|
; Swift attributes should not be used with preserve_none.
|
|
|
|
declare preserve_nonecc void @foo(ptr swiftself)
|
|
|
|
; CHECK: error: <unknown>:0:0: in function bar void (ptr): Swift attributes can't be used with preserve_none
|
|
define preserve_nonecc void @bar(ptr swifterror) {
|
|
ret void
|
|
}
|
|
|
|
; CHECK: error: <unknown>:0:0: in function qux void (ptr): Swift attributes can't be used with preserve_none
|
|
define void @qux(ptr %addr) {
|
|
call preserve_nonecc void @foo(ptr swiftself %addr)
|
|
ret void
|
|
}
|