This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Function argument passing


Hello all,

I am doing a port for a private target in GCC 4.4.0. It generates code
for both little & big endian.

The ABI for the target is as follows:

1. All arguments passed in stack are passed using their alignment constrains.
Solution: For this to happen no argument promotion should be done.

2. Functions with a variable number of arguments pass the last fixed
argument and all subsequent variable arguments on the stack. Such
arguments of fewer than 4 bytes are located on the stack as if the
argument had been promoted to 32 bits.

Solution:
For TARGET_STRICT_ARGUMENT_NAMING the internals says the following :

This hook controls how the named argument to FUNCTION_ARG is set for
varargs and stdarg functions. If this hook returns true, the named
argument is always true for named arguments, and false for unnamed
arguments. If it returns false, but
TARGET_PRETEND_OUTGOING_VARARGS_NAMED returns true, then all arguments
are treated as named. Otherwise, all named arguments except the last
are treated as named.

So i made both TARGET_STRICT_ARGUMENT_NAMING and
PRETEND_OUTGOING_VARARGS_NAMED to return false. Is this correct?

How to make the varargs argument to be promoted to 32bits when the
normal argument don't require promotion as mentioned in point (1) ?

3. A function returning a structure or union receives in D0 the
address of the returned structure or union. The caller allocates space
for the returned object.
Solution: Used TARGET_FUNCTION_VALUE and returned D0 reg_rtx for
structure and unions.

4. A long long return value is returned in R6 and R7, R6 containing
the most significant  long word and R7 containing the least
significant long word, regardless of the endianess mode.
Solution: Used TARGET_RETURN_IN_MSB to return true when the mode is
little endian

5. If the first argument is a long long , it is passed in R6 and R7,
R6 containing the most significant long word and R7 containing the
least significant long word, regardless of the endianess mode.
For return value, i have done as mentioned in (4) but I am not sure
how to control the argument passing so that R6 contains the msw and R7
contains lsw, regardless of the endianess mode.


Regards,
Shafi


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]