On Tue May 16 17:54:05 2023 +0000, Zebediah Figura wrote:
/* Compute the earliest and latest liveness for each variable. In the
case that
- a variable is accessed inside of a loop, we promote its liveness to extend
- to at least the range of the entire loop. We also do this for nodes produced
- before the loop, so that their temp register is protected from being
- overriden during the whole loop. */
Yeah, I like that better.
Now I think we could extend the liveness only if `instr->index < loop_start`.
I believe you're right (and in the interest of making more registers available it's probably a good idea).
Okay, I realized we can't do the `instr->index < loop_start` trick (at least, not without rethinking the implementation), because currently `loop_start` holds the start of the outermost loop, so consider:
``` 02 for(;;) 03 { 04 # instr origins here. 05 for(;;) 06 { 07 # instr is accessed here. 08 # some more operations. 09 } 10 } ```
In this case it doesn't happen that `instr->index < loop_start`, because loop_start would be 02. But its register must be protected during the whole duration of the inner loop.
For now I will just push change the comment and the commit message.