[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 00:46:25 CET 2012


I don't think my previous mail got through but if it does please 
disregard it, my suspiscions as to the cause of the problem were incorrect.

While testing my armhf porting work 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
    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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: fpc.diff
Type: text/x-diff
Size: 51782 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20120317/59ef8906/attachment.diff>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: testfp.s
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20120317/59ef8906/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: testfp.dpr
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20120317/59ef8906/attachment-0001.ksh>


More information about the fpc-devel mailing list