[fpc-devel] register allocator seems to be using S20 for two things at the same time (related to armhf porting work)

peter green plugwash at p10link.net
Sun Mar 18 01:04:44 CET 2012


While testing my armhf porting work (which I will send on request, including it
in this mail seems to make it too big for the list to accept) I came across a case
where  parameters were passed incorrectly to a function with a large number of
parameters (14 single, 1 double). Initially I thought this was because
of the compilers lack of knowlage of the conflict between double
registers and odd numbered single registers. However looking more
closely this appears not to be the case. The full assembler is attached
and highlights of it are below.

     # Register r0 allocated
Looking at the code it seems that the compiler is loading the constants
     ldr    r0,.Lj14
     # Register r0 released
     # Register s0 allocated
     flds    s0,[r0]
     # Register s0 released
     # Register s20 allocated
     fcpys   s20,s0
     <--snip a load of stuff not involving s20-->
     # Register r0 allocated
     ldr     r0,.Lj54
     # Register r0 released
     # Register s0 allocated
     flds    s0,[r0]
     # Register s0 released
     # Register s20 allocated
     fcpys   s20,s0
     <--snip a load of stuff not involving s20-->
     # Register s20 released
     # Register s13 allocated
     fcpys   s13,s20
     <--snip a load of stuff not involving s20-->
     # Register s20 released
     # Register s3 allocated
     fcpys   s3,s20


Looking at the code it seems that the compiler is loading the constants
into temporary registers and then copying them to the final locations
for passing them to the parameters. However for some reason it is using
S20 to store two different temporary values at the same time. Any idea
what could cause this and how to debug it? S20 is NOT used for passing
parameters to funtions.

I have a hunch it may be a spilling related issue but i've no idea
where to look to confirm/refute that theory.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: testfp.s
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20120318/237ee9ad/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: testfp.dpr
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20120318/237ee9ad/attachment-0001.ksh>


More information about the fpc-devel mailing list