John Reagan via llvm-dev
2019-Jan-17 19:07 UTC
[llvm-dev] [RFC] Introducing an explicit calling convention
I would like more control too as we have explicit calling conventions in our C front-end (and others too) and our Alpha/Itanium code generator. It is mostly used for non-standard argument linkages with routines inside the OS that are written in VAX assembly code. It started life over 40 years ago as all assembly and we needed explicit argument linkages to gradually replace the code with C. We also use it to describe passing structs into a sequence of registers. These linkages tend to be target-specific and surrounded by #if's for each of our targets (Alpha and Itanium). We have a different solution for x86 using LLVM partly due to not be easily able to specify the conventions without doing exactly as proposed here (and not enough registers on x86-64). I see no mention of floats other than Reid mentioning C99 complex. The x86-64 ABI gets really ugly with packing a struct with a mixture of ints and floats. I'm not sure how one would describe the default mechanism with the proposed attributes FYI Here's the syntax for our C pragma, but it helps describe the underlying implementation: #pragma linkage linkage-name=(characteristics) where 'characteristics' is a parenthesized list of comma-separated items of the following forms: parameters (register-list) result (simple-register-list) preserved (simple-register-list) nopreserve (simple-register-list) notused (simple-register-list) standard_linkage Simple-register-list is a comma-separated list of register names. Register-list (used by 'parameters') can have parenthesized sublists For example #pragma linkage sample_linkage = (parameters ((r5, r6, r7), f6)) #pragma use_linkage sample_linkage(sub) void sub (struct sample_struct_t p1, double p2) { } -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: OpenPGP digital signature URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190117/ab532cbf/attachment.sig>