[llvm-bugs] [Bug 39251] New: Return of structs in C calling convention is done on stack, incompatible with avr-gcc usually using registers
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Oct 11 03:18:58 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=39251
Bug ID: 39251
Summary: Return of structs in C calling convention is done on
stack, incompatible with avr-gcc usually using
registers
Product: libraries
Version: trunk
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Backend: AVR
Assignee: unassignedbugs at nondot.org
Reporter: me at dylanmckay.io
CC: llvm-bugs at lists.llvm.org
Created attachment 20989
--> https://bugs.llvm.org/attachment.cgi?id=20989&action=edit
the test C file I wrote containing structures of different sizes
The AVR-GCC documentation states that
| Return values with a size of 1 byte up to and including a size of
| 8 bytes will be returned in registers. Return values whose size
| is outside that range will be returned in memory.
https://gcc.gnu.org/wiki/avr-gcc#Calling_Convention
However, this does not seem to be the case when the return value is a struct.
>From experimental tests, I've seen that avr-gcc will return the struct via
registers if and only if the struct is less than or equal to four bytes in
size. Any struct with sizeof(self) > 5 will be returned on the stack with
AVR-GCC.
Currently, AVR-LLVM does not place ANY struct return values in registers. They
all go to the stack.
We need to modify the AVR backend so that it matches AVR-GCC's behaviour -
structures of four bytes or less should be assigned to registers, whereas
structures larger than this should be relegated to stack.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20181011/7ee5ef58/attachment.html>
More information about the llvm-bugs
mailing list