[fpc-devel] register allocator seems to be using S20 for two things at the same time (related to armhf porting work)
daniel.mantione at freepascal.org
Sun Mar 18 13:07:36 CET 2012
Op Sat, 17 Mar 2012, schreef peter green:
> 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.
> 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.
This usually has to do with the code generator generating incorrect
allocations. The code genator generates code with an infinite
amount of imaginary registers and inserts allocations & deallocations.
Later the register allocator check which imaginary registers conflict. If
they don't conflict it can decide to "coalesce" them into the same
imaginary register to reduce register pressure.
Please use the command line option -sr to check the generated code before
register allocation. You can likely find the cause in there.
More information about the fpc-devel