[fpc-pascal] -OoASMCSE

Jonas Maebe jonas.maebe at elis.ugent.be
Mon Jan 2 18:17:11 CET 2012


On 02 Jan 2012, at 17:56, Bernd wrote:

> This seems to work:
> 
> http://pastebin.com/E3LYfJCx  (used with 2.6.0)
> 
> Is this how it should look like or am I doing something completely
> stupid or did I forget something important?

At first sight, one important thing you forgot is that a single memory location can be aliased by multiple pointers. Simply checking whether the base register and offsets match is not enough to determine whether a write invalidates register contents, since a write via a pointer could overwrite any other memory location.

> BTW: wouldn't it be possible to make it not generate this redundant
> code in the first place or would this again be some kind of impossible
> / overly complicated thing?

A better register allocator undoubtedly result in less spilling code (by e.g. performing live range splitting).

> It seems to me the code is not really meant for performing complicated
> analysis and operations on the generated assembly code, even the
> simplest things like comparing two instructions or getting a list of
> input and output registers seems so incredibly cumbersome, or is this
> only my impression because I am not very familiar with this kind of
> things?

Originally it was probably about as simple as your code. Afterwards, much more functionality was added beyond removing single loads.


Jonas


More information about the fpc-pascal mailing list