Hello,

I just pushed a somewhat big commit to the CPS branch. It didn't have much
content, but it moved register allocation to its own file. It also tries to
move in the direction of making logically separate operations into their
own passes, which Andy wanted.

I think it's mostly good, but I would be interested in reviews of the
interface between allocate-registers-and-labels and the rest of the
program. The trouble is, it sets a lot of different properties, and
therefore returns six values. I could make labels and registers into a
separate pass, but we'd still have one pass returning two values and
another pass returning four.

Another possibility is packaging everything up into a struct. The reason I
didn't do that is that the first thing I would do with that struct is
extract all of its elements, so it seemed like extra work for not much
benefit. I don't know of any reason we need to be able to store the state
of a partially-run compiler right now.

The old way of handling this was having a bunch of global variables, but
this seems cleaner and more functional. There might also be a fourth way
that I haven't thought of, or maybe one of these three ways is clearly
best. This isn't a big issue now, but it's going to be important to
organize passes well as the compiler grows more and more of them.

Thanks,
Noah

Reply via email to