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]

Re: [rtl]--call_insn, numbers of arguments


王 逸 wrote:
> 1. If the called function of a call_insn has arguments, then the PREV_INSN of this call_insn MUST be the SET insns used to evaluate the arguments.

Ordinarily, but there can be exceptions.  Some targets have call
patterns that expand to multiple instructions, so there could be
something in between the actual call instruction and the instructions
that load the arguments.

>    If there are n arguments, the previous n insns are all statements to evaluate the n arguments.

No.  Some arguments take more than one instruction to load.  Some may
not take any instructions to load (after optmization).  Also, some
arguments may require complicated instructions to load them, including
function calls.  So there can be a function call in the sequence of
instructions that are loading arguments.  Though of course, we can not
do that if a call would clobber the arguments of a pending call, it
varies from target to target whether this works.  It really only works
on targets that push arguments on the stack, which is some but not all
x86 targets.

> 2. After the rtl of a function is generated, and we get an rtx points to a call_insn in this functiion, can we determine the number of arguments of the called function? and how?

No.  This has been discussed in another thread already.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com


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