[llvm] [clang] New calling convention preserve_none (PR #76868)

via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 4 20:29:14 PST 2024


================
@@ -416,6 +416,12 @@ added in the future:
     This calling convention, like the `PreserveMost` calling convention, will be
     used by a future version of the ObjectiveC runtime and should be considered
     experimental at this time.
+"``preserve_nonecc``" - The `PreserveNone` calling convention
+    This calling convention doesn't preserve any general registers. So all
+    general registers are caller saved registers. It also uses all general
+    registers to pass arguments. This attribute doesn't impact floating-point
----------------
weiguozhi wrote:

> I suspect this should say any `non-general purpose registers (e.g. floating point registers, on x86 XMMs/YMMs)`. Rather than `floating-point registers`. 

Thanks for the correction! Will change it.

> Also isn't this just a hack to increase the number of registers used to pass arguments? If so there has to be a better way of doing this. Maybe a non-exposed attribute which is used only for non-exposed functions? e.g. on x86 (not 64bit), regparm could be used internally there.

It's not a hack, it's a natural extension. Because we don't preserve general registers, we can use all of them to pass arguments without the extra cost to save/restore those registers, they are clobbered by the function call anyway.

https://github.com/llvm/llvm-project/pull/76868


More information about the cfe-commits mailing list