Dynamically choosing a register
Klaus D. Witzel
klaus.witzel at cobss.com
Fri Jul 27 07:46:44 UTC 2007
On Thu, 26 Jul 2007 20:24:06 +0200, J J wrote:
>
>> From: bryce at kampjes.demon.co.uk> Date: Thu, 26 Jul 2007 11:43:43 +0100>
>> To: exupery at lists.squeakfoundation.org> Subject: RE: Dynamically
>> choosing a register> > > Do you mean for the cond to be evaluated at
>> compile time in the> following?> > (def store-to-register (reg
>> val)> (cond (reg)> ((number-that-means-eax) (store eax val)
> No, it can't be compile time since val will live in a field in instances
> of MethodContext. I can't know what val is until runtime. What I
> really want is a way to store in memory or another register some kind of
> reference to a register so that I would have the option in my VM that a
> caller can request the answer put right into the literal register of his
> choice.
If you use some form of the traditional call/return sequence, have the
caller reserve a #return slot at a fixed location (offset). There the
callee can store its return value (you mentioned a way to store in
memory). Then the caller can pop/move the value into any register it
likes, dynamically and independent of the callee.
Cheers
Klaus
>> If so you could just generate:> (mov t1 eax)> > Then the register
>> allocator will try to allocate t1 in eax> and remove that move.> >
>> BryceIs there any documentation on your mid and low level code
>> generator? I would like to make a lisp-like language that targets it.
>> This way I wouldn't have to make a compiler for every processor type,
>> but I would have full power of the CPU and no dependencies on C.
> _________________________________________________________________
> See what you’re getting into…before you go there.
> http://newlivehotmail.com
More information about the Exupery
mailing list