function structure
Jim Wilson
wilson@specifixinc.com
Thu Jun 24 17:08:00 GMT 2004
Ãõ Ãà wrote:
> RTL representation of function-call insns looks like:
> (call (mem:fm addr) nbytes)
> here the nbytes refers to the number of bytes of arguments being passed to the subroutine.
See the documentation in gcc/gcc/doc/rtl.texi, search for "(call".
See the code in emit-call.c, search for GEN_CALL. Note that the value
passed in is rounded_stack_size_rtx which is a highly suggestive
variable name. You can look at the code a bit more to see exactly what
value this value is going to have.
> If this is wrong, please tell me how to determine whether a function has arguments, thanks.
If you have a tree, then try looking at DECL_ARGUMENTS. There is also
TYPE_ARG_TYPES (TREE_TYPE (function)), but that only works if you have a
prototype.
If you have RTL, then there is probably no safe and easy way to
determine this. You can try looking up the function decl from the
symbol_ref in the call, but you may not always have one. You can try
using the nargs field, but there is no guarantee that it will be
non-zero if there are arguments, though it may be for your target if all
arguments go on the stack.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com
More information about the Gcc
mailing list