On 07/01/18 23:24, Martok wrote:
Am 05.01.2018 um 18:03 schrieb Jonas Maebe:
regvars have always been disabled for routines that contain assembler
blocks (on all architectures). Sometimes the compiler temporarily uses
registers for other purposes over a longer period, which is why marking
the used registers is still required.
I can see that this is safer if the assembler blocks aren't properly annotated,
but if they are, there shouldn't be any problem?
Part of it is probably legacy, and part of it is the philosophy that the
compiler does not try to understand assembly blocks and hence cannot
make any assumptions about what is and what is not safe regarding local
variables in the same routine. Unlike in e.g. gcc, there are no
annotations for assembly routines that they expect certain variables to
be in memory and/or registers, that the block may touch arbitrary memory
locations, etc. Hence, the compiler is as conservative as possible.
It is probably possible to safely increase the code quality of routines
containing assembly blocks, but that would require a proper examination
of what optimizations are safe under which conditions (and it would lead
to the need to add support for extra annotations for assembly blocks).
There seem to be a lot of rather non-obvious limitations around inline assembler
and assembler routines. Are they documented somewhere central?
Afaik there are only two limitations:
* routines containing assembly blocks (including pure assembly routines)
cannot be inlined
* regular procedures that contain assembly blocks will never use regvars
Jonas
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal