reusing pseudo-regs

Stephen Weeks MLton@sourcelight.com
Fri, 1 Mar 2002 10:53:32 -0800


> signature MAP = sig
>    type 'a map
>    val new: (t -> 'a) -> 'a map
>    val sub: ('a map * t) -> 'a
>    val update: ('a map * t * 'a) -> 'a map
> end
> 
> That's pretty trivial to implement.  Probably even better to do something
> like that in lib/mlton/basic as a finite-map functor.  So, is there
> something like that already there that I just don't know the right name
> for?

There's memo, but that's probably not quite right.

> Unfortunately, I still haven't worked out how to dynamically adapt
> enough.
...
You could have the bit-vector functor use an int ref that is the
vector length, and set that on entry to each SSA function.

> > BTW, here are a couple of other things that were on my todo relating
> > to pseudo-reg allocation.
> > 
> > 1. Use targeting info to avoid shuffles
> > 2. Use liveness info at a statement granularity
> 
> Both of those would be nice; I think 1 has the potential to be the bigger
> win, although I'd be wary of forcing a variable that could live in a
> psuedo-reg to live in a stack slot just because it is moved to or from
> there.  (I think you had this in mind with your description.)

I didn't mean for that to happen, and agree it looks risky.  All I
meant was to target registers to registers and stack slots to stack
slots.