simonmar 2004/02/16 04:43:42 PST
Modified files: (Branch: backend-hacking-branch)
ghc/compiler/nativeGen RegisterAlloc.hs
Log:
Major rehash of the register allocator. Fixes at least one problem:
- clobbering: we shouldn't delete clobbered temps from the
assignment, because they might be read by this instruction.
Now the register allocator treats reads separately from writes. We
use a simple model of an instruction, in which a bunch of
registers/temporaries are read, and then another bunch of
registers/temporaries are written. This means we might be able to
re-use the same register for both a read and a write temporary. It
also means that we can correctly mark clobbered registers as
unallocatable after the read phase but before the write phase.
At the same time, I added another optimisation: a temporary can be
marked as living in both a register and memory (InBoth), for example
if it was recently loaded from a spill location. This makes it cheap
to spill (no save instruction required), but we have to be careful to
invalidate this mark if the value in the register is changed.
This is also useful when a temporary is about to be clobbered. We
save it in a spill location, but mark it as InBoth because the current
instruction might still want to read it.
Revision Changes Path
1.1.2.14 +228 -179 fptools/ghc/compiler/nativeGen/Attic/RegisterAlloc.hs
_______________________________________________
Cvs-ghc mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/cvs-ghc