You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
517 lines
29 KiB
HTML
517 lines
29 KiB
HTML
4 years ago
|
<html lang="en">
|
||
|
<head>
|
||
|
<title>Register Arguments - GNU Compiler Collection (GCC) Internals</title>
|
||
|
<meta http-equiv="Content-Type" content="text/html">
|
||
|
<meta name="description" content="GNU Compiler Collection (GCC) Internals">
|
||
|
<meta name="generator" content="makeinfo 4.13">
|
||
|
<link title="Top" rel="start" href="index.html#Top">
|
||
|
<link rel="up" href="Stack-and-Calling.html#Stack-and-Calling" title="Stack and Calling">
|
||
|
<link rel="prev" href="Stack-Arguments.html#Stack-Arguments" title="Stack Arguments">
|
||
|
<link rel="next" href="Scalar-Return.html#Scalar-Return" title="Scalar Return">
|
||
|
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
||
|
<!--
|
||
|
Copyright (C) 1988-2015 Free Software Foundation, Inc.
|
||
|
|
||
|
Permission is granted to copy, distribute and/or modify this document
|
||
|
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||
|
any later version published by the Free Software Foundation; with the
|
||
|
Invariant Sections being ``Funding Free Software'', the Front-Cover
|
||
|
Texts being (a) (see below), and with the Back-Cover Texts being (b)
|
||
|
(see below). A copy of the license is included in the section entitled
|
||
|
``GNU Free Documentation License''.
|
||
|
|
||
|
(a) The FSF's Front-Cover Text is:
|
||
|
|
||
|
A GNU Manual
|
||
|
|
||
|
(b) The FSF's Back-Cover Text is:
|
||
|
|
||
|
You have freedom to copy and modify this GNU Manual, like GNU
|
||
|
software. Copies published by the Free Software Foundation raise
|
||
|
funds for GNU development.-->
|
||
|
<meta http-equiv="Content-Style-Type" content="text/css">
|
||
|
<style type="text/css"><!--
|
||
|
pre.display { font-family:inherit }
|
||
|
pre.format { font-family:inherit }
|
||
|
pre.smalldisplay { font-family:inherit; font-size:smaller }
|
||
|
pre.smallformat { font-family:inherit; font-size:smaller }
|
||
|
pre.smallexample { font-size:smaller }
|
||
|
pre.smalllisp { font-size:smaller }
|
||
|
span.sc { font-variant:small-caps }
|
||
|
span.roman { font-family:serif; font-weight:normal; }
|
||
|
span.sansserif { font-family:sans-serif; font-weight:normal; }
|
||
|
--></style>
|
||
|
</head>
|
||
|
<body>
|
||
|
<div class="node">
|
||
|
<a name="Register-Arguments"></a>
|
||
|
<p>
|
||
|
Next: <a rel="next" accesskey="n" href="Scalar-Return.html#Scalar-Return">Scalar Return</a>,
|
||
|
Previous: <a rel="previous" accesskey="p" href="Stack-Arguments.html#Stack-Arguments">Stack Arguments</a>,
|
||
|
Up: <a rel="up" accesskey="u" href="Stack-and-Calling.html#Stack-and-Calling">Stack and Calling</a>
|
||
|
<hr>
|
||
|
</div>
|
||
|
|
||
|
<h4 class="subsection">17.9.7 Passing Arguments in Registers</h4>
|
||
|
|
||
|
<p><a name="index-arguments-in-registers-4228"></a><a name="index-registers-arguments-4229"></a>
|
||
|
This section describes the macros which let you control how various
|
||
|
types of arguments are passed in registers or how they are arranged in
|
||
|
the stack.
|
||
|
|
||
|
<div class="defun">
|
||
|
— Target Hook: rtx <b>TARGET_FUNCTION_ARG</b> (<var>cumulative_args_t ca, machine_mode mode, const_tree type, bool named</var>)<var><a name="index-TARGET_005fFUNCTION_005fARG-4230"></a></var><br>
|
||
|
<blockquote><p>Return an RTX indicating whether a function argument is passed in a
|
||
|
register and if so, which register.
|
||
|
|
||
|
<p>The arguments are <var>ca</var>, which summarizes all the previous
|
||
|
arguments; <var>mode</var>, the machine mode of the argument; <var>type</var>,
|
||
|
the data type of the argument as a tree node or 0 if that is not known
|
||
|
(which happens for C support library functions); and <var>named</var>,
|
||
|
which is <code>true</code> for an ordinary argument and <code>false</code> for
|
||
|
nameless arguments that correspond to ‘<samp><span class="samp">...</span></samp>’ in the called
|
||
|
function's prototype. <var>type</var> can be an incomplete type if a
|
||
|
syntax error has previously occurred.
|
||
|
|
||
|
<p>The return value is usually either a <code>reg</code> RTX for the hard
|
||
|
register in which to pass the argument, or zero to pass the argument
|
||
|
on the stack.
|
||
|
|
||
|
<p>The return value can be a <code>const_int</code> which means argument is
|
||
|
passed in a target specific slot with specified number. Target hooks
|
||
|
should be used to store or load argument in such case. See
|
||
|
<code>TARGET_STORE_BOUNDS_FOR_ARG</code> and <code>TARGET_LOAD_BOUNDS_FOR_ARG</code>
|
||
|
for more information.
|
||
|
|
||
|
<p>The value of the expression can also be a <code>parallel</code> RTX. This is
|
||
|
used when an argument is passed in multiple locations. The mode of the
|
||
|
<code>parallel</code> should be the mode of the entire argument. The
|
||
|
<code>parallel</code> holds any number of <code>expr_list</code> pairs; each one
|
||
|
describes where part of the argument is passed. In each
|
||
|
<code>expr_list</code> the first operand must be a <code>reg</code> RTX for the hard
|
||
|
register in which to pass this part of the argument, and the mode of the
|
||
|
register RTX indicates how large this part of the argument is. The
|
||
|
second operand of the <code>expr_list</code> is a <code>const_int</code> which gives
|
||
|
the offset in bytes into the entire argument of where this part starts.
|
||
|
As a special exception the first <code>expr_list</code> in the <code>parallel</code>
|
||
|
RTX may have a first operand of zero. This indicates that the entire
|
||
|
argument is also stored on the stack.
|
||
|
|
||
|
<p>The last time this hook is called, it is called with <code>MODE ==
|
||
|
VOIDmode</code>, and its result is passed to the <code>call</code> or <code>call_value</code>
|
||
|
pattern as operands 2 and 3 respectively.
|
||
|
|
||
|
<p><a name="index-g_t_0040file_007bstdarg_002eh_007d-and-register-arguments-4231"></a>The usual way to make the ISO library <samp><span class="file">stdarg.h</span></samp> work on a
|
||
|
machine where some arguments are usually passed in registers, is to
|
||
|
cause nameless arguments to be passed on the stack instead. This is
|
||
|
done by making <code>TARGET_FUNCTION_ARG</code> return 0 whenever
|
||
|
<var>named</var> is <code>false</code>.
|
||
|
|
||
|
<p><a name="index-g_t_0040code_007bTARGET_005fMUST_005fPASS_005fIN_005fSTACK_007d_002c-and-_0040code_007bTARGET_005fFUNCTION_005fARG_007d-4232"></a><a name="index-g_t_0040code_007bREG_005fPARM_005fSTACK_005fSPACE_007d_002c-and-_0040code_007bTARGET_005fFUNCTION_005fARG_007d-4233"></a>You may use the hook <code>targetm.calls.must_pass_in_stack</code>
|
||
|
in the definition of this macro to determine if this argument is of a
|
||
|
type that must be passed in the stack. If <code>REG_PARM_STACK_SPACE</code>
|
||
|
is not defined and <code>TARGET_FUNCTION_ARG</code> returns nonzero for such an
|
||
|
argument, the compiler will abort. If <code>REG_PARM_STACK_SPACE</code> is
|
||
|
defined, the argument will be computed in the stack and then loaded into
|
||
|
a register.
|
||
|
</p></blockquote></div>
|
||
|
|
||
|
<div class="defun">
|
||
|
— Target Hook: bool <b>TARGET_MUST_PASS_IN_STACK</b> (<var>machine_mode mode, const_tree type</var>)<var><a name="index-TARGET_005fMUST_005fPASS_005fIN_005fSTACK-4234"></a></var><br>
|
||
|
<blockquote><p>This target hook should return <code>true</code> if we should not pass <var>type</var>
|
||
|
solely in registers. The file <samp><span class="file">expr.h</span></samp> defines a
|
||
|
definition that is usually appropriate, refer to <samp><span class="file">expr.h</span></samp> for additional
|
||
|
documentation.
|
||
|
</p></blockquote></div>
|
||
|
|
||
|
<div class="defun">
|
||
|
— Target Hook: rtx <b>TARGET_FUNCTION_INCOMING_ARG</b> (<var>cumulative_args_t ca, machine_mode mode, const_tree type, bool named</var>)<var><a name="index-TARGET_005fFUNCTION_005fINCOMING_005fARG-4235"></a></var><br>
|
||
|
<blockquote><p>Define this hook if the target machine has “register windows”, so
|
||
|
that the register in which a function sees an arguments is not
|
||
|
necessarily the same as the one in which the caller passed the
|
||
|
argument.
|
||
|
|
||
|
<p>For such machines, <code>TARGET_FUNCTION_ARG</code> computes the register in
|
||
|
which the caller passes the value, and
|
||
|
<code>TARGET_FUNCTION_INCOMING_ARG</code> should be defined in a similar
|
||
|
fashion to tell the function being called where the arguments will
|
||
|
arrive.
|
||
|
|
||
|
<p>If <code>TARGET_FUNCTION_INCOMING_ARG</code> is not defined,
|
||
|
<code>TARGET_FUNCTION_ARG</code> serves both purposes.
|
||
|
</p></blockquote></div>
|
||
|
|
||
|
<div class="defun">
|
||
|
— Target Hook: bool <b>TARGET_USE_PSEUDO_PIC_REG</b> (<var>void</var>)<var><a name="index-TARGET_005fUSE_005fPSEUDO_005fPIC_005fREG-4236"></a></var><br>
|
||
|
<blockquote><p>This hook should return 1 in case pseudo register should be created
|
||
|
for pic_offset_table_rtx during function expand.
|
||
|
</p></blockquote></div>
|
||
|
|
||
|
<div class="defun">
|
||
|
— Target Hook: void <b>TARGET_INIT_PIC_REG</b> (<var>void</var>)<var><a name="index-TARGET_005fINIT_005fPIC_005fREG-4237"></a></var><br>
|
||
|
<blockquote><p>Perform a target dependent initialization of pic_offset_table_rtx.
|
||
|
This hook is called at the start of register allocation.
|
||
|
</p></blockquote></div>
|
||
|
|
||
|
<div class="defun">
|
||
|
— Target Hook: int <b>TARGET_ARG_PARTIAL_BYTES</b> (<var>cumulative_args_t cum, machine_mode mode, tree type, bool named</var>)<var><a name="index-TARGET_005fARG_005fPARTIAL_005fBYTES-4238"></a></var><br>
|
||
|
<blockquote><p>This target hook returns the number of bytes at the beginning of an
|
||
|
argument that must be put in registers. The value must be zero for
|
||
|
arguments that are passed entirely in registers or that are entirely
|
||
|
pushed on the stack.
|
||
|
|
||
|
<p>On some machines, certain arguments must be passed partially in
|
||
|
registers and partially in memory. On these machines, typically the
|
||
|
first few words of arguments are passed in registers, and the rest
|
||
|
on the stack. If a multi-word argument (a <code>double</code> or a
|
||
|
structure) crosses that boundary, its first few words must be passed
|
||
|
in registers and the rest must be pushed. This macro tells the
|
||
|
compiler when this occurs, and how many bytes should go in registers.
|
||
|
|
||
|
<p><code>TARGET_FUNCTION_ARG</code> for these arguments should return the first
|
||
|
register to be used by the caller for this argument; likewise
|
||
|
<code>TARGET_FUNCTION_INCOMING_ARG</code>, for the called function.
|
||
|
</p></blockquote></div>
|
||
|
|
||
|
<div class="defun">
|
||
|
— Target Hook: bool <b>TARGET_PASS_BY_REFERENCE</b> (<var>cumulative_args_t cum, machine_mode mode, const_tree type, bool named</var>)<var><a name="index-TARGET_005fPASS_005fBY_005fREFERENCE-4239"></a></var><br>
|
||
|
<blockquote><p>This target hook should return <code>true</code> if an argument at the
|
||
|
position indicated by <var>cum</var> should be passed by reference. This
|
||
|
predicate is queried after target independent reasons for being
|
||
|
passed by reference, such as <code>TREE_ADDRESSABLE (type)</code>.
|
||
|
|
||
|
<p>If the hook returns true, a copy of that argument is made in memory and a
|
||
|
pointer to the argument is passed instead of the argument itself.
|
||
|
The pointer is passed in whatever way is appropriate for passing a pointer
|
||
|
to that type.
|
||
|
</p></blockquote></div>
|
||
|
|
||
|
<div class="defun">
|
||
|
— Target Hook: bool <b>TARGET_CALLEE_COPIES</b> (<var>cumulative_args_t cum, machine_mode mode, const_tree type, bool named</var>)<var><a name="index-TARGET_005fCALLEE_005fCOPIES-4240"></a></var><br>
|
||
|
<blockquote><p>The function argument described by the parameters to this hook is
|
||
|
known to be passed by reference. The hook should return true if the
|
||
|
function argument should be copied by the callee instead of copied
|
||
|
by the caller.
|
||
|
|
||
|
<p>For any argument for which the hook returns true, if it can be
|
||
|
determined that the argument is not modified, then a copy need
|
||
|
not be generated.
|
||
|
|
||
|
<p>The default version of this hook always returns false.
|
||
|
</p></blockquote></div>
|
||
|
|
||
|
<div class="defun">
|
||
|
— Macro: <b>CUMULATIVE_ARGS</b><var><a name="index-CUMULATIVE_005fARGS-4241"></a></var><br>
|
||
|
<blockquote><p>A C type for declaring a variable that is used as the first argument
|
||
|
of <code>TARGET_FUNCTION_ARG</code> and other related values. For some
|
||
|
target machines, the type <code>int</code> suffices and can hold the number
|
||
|
of bytes of argument so far.
|
||
|
|
||
|
<p>There is no need to record in <code>CUMULATIVE_ARGS</code> anything about the
|
||
|
arguments that have been passed on the stack. The compiler has other
|
||
|
variables to keep track of that. For target machines on which all
|
||
|
arguments are passed on the stack, there is no need to store anything in
|
||
|
<code>CUMULATIVE_ARGS</code>; however, the data structure must exist and
|
||
|
should not be empty, so use <code>int</code>.
|
||
|
</p></blockquote></div>
|
||
|
|
||
|
<div class="defun">
|
||
|
— Macro: <b>OVERRIDE_ABI_FORMAT</b> (<var>fndecl</var>)<var><a name="index-OVERRIDE_005fABI_005fFORMAT-4242"></a></var><br>
|
||
|
<blockquote><p>If defined, this macro is called before generating any code for a
|
||
|
function, but after the <var>cfun</var> descriptor for the function has been
|
||
|
created. The back end may use this macro to update <var>cfun</var> to
|
||
|
reflect an ABI other than that which would normally be used by default.
|
||
|
If the compiler is generating code for a compiler-generated function,
|
||
|
<var>fndecl</var> may be <code>NULL</code>.
|
||
|
</p></blockquote></div>
|
||
|
|
||
|
<div class="defun">
|
||
|
— Macro: <b>INIT_CUMULATIVE_ARGS</b> (<var>cum, fntype, libname, fndecl, n_named_args</var>)<var><a name="index-INIT_005fCUMULATIVE_005fARGS-4243"></a></var><br>
|
||
|
<blockquote><p>A C statement (sans semicolon) for initializing the variable
|
||
|
<var>cum</var> for the state at the beginning of the argument list. The
|
||
|
variable has type <code>CUMULATIVE_ARGS</code>. The value of <var>fntype</var>
|
||
|
is the tree node for the data type of the function which will receive
|
||
|
the args, or 0 if the args are to a compiler support library function.
|
||
|
For direct calls that are not libcalls, <var>fndecl</var> contain the
|
||
|
declaration node of the function. <var>fndecl</var> is also set when
|
||
|
<code>INIT_CUMULATIVE_ARGS</code> is used to find arguments for the function
|
||
|
being compiled. <var>n_named_args</var> is set to the number of named
|
||
|
arguments, including a structure return address if it is passed as a
|
||
|
parameter, when making a call. When processing incoming arguments,
|
||
|
<var>n_named_args</var> is set to −1.
|
||
|
|
||
|
<p>When processing a call to a compiler support library function,
|
||
|
<var>libname</var> identifies which one. It is a <code>symbol_ref</code> rtx which
|
||
|
contains the name of the function, as a string. <var>libname</var> is 0 when
|
||
|
an ordinary C function call is being processed. Thus, each time this
|
||
|
macro is called, either <var>libname</var> or <var>fntype</var> is nonzero, but
|
||
|
never both of them at once.
|
||
|
</p></blockquote></div>
|
||
|
|
||
|
<div class="defun">
|
||
|
— Macro: <b>INIT_CUMULATIVE_LIBCALL_ARGS</b> (<var>cum, mode, libname</var>)<var><a name="index-INIT_005fCUMULATIVE_005fLIBCALL_005fARGS-4244"></a></var><br>
|
||
|
<blockquote><p>Like <code>INIT_CUMULATIVE_ARGS</code> but only used for outgoing libcalls,
|
||
|
it gets a <code>MODE</code> argument instead of <var>fntype</var>, that would be
|
||
|
<code>NULL</code>. <var>indirect</var> would always be zero, too. If this macro
|
||
|
is not defined, <code>INIT_CUMULATIVE_ARGS (cum, NULL_RTX, libname,
|
||
|
0)</code> is used instead.
|
||
|
</p></blockquote></div>
|
||
|
|
||
|
<div class="defun">
|
||
|
— Macro: <b>INIT_CUMULATIVE_INCOMING_ARGS</b> (<var>cum, fntype, libname</var>)<var><a name="index-INIT_005fCUMULATIVE_005fINCOMING_005fARGS-4245"></a></var><br>
|
||
|
<blockquote><p>Like <code>INIT_CUMULATIVE_ARGS</code> but overrides it for the purposes of
|
||
|
finding the arguments for the function being compiled. If this macro is
|
||
|
undefined, <code>INIT_CUMULATIVE_ARGS</code> is used instead.
|
||
|
|
||
|
<p>The value passed for <var>libname</var> is always 0, since library routines
|
||
|
with special calling conventions are never compiled with GCC. The
|
||
|
argument <var>libname</var> exists for symmetry with
|
||
|
<code>INIT_CUMULATIVE_ARGS</code>.
|
||
|
<!-- could use "this macro" in place of @code{INIT_CUMULATIVE_ARGS}, maybe. -->
|
||
|
<!-- mew 5feb93 i switched the order of the sentences. -mew 10feb93 -->
|
||
|
</p></blockquote></div>
|
||
|
|
||
|
<div class="defun">
|
||
|
— Target Hook: void <b>TARGET_FUNCTION_ARG_ADVANCE</b> (<var>cumulative_args_t ca, machine_mode mode, const_tree type, bool named</var>)<var><a name="index-TARGET_005fFUNCTION_005fARG_005fADVANCE-4246"></a></var><br>
|
||
|
<blockquote><p>This hook updates the summarizer variable pointed to by <var>ca</var> to
|
||
|
advance past an argument in the argument list. The values <var>mode</var>,
|
||
|
<var>type</var> and <var>named</var> describe that argument. Once this is done,
|
||
|
the variable <var>cum</var> is suitable for analyzing the <em>following</em>
|
||
|
argument with <code>TARGET_FUNCTION_ARG</code>, etc.
|
||
|
|
||
|
<p>This hook need not do anything if the argument in question was passed
|
||
|
on the stack. The compiler knows how to track the amount of stack space
|
||
|
used for arguments without any special help.
|
||
|
</p></blockquote></div>
|
||
|
|
||
|
<div class="defun">
|
||
|
— Macro: <b>FUNCTION_ARG_OFFSET</b> (<var>mode, type</var>)<var><a name="index-FUNCTION_005fARG_005fOFFSET-4247"></a></var><br>
|
||
|
<blockquote><p>If defined, a C expression that is the number of bytes to add to the
|
||
|
offset of the argument passed in memory. This is needed for the SPU,
|
||
|
which passes <code>char</code> and <code>short</code> arguments in the preferred
|
||
|
slot that is in the middle of the quad word instead of starting at the
|
||
|
top.
|
||
|
</p></blockquote></div>
|
||
|
|
||
|
<div class="defun">
|
||
|
— Macro: <b>FUNCTION_ARG_PADDING</b> (<var>mode, type</var>)<var><a name="index-FUNCTION_005fARG_005fPADDING-4248"></a></var><br>
|
||
|
<blockquote><p>If defined, a C expression which determines whether, and in which direction,
|
||
|
to pad out an argument with extra space. The value should be of type
|
||
|
<code>enum direction</code>: either <code>upward</code> to pad above the argument,
|
||
|
<code>downward</code> to pad below, or <code>none</code> to inhibit padding.
|
||
|
|
||
|
<p>The <em>amount</em> of padding is not controlled by this macro, but by the
|
||
|
target hook <code>TARGET_FUNCTION_ARG_ROUND_BOUNDARY</code>. It is
|
||
|
always just enough to reach the next multiple of that boundary.
|
||
|
|
||
|
<p>This macro has a default definition which is right for most systems.
|
||
|
For little-endian machines, the default is to pad upward. For
|
||
|
big-endian machines, the default is to pad downward for an argument of
|
||
|
constant size shorter than an <code>int</code>, and upward otherwise.
|
||
|
</p></blockquote></div>
|
||
|
|
||
|
<div class="defun">
|
||
|
— Macro: <b>PAD_VARARGS_DOWN</b><var><a name="index-PAD_005fVARARGS_005fDOWN-4249"></a></var><br>
|
||
|
<blockquote><p>If defined, a C expression which determines whether the default
|
||
|
implementation of va_arg will attempt to pad down before reading the
|
||
|
next argument, if that argument is smaller than its aligned space as
|
||
|
controlled by <code>PARM_BOUNDARY</code>. If this macro is not defined, all such
|
||
|
arguments are padded down if <code>BYTES_BIG_ENDIAN</code> is true.
|
||
|
</p></blockquote></div>
|
||
|
|
||
|
<div class="defun">
|
||
|
— Macro: <b>BLOCK_REG_PADDING</b> (<var>mode, type, first</var>)<var><a name="index-BLOCK_005fREG_005fPADDING-4250"></a></var><br>
|
||
|
<blockquote><p>Specify padding for the last element of a block move between registers and
|
||
|
memory. <var>first</var> is nonzero if this is the only element. Defining this
|
||
|
macro allows better control of register function parameters on big-endian
|
||
|
machines, without using <code>PARALLEL</code> rtl. In particular,
|
||
|
<code>MUST_PASS_IN_STACK</code> need not test padding and mode of types in
|
||
|
registers, as there is no longer a "wrong" part of a register; For example,
|
||
|
a three byte aggregate may be passed in the high part of a register if so
|
||
|
required.
|
||
|
</p></blockquote></div>
|
||
|
|
||
|
<div class="defun">
|
||
|
— Target Hook: unsigned int <b>TARGET_FUNCTION_ARG_BOUNDARY</b> (<var>machine_mode mode, const_tree type</var>)<var><a name="index-TARGET_005fFUNCTION_005fARG_005fBOUNDARY-4251"></a></var><br>
|
||
|
<blockquote><p>This hook returns the alignment boundary, in bits, of an argument
|
||
|
with the specified mode and type. The default hook returns
|
||
|
<code>PARM_BOUNDARY</code> for all arguments.
|
||
|
</p></blockquote></div>
|
||
|
|
||
|
<div class="defun">
|
||
|
— Target Hook: unsigned int <b>TARGET_FUNCTION_ARG_ROUND_BOUNDARY</b> (<var>machine_mode mode, const_tree type</var>)<var><a name="index-TARGET_005fFUNCTION_005fARG_005fROUND_005fBOUNDARY-4252"></a></var><br>
|
||
|
<blockquote><p>Normally, the size of an argument is rounded up to <code>PARM_BOUNDARY</code>,
|
||
|
which is the default value for this hook. You can define this hook to
|
||
|
return a different value if an argument size must be rounded to a larger
|
||
|
value.
|
||
|
</p></blockquote></div>
|
||
|
|
||
|
<div class="defun">
|
||
|
— Macro: <b>FUNCTION_ARG_REGNO_P</b> (<var>regno</var>)<var><a name="index-FUNCTION_005fARG_005fREGNO_005fP-4253"></a></var><br>
|
||
|
<blockquote><p>A C expression that is nonzero if <var>regno</var> is the number of a hard
|
||
|
register in which function arguments are sometimes passed. This does
|
||
|
<em>not</em> include implicit arguments such as the static chain and
|
||
|
the structure-value address. On many machines, no registers can be
|
||
|
used for this purpose since all function arguments are pushed on the
|
||
|
stack.
|
||
|
</p></blockquote></div>
|
||
|
|
||
|
<div class="defun">
|
||
|
— Target Hook: bool <b>TARGET_SPLIT_COMPLEX_ARG</b> (<var>const_tree type</var>)<var><a name="index-TARGET_005fSPLIT_005fCOMPLEX_005fARG-4254"></a></var><br>
|
||
|
<blockquote><p>This hook should return true if parameter of type <var>type</var> are passed
|
||
|
as two scalar parameters. By default, GCC will attempt to pack complex
|
||
|
arguments into the target's word size. Some ABIs require complex arguments
|
||
|
to be split and treated as their individual components. For example, on
|
||
|
AIX64, complex floats should be passed in a pair of floating point
|
||
|
registers, even though a complex float would fit in one 64-bit floating
|
||
|
point register.
|
||
|
|
||
|
<p>The default value of this hook is <code>NULL</code>, which is treated as always
|
||
|
false.
|
||
|
</p></blockquote></div>
|
||
|
|
||
|
<div class="defun">
|
||
|
— Target Hook: tree <b>TARGET_BUILD_BUILTIN_VA_LIST</b> (<var>void</var>)<var><a name="index-TARGET_005fBUILD_005fBUILTIN_005fVA_005fLIST-4255"></a></var><br>
|
||
|
<blockquote><p>This hook returns a type node for <code>va_list</code> for the target.
|
||
|
The default version of the hook returns <code>void*</code>.
|
||
|
</p></blockquote></div>
|
||
|
|
||
|
<div class="defun">
|
||
|
— Target Hook: int <b>TARGET_ENUM_VA_LIST_P</b> (<var>int idx, const char **pname, tree *ptree</var>)<var><a name="index-TARGET_005fENUM_005fVA_005fLIST_005fP-4256"></a></var><br>
|
||
|
<blockquote><p>This target hook is used in function <code>c_common_nodes_and_builtins</code>
|
||
|
to iterate through the target specific builtin types for va_list. The
|
||
|
variable <var>idx</var> is used as iterator. <var>pname</var> has to be a pointer
|
||
|
to a <code>const char *</code> and <var>ptree</var> a pointer to a <code>tree</code> typed
|
||
|
variable.
|
||
|
The arguments <var>pname</var> and <var>ptree</var> are used to store the result of
|
||
|
this macro and are set to the name of the va_list builtin type and its
|
||
|
internal type.
|
||
|
If the return value of this macro is zero, then there is no more element.
|
||
|
Otherwise the <var>IDX</var> should be increased for the next call of this
|
||
|
macro to iterate through all types.
|
||
|
</p></blockquote></div>
|
||
|
|
||
|
<div class="defun">
|
||
|
— Target Hook: tree <b>TARGET_FN_ABI_VA_LIST</b> (<var>tree fndecl</var>)<var><a name="index-TARGET_005fFN_005fABI_005fVA_005fLIST-4257"></a></var><br>
|
||
|
<blockquote><p>This hook returns the va_list type of the calling convention specified by
|
||
|
<var>fndecl</var>.
|
||
|
The default version of this hook returns <code>va_list_type_node</code>.
|
||
|
</p></blockquote></div>
|
||
|
|
||
|
<div class="defun">
|
||
|
— Target Hook: tree <b>TARGET_CANONICAL_VA_LIST_TYPE</b> (<var>tree type</var>)<var><a name="index-TARGET_005fCANONICAL_005fVA_005fLIST_005fTYPE-4258"></a></var><br>
|
||
|
<blockquote><p>This hook returns the va_list type of the calling convention specified by the
|
||
|
type of <var>type</var>. If <var>type</var> is not a valid va_list type, it returns
|
||
|
<code>NULL_TREE</code>.
|
||
|
</p></blockquote></div>
|
||
|
|
||
|
<div class="defun">
|
||
|
— Target Hook: tree <b>TARGET_GIMPLIFY_VA_ARG_EXPR</b> (<var>tree valist, tree type, gimple_seq *pre_p, gimple_seq *post_p</var>)<var><a name="index-TARGET_005fGIMPLIFY_005fVA_005fARG_005fEXPR-4259"></a></var><br>
|
||
|
<blockquote><p>This hook performs target-specific gimplification of
|
||
|
<code>VA_ARG_EXPR</code>. The first two parameters correspond to the
|
||
|
arguments to <code>va_arg</code>; the latter two are as in
|
||
|
<code>gimplify.c:gimplify_expr</code>.
|
||
|
</p></blockquote></div>
|
||
|
|
||
|
<div class="defun">
|
||
|
— Target Hook: bool <b>TARGET_VALID_POINTER_MODE</b> (<var>machine_mode mode</var>)<var><a name="index-TARGET_005fVALID_005fPOINTER_005fMODE-4260"></a></var><br>
|
||
|
<blockquote><p>Define this to return nonzero if the port can handle pointers
|
||
|
with machine mode <var>mode</var>. The default version of this
|
||
|
hook returns true for both <code>ptr_mode</code> and <code>Pmode</code>.
|
||
|
</p></blockquote></div>
|
||
|
|
||
|
<div class="defun">
|
||
|
— Target Hook: bool <b>TARGET_REF_MAY_ALIAS_ERRNO</b> (<var>struct ao_ref *ref</var>)<var><a name="index-TARGET_005fREF_005fMAY_005fALIAS_005fERRNO-4261"></a></var><br>
|
||
|
<blockquote><p>Define this to return nonzero if the memory reference <var>ref</var> may alias with the system C library errno location. The default version of this hook assumes the system C library errno location is either a declaration of type int or accessed by dereferencing a pointer to int.
|
||
|
</p></blockquote></div>
|
||
|
|
||
|
<div class="defun">
|
||
|
— Target Hook: bool <b>TARGET_SCALAR_MODE_SUPPORTED_P</b> (<var>machine_mode mode</var>)<var><a name="index-TARGET_005fSCALAR_005fMODE_005fSUPPORTED_005fP-4262"></a></var><br>
|
||
|
<blockquote><p>Define this to return nonzero if the port is prepared to handle
|
||
|
insns involving scalar mode <var>mode</var>. For a scalar mode to be
|
||
|
considered supported, all the basic arithmetic and comparisons
|
||
|
must work.
|
||
|
|
||
|
<p>The default version of this hook returns true for any mode
|
||
|
required to handle the basic C types (as defined by the port).
|
||
|
Included here are the double-word arithmetic supported by the
|
||
|
code in <samp><span class="file">optabs.c</span></samp>.
|
||
|
</p></blockquote></div>
|
||
|
|
||
|
<div class="defun">
|
||
|
— Target Hook: bool <b>TARGET_VECTOR_MODE_SUPPORTED_P</b> (<var>machine_mode mode</var>)<var><a name="index-TARGET_005fVECTOR_005fMODE_005fSUPPORTED_005fP-4263"></a></var><br>
|
||
|
<blockquote><p>Define this to return nonzero if the port is prepared to handle
|
||
|
insns involving vector mode <var>mode</var>. At the very least, it
|
||
|
must have move patterns for this mode.
|
||
|
</p></blockquote></div>
|
||
|
|
||
|
<div class="defun">
|
||
|
— Target Hook: bool <b>TARGET_ARRAY_MODE_SUPPORTED_P</b> (<var>machine_mode mode, unsigned HOST_WIDE_INT nelems</var>)<var><a name="index-TARGET_005fARRAY_005fMODE_005fSUPPORTED_005fP-4264"></a></var><br>
|
||
|
<blockquote><p>Return true if GCC should try to use a scalar mode to store an array
|
||
|
of <var>nelems</var> elements, given that each element has mode <var>mode</var>.
|
||
|
Returning true here overrides the usual <code>MAX_FIXED_MODE</code> limit
|
||
|
and allows GCC to use any defined integer mode.
|
||
|
|
||
|
<p>One use of this hook is to support vector load and store operations
|
||
|
that operate on several homogeneous vectors. For example, ARM NEON
|
||
|
has operations like:
|
||
|
|
||
|
<pre class="smallexample"> int8x8x3_t vld3_s8 (const int8_t *)
|
||
|
</pre>
|
||
|
<p>where the return type is defined as:
|
||
|
|
||
|
<pre class="smallexample"> typedef struct int8x8x3_t
|
||
|
{
|
||
|
int8x8_t val[3];
|
||
|
} int8x8x3_t;
|
||
|
</pre>
|
||
|
<p>If this hook allows <code>val</code> to have a scalar mode, then
|
||
|
<code>int8x8x3_t</code> can have the same mode. GCC can then store
|
||
|
<code>int8x8x3_t</code>s in registers rather than forcing them onto the stack.
|
||
|
</p></blockquote></div>
|
||
|
|
||
|
<div class="defun">
|
||
|
— Target Hook: bool <b>TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P</b> (<var>machine_mode mode</var>)<var><a name="index-TARGET_005fLIBGCC_005fFLOATING_005fMODE_005fSUPPORTED_005fP-4265"></a></var><br>
|
||
|
<blockquote><p>Define this to return nonzero if libgcc provides support for the
|
||
|
floating-point mode <var>mode</var>, which is known to pass
|
||
|
<code>TARGET_SCALAR_MODE_SUPPORTED_P</code>. The default version of this
|
||
|
hook returns true for all of <code>SFmode</code>, <code>DFmode</code>,
|
||
|
<code>XFmode</code> and <code>TFmode</code>, if such modes exist.
|
||
|
</p></blockquote></div>
|
||
|
|
||
|
<div class="defun">
|
||
|
— Target Hook: bool <b>TARGET_SMALL_REGISTER_CLASSES_FOR_MODE_P</b> (<var>machine_mode mode</var>)<var><a name="index-TARGET_005fSMALL_005fREGISTER_005fCLASSES_005fFOR_005fMODE_005fP-4266"></a></var><br>
|
||
|
<blockquote><p>Define this to return nonzero for machine modes for which the port has
|
||
|
small register classes. If this target hook returns nonzero for a given
|
||
|
<var>mode</var>, the compiler will try to minimize the lifetime of registers
|
||
|
in <var>mode</var>. The hook may be called with <code>VOIDmode</code> as argument.
|
||
|
In this case, the hook is expected to return nonzero if it returns nonzero
|
||
|
for any mode.
|
||
|
|
||
|
<p>On some machines, it is risky to let hard registers live across arbitrary
|
||
|
insns. Typically, these machines have instructions that require values
|
||
|
to be in specific registers (like an accumulator), and reload will fail
|
||
|
if the required hard register is used for another purpose across such an
|
||
|
insn.
|
||
|
|
||
|
<p>Passes before reload do not know which hard registers will be used
|
||
|
in an instruction, but the machine modes of the registers set or used in
|
||
|
the instruction are already known. And for some machines, register
|
||
|
classes are small for, say, integer registers but not for floating point
|
||
|
registers. For example, the AMD x86-64 architecture requires specific
|
||
|
registers for the legacy x86 integer instructions, but there are many
|
||
|
SSE registers for floating point operations. On such targets, a good
|
||
|
strategy may be to return nonzero from this hook for <code>INTEGRAL_MODE_P</code>
|
||
|
machine modes but zero for the SSE register classes.
|
||
|
|
||
|
<p>The default version of this hook returns false for any mode. It is always
|
||
|
safe to redefine this hook to return with a nonzero value. But if you
|
||
|
unnecessarily define it, you will reduce the amount of optimizations
|
||
|
that can be performed in some cases. If you do not define this hook
|
||
|
to return a nonzero value when it is required, the compiler will run out
|
||
|
of spill registers and print a fatal error message.
|
||
|
</p></blockquote></div>
|
||
|
|
||
|
</body></html>
|
||
|
|