This is an archive of the discontinued LLVM Phabricator instance.

[AVR][clang] Fix wrong calling convention in functions return struct type
ClosedPublic

Authored by benshi001 on Mar 23 2021, 9:24 PM.

Details

Summary

According to AVR ABI (https://gcc.gnu.org/wiki/avr-gcc), returned struct value
within size 1-8 bytes are returned directly (via register r18-r25), while larger
ones are returned via an implict struct pointer argument.

Diff Detail

Event Timeline

benshi001 created this revision.Mar 23 2021, 9:24 PM
benshi001 requested review of this revision.Mar 23 2021, 9:24 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 23 2021, 9:24 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript

This patch just fix the wrong return type in ABI. The wrong parameters passing with be fixed in another patch.

Anastasia added inline comments.Mar 31 2021, 8:01 AM
clang/test/CodeGen/avr/struct.c
16

Minor thing - I guess for the purpose of this testing you could skip initialization on struct variables?

benshi001 updated this revision to Diff 334885.Apr 1 2021, 8:09 PM
benshi001 marked an inline comment as done.
benshi001 updated this revision to Diff 335368.Apr 5 2021, 7:01 PM
dylanmckay accepted this revision.Jun 28 2021, 4:16 AM
This revision is now accepted and ready to land.Jun 28 2021, 4:16 AM