[Mono-list] Quick question reguarding local allocation
Miguel de Icaza
25 Feb 2002 19:38:17 -0500
> Thanks for the very swift response. I guessed that this would be the case, the reason I asked was from a pretty selfish perspective in that I am currently writing for my 4rth year project a compiler which takes IL and produces native code, currently my register allocator is very simple (it simply assigns a register to each local and stack slot that it can and spills the rest, the arguments are simply placed on the (real) machine's stack), and I plan to discuss in the dissertation (which is all I am actually marked on) whether there would be a marked improvement if a proper register allocator were used. The stack slots generally (as far as I can make out) have to be live simultaneously (unless their values are taken off with the pop IL instruction which as far as I can make out isnt' used very often). So I'm not sure that a great advantage can be made by a more intelligent register allocator. Obviously some of the locals and the stack slots could still be merged, however th!
> peephole optimser does at least take care of removing some of the move instruction between the (registers representing) the stack and the locals so the gain there would be too great either.
I believe that you and Ravi are talking about different kind of register
allocation. The compiler tries to do some reuse of local variables, but
I do have to revisit this, as we are doing it in less places than we
could and in some cases, we need a way of flagging entries as
use-only-once (because they have special semantics, like `pinned')