avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] AVR C calling convention not matching spec


From: Dylan McKay
Subject: [avr-gcc-list] AVR C calling convention not matching spec
Date: Sun, 11 Dec 2016 20:13:19 +1300

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)
* Start with Rn = 26
* Begin processing %a
  * Rn -= 8 = 18
  * Rn >= 8, therefore this argument will be stored in registers r18-r25
* Begin processing %b
  * Rn -= 8 = 10
  * Rn >= 8, therefore this argument will be stored in registers r10-r17

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?

I've got an issue on the LLVM bug tracker here (https://llvm.org/bugs/show_bug.cgi?id=31347).

Cheers,
Dylan

reply via email to

[Prev in Thread] Current Thread [Next in Thread]