[Mono-list] Quick question reguarding local allocation
adc
shark@blueyonder.co.uk
Tue, 26 Feb 2002 00:34:06 +0000
On 25 Feb 2002 18:09:11 -0600
Ravi Pratap M <ravi@ximian.com> wrote:
> Hi there,
>
> On Mon, 2002-02-25 at 18:03, adc wrote:
> > Does the mono C# compiler squeeze the (IL) locals into as few as
> >possible?
> > By this I mean if two locals which would otherwise have been outputted
> >are never simultaneously live does mcs squeeze these two locals into
> >one?
>
> IIRC, no we don't do any kind of optimization on the locals yet - in
> fact, our plan is to worry about optimizing our code only when we are
> done with all the bug-fixing and feature completion :-)
>
>
> But you are welcome to submit a patch though ;-)
>
>
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 the 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.