Hey all,
I'm working on the AVR backend for LLVM.
I'm looking into an issue where the current LLVM implementation of the AVR C calling convention is not matching the assembly of what GCC is generating.
On top of that, when I run through the argument algorithm described on the Wiki (
https://gcc.gnu.org/wiki/avr-gcc), GCC output doesn't seem to match up, whereas LLVM does.
The shortest and most inaccurate version of it is: GCC only stores up to 8 bytes of arguments in registers, and every argument after that is located on the stack. The Wiki says that registers between r8-r25 are used, which doesn't seem to match up.
Example: Given a function which takes two 64-bit integers (i64 %a, i64 %b)
This indicates that both arguments should be located in registers, but AVR-GCC stores the first argument in registers, and the second argument on the stack.
Which is correct? Am I misunderstanding the algorithm?
Where in GCC can I find the implementation of this calling convention?
Cheers,
Dylan