[llvm-commits] [ARM] Fix for blocking PR13790. AAPCS byval params issue.

Stepan Dyatkovskiy stpworld at narod.ru
Thu Oct 11 04:15:29 PDT 2012


Hi all,
Stack is formed improperly for long structures passed as byval arguments 
for EABI mode.

If we took AAPCS reference, we can found the next statements:

A: "If the argument requires double-word alignment (8-byte), the NCRN 
(Next Core Register Number) is rounded up to the next even register 
number." (5.5 Parameter Passing, Stage C, C.3).

B: "The alignment of an aggregate shall be the alignment of its 
most-aligned component." (4.3 Composite Types, 4.3.1 Aggregates).

So if we have structure with doubles (9 double fields) and 3 Core unused 
registers (r1, r2, r3): caller should use r2 and r3 registers only.
Currently r1,r2,r3 set is used, but it is invalid.

Callee VA routine should also use r2 and r3 regs only. All is ok here. 
This behaviour is guessed by rounding up SP address with ADD+BFC operations.

Consider patch in attachment with fix + regression test.

P.S.:
I also improved LDRB_POST_IMM regression test. Since ldrb instruction 
will not generated by current regression test after this patch.

  Cheers!
-Stepan.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: aapcs-byval-regs.patch
Type: text/x-patch
Size: 6587 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121011/d0adca90/attachment.bin>


More information about the llvm-commits mailing list