Commit Graph

6 Commits

Author SHA1 Message Date
Jakob Stoklund Olesen
f2f162f37e Spill values live across calls.
Calls clobber many registers, so spill everything that is live across a
call for now.

In the future, we may add support for callee-saved registers.
2017-06-14 08:55:01 -07:00
Jakob Stoklund Olesen
d94bd8c236 Add a minimalistic reload pass.
The reload pass inserts spill and fill instructions as needed so
instructions that operate on registers will never see a value with stack
affinity.

This is a very basic implementation, and we can't write good test cases
until we have a spilling pass.
2017-06-07 12:05:38 -07:00
Jakob Stoklund Olesen
1e51f97108 Rename Affinity::Any to Affinity::None.
This value affinity doesn't mean "whatever", it means that the value
does not interact with any real instructions, where "real" means
instructions that have a legal encoding.

Update the liveness verifier to check this property:

- Encoded instructions can only use real values.
- Encoded instructions define real values.
- Ghost instructions define ghost values.
2017-04-26 11:20:17 -07:00
Jakob Stoklund Olesen
2f866171ca Add an Affinity::display() method.
Make it possible to display affinities given a RegInfo reference.
2017-04-26 11:16:38 -07:00
Jakob Stoklund Olesen
93db01d38a Assign an affinity to function argument values.
Use the argument types from the function signature to initialize the
affinity of register and stack arguments.
2017-04-26 10:50:56 -07:00
Jakob Stoklund Olesen
3c4d54c4bd Implement value affinities for register allocation.
An SSA value is usually biased towards a specific register class or a
stack slot, depending on the constraints of the instructions using it.

Represent this bias as an Affinity enum, and implement a merging
algorithm for updating an affinity to satisfy a new constraint.

Affinities will be computed as part of the liveness analysis. This is
not implemented yet.
2017-01-27 10:22:50 -08:00