Liste des Groupes | Revenir à cl c |
On 12/18/2024 6:35 PM, bart wrote:On 19/12/2024 00:27, BGB wrote:
I'd imagine it's worse with ARM targets as there are so many more registers to try and deconstruct structs into.In my case, I am not bothering with the SysV style ABI's (well, along with there not being any x86 or x86-64 target...).By-Value Structs smaller than 16 bytes are passed as-if they were a 64 or 128 bit integer type (as a single register or as a register pair, with a layout matching their in-memory representation).>
>
...
>
>
But, yeah, at the IL level, one could potentially eliminate structs and arrays as a separate construct, and instead have bare pointers and a generic "reserve a blob of bytes in the frame and initialize this pointer to point to it" operator (with the business end of this operator happening in the function prolog).
The problem with this, that I mentioned elsewhere, is how well it would work with SYS V ABI, since the rules for structs are complex, and apparently recursive.
>
Having just a block of bytes might not be enough.
For my ISA, it is a custom ABI, but follows mostly similar rules to some of the other "Microsoft style" ABIs (where, I have noted that across multiple targets, MS tools have tended to use similar ABI designs).When you do your own thing, it's easy.
For my compiler targeting RISC-V, it uses a variation of RV's ABI rules.Supporting C's variadic functions, which is needed for many languages when calling C across an FFI, usually requires different rules. On Win64 ABI for example, by passing low variadic arguments in both GPRs and FPU registers.
Argument passing is basically similar, but struct pass/return is different; and it passes floating-point values in GPRs (and, in my own ISA, all floating-point values use GPRs, as there are no FPU registers; though FPU registers do exist for RISC-V).
Not likely a huge issue as one is unlikely to use ELF and PE/COFF in the same program.That's interesting: you deliberately used one of the most complex file formats around, when you could have devised your own?
For the "OS" that runs on my CPU core, it is natively using PE/COFF, but
Les messages affichés proviennent d'usenet.