lightning
[Top][All Lists]
Advanced

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

[Lightning] Order of function arguments on mips


From: Paulo César Pereira de Andrade
Subject: [Lightning] Order of function arguments on mips
Date: Tue, 19 Oct 2010 22:32:31 -0200

  Hi,

  In the mips, the abi requires adjusting the stack offset even if not
passing argument
on it, and float/double arguments stored on the integer registers, or,
skipping the
equivalent integer registers for the float arguments.

  That is:
int argument registers:  a0, a1, a2, a3
float argument registers: f12, f13, f14, f15
two float registers make a double, and if the function does not have a
prototype,
should store a double in two integer registers. If passing an int argument in
register a0, the next float register is f13, and the stack offset is
also adjusted.

  But the problem is that double arguments must be aligned at 8 bytes,
and if passed
in registers, must be in a even register pair, e.g. a0+a1, but not a1+a2.

  The fact that double arguments must be aligned at 8 bytes, and
int/float arguments
are aligned at 4 bytes means that one cannot figure the stack and
registers usage
without knowing the order of the arguments; knowing if it is a varargs
would also be
important to avoid the need of passing floats in integer and float
registers (and maybe
storing in the stack also, just to make sure ...).

  What you suggest to avoid minimal problems with lightning?

  Maybe have a string format, e.g.:

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

  For the first set of tests, I created a simple rule of double
arguments must be
packed together and the last arguments (pushed first with lightning),
but it already
fails to generate code for some test cases when emitting code to print
error messages...

Thanks,
Paulo



reply via email to

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