This is an archive of the discontinued LLVM Phabricator instance.

ARMEB: Fix function result return for composite types
ClosedPublic

Authored by cpirker on Jul 2 2014, 10:18 AM.

Details

Reviewers
rengolin
Summary

Hi all,

ARM AAPCS-ABI specifies the result format of composite types in section 5.4 "Result Return":
Composite Type not larger than 4 bytes is returned in r0.
The format is as if the result had been stored in memory at a word-aligned address and then loaded into r0 with an LDR instruction.
Any bits in r0 that lie outside the bounds of the result have unspecified values.

This patch implements return format of composite types <= 4 bytes by using the "upper" part of register r0 (instead of lower part as in little endian) to transfer the data value.
CFE emits additional shift instructions in big endian mode.

Please review, thanks,
Christian

Diff Detail

Event Timeline

cpirker updated this revision to Diff 11028.Jul 2 2014, 10:18 AM
cpirker retitled this revision from to ARMEB: Fix function result return for composite types.
cpirker updated this object.
cpirker edited the test plan for this revision. (Show Details)
cpirker added subscribers: Unknown Object (MLST), Konrad.
rengolin accepted this revision.Jul 2 2014, 11:56 AM
rengolin added a reviewer: rengolin.
rengolin added a subscriber: rengolin.

With the style nitpick, LGTM, Thanks!

lib/CodeGen/TargetInfo.cpp
4382

Maybe making the BE code return earlier, than keeping the same code for little-endian below.

if (!getDataLayout().isLittleEndian()) {
  return ABIArgInfo::getDirect(llvm::Type::getInt32Ty(getVMContext()));
...
This revision is now accepted and ready to land.Jul 2 2014, 11:56 AM
cpirker closed this revision.Jul 3 2014, 2:53 AM

Hi Renato,

I updated the patch and committed as rL212261.

Thanks,
Christian