[llvm-dev] Legalising seems to lose critical information needed for lowering return values properly?

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Sat Mar 2 19:08:25 PST 2019


On Sat, 2 Mar 2019 at 06:58, carl-llvm-dev at petosoft.com via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> AVRTargetLowering::LowerFormalArguments, we already have a problem because the 32 bit return value has been turned into two 16 bit values by the legaliser and the information has been lost that it was one 32 bit value.

Isn't it kept (rather awkwardly) by the fact that the first half of
this value has the "IsSplit" flag set? The ARM backends use this to
handle i64 and i128 specially; they need extra alignment rather than
byte-swapping, but the principle ought to be similar.

> Which bit of the code do people think is at fault here? What hooks need changing on AVR?

That's a bit of a tricky question. The way ABIs work on Clang & LLVM
is unfortunately through a tight coupling between the backend and
Clang CodeGen. As long as Clang is capable of producing compliant code
the question of how natural the interface is becomes QoI.

In this case putting the byte-swapping into Clang would be unnatural
enough that I lean towards it being a backend issue (maybe with
generic involvement depending on how the IsSplit thing works out).

Cheers.

Tim.


More information about the llvm-dev mailing list