lightning
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Lightning] Order of function arguments on mips


From: Paolo Bonzini
Subject: Re: [Lightning] Order of function arguments on mips
Date: Wed, 20 Oct 2010 20:09:25 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100907 Fedora/3.1.3-1.fc13 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.3

On 10/20/2010 09:35 AM, Paulo César Pereira de Andrade wrote:
Em 20 de outubro de 2010 04:32, Paolo Bonzini<address@hidden>  escreveu:
On 10/20/2010 02:32 AM, Paulo César Pereira de Andrade wrote:

   What you suggest to avoid minimal problems with lightning?

_jit_prepare("dfii")
to be understood as:
<unkown_return_type>    function(double, float, int, int);

While it is a bit long, maybe

  jit_prepare_d(1);
  jit_prepare_f(1);
  jit_prepare_i(2);

would "just work"?

   If there are no jit_pusharg calls in between, it could be an
option.

Yes, however you need space in _jit to store the offsets, because these are computed from the first argument while the arguments are pushed starting from the last.

Suppose you have

       prepare_p 1
       prepare_d 1
       prepare_i 1
       prepare_d 1
       prepare_i 1

At this point you know that the space on the stack will be 40 bytes, and the "next offset" is 36.

Then...

     prepare 3
     prepare_d 2
         movi_i %r0 4

... this decrements the next offset by 4, and places "4" at $sp[32-35].

         pusharg_i %r0
         movi_d %f0 3.0
         pusharg_d %f0

... this decrements the next offset by 8, places "3.0" and $sp[24].

        movi_i %r0 2
        pusharg_i %r0

Now there's no way (without storing all the offsets) to know if the next argument should be at 20-23 or 16-19.

With the full list of arguments stored in _jit, it can work. I prefer this to your proposal (a string like "pdidi"), because anyway the offsets have to be computed (you cannot just use the format stirng in pusharg_x). The format string can be implemented in your assembler or in general at a higher layer than lightning.

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]