9515 lines
452 KiB
HTML
9515 lines
452 KiB
HTML
<HTML>
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<!-- Created on March, 17 2001 by texi2html 1.64 -->
|
|
<!--
|
|
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
|
|
Karl Berry <karl@freefriends.org>
|
|
Olaf Bachmann <obachman@mathematik.uni-kl.de>
|
|
and many others.
|
|
Maintained by: Olaf Bachmann <obachman@mathematik.uni-kl.de>
|
|
Send bugs and suggestions to <texi2html@mathematik.uni-kl.de>
|
|
|
|
-->
|
|
<HEAD>
|
|
<TITLE>Using and Porting the GNU Compiler Collection (GCC): Target Macros</TITLE>
|
|
|
|
<META NAME="description" CONTENT="Using and Porting the GNU Compiler Collection (GCC): Target Macros">
|
|
<META NAME="keywords" CONTENT="Using and Porting the GNU Compiler Collection (GCC): Target Macros">
|
|
<META NAME="resource-type" CONTENT="document">
|
|
<META NAME="distribution" CONTENT="global">
|
|
<META NAME="Generator" CONTENT="texi2html 1.64">
|
|
|
|
</HEAD>
|
|
|
|
<BODY LANG="" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000">
|
|
|
|
<A NAME="SEC199"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_16.html#SEC198" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_16.html#SEC198"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC200" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC200"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_2.html#SEC2" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_2.html#SEC2"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_18.html#SEC251" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_18.html#SEC251"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H1> 17. Target Description Macros </H1>
|
|
<!--docid::SEC199::-->
|
|
<P>
|
|
|
|
In addition to the file <TT>`<VAR>machine</VAR>.md'</TT>, a machine description
|
|
includes a C header file conventionally given the name
|
|
<TT>`<VAR>machine</VAR>.h'</TT>. This header file defines numerous macros
|
|
that convey the information about the target machine that does not fit
|
|
into the scheme of the <TT>`.md'</TT> file. The file <TT>`tm.h'</TT> should be
|
|
a link to <TT>`<VAR>machine</VAR>.h'</TT>. The header file <TT>`config.h'</TT>
|
|
includes <TT>`tm.h'</TT> and most compiler source files include
|
|
<TT>`config.h'</TT>.
|
|
</P><P>
|
|
|
|
<BLOCKQUOTE><TABLE BORDER=0 CELLSPACING=0>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC200" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC200">17.1 Controlling the Compilation Driver, <TT>`gcc'</TT></A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">Controlling how the driver runs the compilation passes.</TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC201" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC201">17.2 Run-time Target Specification</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">Defining <SAMP>`-m'</SAMP> options like <SAMP>`-m68000'</SAMP> and <SAMP>`-m68020'</SAMP>.</TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC202" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC202">17.3 Storage Layout</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">Defining sizes and alignments of data.</TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC203" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC203">17.4 Layout of Source Language Data Types</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">Defining sizes and properties of basic user data types.</TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC204" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC204">17.5 Register Usage</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">Naming and describing the hardware registers.</TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC211" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC211">17.6 Register Classes</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">Defining the classes of hardware registers.</TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC212" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC212">17.7 Stack Layout and Calling Conventions</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">Defining which way the stack grows and by how much.</TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC224" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC224">17.8 Implementing the Varargs Macros</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">Defining the varargs macros.</TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC225" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC225">17.9 Trampolines for Nested Functions</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">Code set up at run time to enter a nested function.</TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC226" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC226">17.10 Implicit Calls to Library Routines</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">Controlling how library routines are implicitly called.</TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC227" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC227">17.11 Addressing Modes</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">Defining addressing modes valid for memory operands.</TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC228" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC228">17.12 Condition Code Status</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">Defining how insns update the condition code.</TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC229" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC229">17.13 Describing Relative Costs of Operations</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">Defining relative costs of different operations.</TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC230" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC230">17.14 Dividing the Output into Sections (Texts, Data, <small>...</small>)</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">Dividing storage into text, data, and other sections.</TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC231" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC231">17.15 Position Independent Code</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">Macros for position independent code.</TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC232" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC232">17.16 Defining the Output Assembler Language</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">Defining how to write insns and pseudo-ops to output.</TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC243" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC243">17.17 Controlling Debugging Information Format</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">Defining the format of debugging output.</TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC249" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC249">17.18 Cross Compilation and Floating Point</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">Handling floating point for cross-compilers.</TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC250" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC250">17.19 Miscellaneous Parameters</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">Everything else.</TD></TR>
|
|
</TABLE></BLOCKQUOTE>
|
|
<P>
|
|
|
|
<A NAME="Driver"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC200"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC199" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC199"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC201" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC201"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC199" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC199"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC199" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC199"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_18.html#SEC251" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_18.html#SEC251"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H2> 17.1 Controlling the Compilation Driver, <TT>`gcc'</TT> </H2>
|
|
<!--docid::SEC200::-->
|
|
<P>
|
|
|
|
You can control the compilation driver.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1130"></A>
|
|
<DT><CODE>SWITCH_TAKES_ARG (<VAR>char</VAR>)</CODE>
|
|
<DD>A C expression which determines whether the option <SAMP>`-<VAR>char</VAR>'</SAMP>
|
|
takes arguments. The value should be the number of arguments that
|
|
option takes--zero, for many options.
|
|
<P>
|
|
|
|
By default, this macro is defined as
|
|
<CODE>DEFAULT_SWITCH_TAKES_ARG</CODE>, which handles the standard options
|
|
properly. You need not define <CODE>SWITCH_TAKES_ARG</CODE> unless you
|
|
wish to add additional options which take arguments. Any redefinition
|
|
should call <CODE>DEFAULT_SWITCH_TAKES_ARG</CODE> and then check for
|
|
additional options.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1131"></A>
|
|
<DT><CODE>WORD_SWITCH_TAKES_ARG (<VAR>name</VAR>)</CODE>
|
|
<DD>A C expression which determines whether the option <SAMP>`-<VAR>name</VAR>'</SAMP>
|
|
takes arguments. The value should be the number of arguments that
|
|
option takes--zero, for many options. This macro rather than
|
|
<CODE>SWITCH_TAKES_ARG</CODE> is used for multi-character option names.
|
|
<P>
|
|
|
|
By default, this macro is defined as
|
|
<CODE>DEFAULT_WORD_SWITCH_TAKES_ARG</CODE>, which handles the standard options
|
|
properly. You need not define <CODE>WORD_SWITCH_TAKES_ARG</CODE> unless you
|
|
wish to add additional options which take arguments. Any redefinition
|
|
should call <CODE>DEFAULT_WORD_SWITCH_TAKES_ARG</CODE> and then check for
|
|
additional options.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1132"></A>
|
|
<DT><CODE>SWITCH_CURTAILS_COMPILATION (<VAR>char</VAR>)</CODE>
|
|
<DD>A C expression which determines whether the option <SAMP>`-<VAR>char</VAR>'</SAMP>
|
|
stops compilation before the generation of an executable. The value is
|
|
boolean, non-zero if the option does stop an executable from being
|
|
generated, zero otherwise.
|
|
<P>
|
|
|
|
By default, this macro is defined as
|
|
<CODE>DEFAULT_SWITCH_CURTAILS_COMPILATION</CODE>, which handles the standard
|
|
options properly. You need not define
|
|
<CODE>SWITCH_CURTAILS_COMPILATION</CODE> unless you wish to add additional
|
|
options which affect the generation of an executable. Any redefinition
|
|
should call <CODE>DEFAULT_SWITCH_CURTAILS_COMPILATION</CODE> and then check
|
|
for additional options.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1133"></A>
|
|
<DT><CODE>SWITCHES_NEED_SPACES</CODE>
|
|
<DD>A string-valued C expression which enumerates the options for which
|
|
the linker needs a space between the option and its argument.
|
|
<P>
|
|
|
|
If this macro is not defined, the default value is <CODE>""</CODE>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1134"></A>
|
|
<DT><CODE>CPP_SPEC</CODE>
|
|
<DD>A C string constant that tells the GNU CC driver program options to
|
|
pass to CPP. It can also specify how to translate options you
|
|
give to GNU CC into options for GNU CC to pass to the CPP.
|
|
<P>
|
|
|
|
Do not define this macro if it does not need to do anything.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1135"></A>
|
|
<DT><CODE>NO_BUILTIN_SIZE_TYPE</CODE>
|
|
<DD>If this macro is defined, the preprocessor will not define the builtin macro
|
|
<CODE>__SIZE_TYPE__</CODE>. The macro <CODE>__SIZE_TYPE__</CODE> must then be defined
|
|
by <CODE>CPP_SPEC</CODE> instead.
|
|
<P>
|
|
|
|
This should be defined if <CODE>SIZE_TYPE</CODE> depends on target dependent flags
|
|
which are not accessible to the preprocessor. Otherwise, it should not
|
|
be defined.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1136"></A>
|
|
<DT><CODE>NO_BUILTIN_PTRDIFF_TYPE</CODE>
|
|
<DD>If this macro is defined, the preprocessor will not define the builtin macro
|
|
<CODE>__PTRDIFF_TYPE__</CODE>. The macro <CODE>__PTRDIFF_TYPE__</CODE> must then be
|
|
defined by <CODE>CPP_SPEC</CODE> instead.
|
|
<P>
|
|
|
|
This should be defined if <CODE>PTRDIFF_TYPE</CODE> depends on target dependent flags
|
|
which are not accessible to the preprocessor. Otherwise, it should not
|
|
be defined.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1137"></A>
|
|
<DT><CODE>SIGNED_CHAR_SPEC</CODE>
|
|
<DD>A C string constant that tells the GNU CC driver program options to
|
|
pass to CPP. By default, this macro is defined to pass the option
|
|
<SAMP>`-D__CHAR_UNSIGNED__'</SAMP> to CPP if <CODE>char</CODE> will be treated as
|
|
<CODE>unsigned char</CODE> by <CODE>cc1</CODE>.
|
|
<P>
|
|
|
|
Do not define this macro unless you need to override the default
|
|
definition.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1138"></A>
|
|
<DT><CODE>CC1_SPEC</CODE>
|
|
<DD>A C string constant that tells the GNU CC driver program options to
|
|
pass to <CODE>cc1</CODE>. It can also specify how to translate options you
|
|
give to GNU CC into options for GNU CC to pass to the <CODE>cc1</CODE>.
|
|
<P>
|
|
|
|
Do not define this macro if it does not need to do anything.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1139"></A>
|
|
<DT><CODE>CC1PLUS_SPEC</CODE>
|
|
<DD>A C string constant that tells the GNU CC driver program options to
|
|
pass to <CODE>cc1plus</CODE>. It can also specify how to translate options you
|
|
give to GNU CC into options for GNU CC to pass to the <CODE>cc1plus</CODE>.
|
|
<P>
|
|
|
|
Do not define this macro if it does not need to do anything.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1140"></A>
|
|
<DT><CODE>ASM_SPEC</CODE>
|
|
<DD>A C string constant that tells the GNU CC driver program options to
|
|
pass to the assembler. It can also specify how to translate options
|
|
you give to GNU CC into options for GNU CC to pass to the assembler.
|
|
See the file <TT>`sun3.h'</TT> for an example of this.
|
|
<P>
|
|
|
|
Do not define this macro if it does not need to do anything.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1141"></A>
|
|
<DT><CODE>ASM_FINAL_SPEC</CODE>
|
|
<DD>A C string constant that tells the GNU CC driver program how to
|
|
run any programs which cleanup after the normal assembler.
|
|
Normally, this is not needed. See the file <TT>`mips.h'</TT> for
|
|
an example of this.
|
|
<P>
|
|
|
|
Do not define this macro if it does not need to do anything.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1142"></A>
|
|
<DT><CODE>LINK_SPEC</CODE>
|
|
<DD>A C string constant that tells the GNU CC driver program options to
|
|
pass to the linker. It can also specify how to translate options you
|
|
give to GNU CC into options for GNU CC to pass to the linker.
|
|
<P>
|
|
|
|
Do not define this macro if it does not need to do anything.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1143"></A>
|
|
<DT><CODE>LIB_SPEC</CODE>
|
|
<DD>Another C string constant used much like <CODE>LINK_SPEC</CODE>. The difference
|
|
between the two is that <CODE>LIB_SPEC</CODE> is used at the end of the
|
|
command given to the linker.
|
|
<P>
|
|
|
|
If this macro is not defined, a default is provided that
|
|
loads the standard C library from the usual place. See <TT>`gcc.c'</TT>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1144"></A>
|
|
<DT><CODE>LIBGCC_SPEC</CODE>
|
|
<DD>Another C string constant that tells the GNU CC driver program
|
|
how and when to place a reference to <TT>`libgcc.a'</TT> into the
|
|
linker command line. This constant is placed both before and after
|
|
the value of <CODE>LIB_SPEC</CODE>.
|
|
<P>
|
|
|
|
If this macro is not defined, the GNU CC driver provides a default that
|
|
passes the string <SAMP>`-lgcc'</SAMP> to the linker unless the <SAMP>`-shared'</SAMP>
|
|
option is specified.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1145"></A>
|
|
<DT><CODE>STARTFILE_SPEC</CODE>
|
|
<DD>Another C string constant used much like <CODE>LINK_SPEC</CODE>. The
|
|
difference between the two is that <CODE>STARTFILE_SPEC</CODE> is used at
|
|
the very beginning of the command given to the linker.
|
|
<P>
|
|
|
|
If this macro is not defined, a default is provided that loads the
|
|
standard C startup file from the usual place. See <TT>`gcc.c'</TT>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1146"></A>
|
|
<DT><CODE>ENDFILE_SPEC</CODE>
|
|
<DD>Another C string constant used much like <CODE>LINK_SPEC</CODE>. The
|
|
difference between the two is that <CODE>ENDFILE_SPEC</CODE> is used at
|
|
the very end of the command given to the linker.
|
|
<P>
|
|
|
|
Do not define this macro if it does not need to do anything.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1147"></A>
|
|
<DT><CODE>EXTRA_SPECS</CODE>
|
|
<DD>Define this macro to provide additional specifications to put in the
|
|
<TT>`specs'</TT> file that can be used in various specifications like
|
|
<CODE>CC1_SPEC</CODE>.
|
|
<P>
|
|
|
|
The definition should be an initializer for an array of structures,
|
|
containing a string constant, that defines the specification name, and a
|
|
string constant that provides the specification.
|
|
</P><P>
|
|
|
|
Do not define this macro if it does not need to do anything.
|
|
</P><P>
|
|
|
|
<CODE>EXTRA_SPECS</CODE> is useful when an architecture contains several
|
|
related targets, which have various <CODE>..._SPECS</CODE> which are similar
|
|
to each other, and the maintainer would like one central place to keep
|
|
these definitions.
|
|
</P><P>
|
|
|
|
For example, the PowerPC System V.4 targets use <CODE>EXTRA_SPECS</CODE> to
|
|
define either <CODE>_CALL_SYSV</CODE> when the System V calling sequence is
|
|
used or <CODE>_CALL_AIX</CODE> when the older AIX-based calling sequence is
|
|
used.
|
|
</P><P>
|
|
|
|
The <TT>`config/rs6000/rs6000.h'</TT> target file defines:
|
|
</P><P>
|
|
|
|
<TABLE><tr><td> </td><td class=example><pre>#define EXTRA_SPECS \
|
|
{ "cpp_sysv_default", CPP_SYSV_DEFAULT },
|
|
|
|
#define CPP_SYS_DEFAULT ""
|
|
</pre></td></tr></table></P><P>
|
|
|
|
The <TT>`config/rs6000/sysv.h'</TT> target file defines:
|
|
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>#undef CPP_SPEC
|
|
#define CPP_SPEC \
|
|
"%{posix: -D_POSIX_SOURCE } \
|
|
%{mcall-sysv: -D_CALL_SYSV } %{mcall-aix: -D_CALL_AIX } \
|
|
%{!mcall-sysv: %{!mcall-aix: %(cpp_sysv_default) }} \
|
|
%{msoft-float: -D_SOFT_FLOAT} %{mcpu=403: -D_SOFT_FLOAT}"
|
|
|
|
#undef CPP_SYSV_DEFAULT
|
|
#define CPP_SYSV_DEFAULT "-D_CALL_SYSV"
|
|
</FONT></pre></td></tr></table></P><P>
|
|
|
|
while the <TT>`config/rs6000/eabiaix.h'</TT> target file defines
|
|
<CODE>CPP_SYSV_DEFAULT</CODE> as:
|
|
</P><P>
|
|
|
|
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>#undef CPP_SYSV_DEFAULT
|
|
#define CPP_SYSV_DEFAULT "-D_CALL_AIX"
|
|
</FONT></pre></td></tr></table></P><P>
|
|
|
|
<A NAME="IDX1148"></A>
|
|
<DT><CODE>LINK_LIBGCC_SPECIAL</CODE>
|
|
<DD>Define this macro if the driver program should find the library
|
|
<TT>`libgcc.a'</TT> itself and should not pass <SAMP>`-L'</SAMP> options to the
|
|
linker. If you do not define this macro, the driver program will pass
|
|
the argument <SAMP>`-lgcc'</SAMP> to tell the linker to do the search and will
|
|
pass <SAMP>`-L'</SAMP> options to it.
|
|
<P>
|
|
|
|
<A NAME="IDX1149"></A>
|
|
<DT><CODE>LINK_LIBGCC_SPECIAL_1</CODE>
|
|
<DD>Define this macro if the driver program should find the library
|
|
<TT>`libgcc.a'</TT>. If you do not define this macro, the driver program will pass
|
|
the argument <SAMP>`-lgcc'</SAMP> to tell the linker to do the search.
|
|
This macro is similar to <CODE>LINK_LIBGCC_SPECIAL</CODE>, except that it does
|
|
not affect <SAMP>`-L'</SAMP> options.
|
|
<P>
|
|
|
|
<A NAME="IDX1150"></A>
|
|
<DT><CODE>LINK_COMMAND_SPEC</CODE>
|
|
<DD>A C string constant giving the complete command line need to execute the
|
|
linker. When you do this, you will need to update your port each time a
|
|
change is made to the link command line within <TT>`gcc.c'</TT>. Therefore,
|
|
define this macro only if you need to completely redefine the command
|
|
line for invoking the linker and there is no other way to accomplish
|
|
the effect you need.
|
|
<P>
|
|
|
|
<A NAME="IDX1151"></A>
|
|
<DT><CODE>MULTILIB_DEFAULTS</CODE>
|
|
<DD>Define this macro as a C expression for the initializer of an array of
|
|
string to tell the driver program which options are defaults for this
|
|
target and thus do not need to be handled specially when using
|
|
<CODE>MULTILIB_OPTIONS</CODE>.
|
|
<P>
|
|
|
|
Do not define this macro if <CODE>MULTILIB_OPTIONS</CODE> is not defined in
|
|
the target makefile fragment or if none of the options listed in
|
|
<CODE>MULTILIB_OPTIONS</CODE> are set by default.
|
|
See section <A HREF="gcc_19.html#SEC253" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_19.html#SEC253">19.1 The Target Makefile Fragment</A>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1152"></A>
|
|
<DT><CODE>RELATIVE_PREFIX_NOT_LINKDIR</CODE>
|
|
<DD>Define this macro to tell <CODE>gcc</CODE> that it should only translate
|
|
a <SAMP>`-B'</SAMP> prefix into a <SAMP>`-L'</SAMP> linker option if the prefix
|
|
indicates an absolute file name.
|
|
<P>
|
|
|
|
<A NAME="IDX1153"></A>
|
|
<DT><CODE>STANDARD_EXEC_PREFIX</CODE>
|
|
<DD>Define this macro as a C string constant if you wish to override the
|
|
standard choice of <TT>`/usr/local/lib/gcc-lib/'</TT> as the default prefix to
|
|
try when searching for the executable files of the compiler.
|
|
<P>
|
|
|
|
<A NAME="IDX1154"></A>
|
|
<DT><CODE>MD_EXEC_PREFIX</CODE>
|
|
<DD>If defined, this macro is an additional prefix to try after
|
|
<CODE>STANDARD_EXEC_PREFIX</CODE>. <CODE>MD_EXEC_PREFIX</CODE> is not searched
|
|
when the <SAMP>`-b'</SAMP> option is used, or the compiler is built as a cross
|
|
compiler. If you define <CODE>MD_EXEC_PREFIX</CODE>, then be sure to add it
|
|
to the list of directories used to find the assembler in <TT>`configure.in'</TT>.
|
|
<P>
|
|
|
|
<A NAME="IDX1155"></A>
|
|
<DT><CODE>STANDARD_STARTFILE_PREFIX</CODE>
|
|
<DD>Define this macro as a C string constant if you wish to override the
|
|
standard choice of <TT>`/usr/local/lib/'</TT> as the default prefix to
|
|
try when searching for startup files such as <TT>`crt0.o'</TT>.
|
|
<P>
|
|
|
|
<A NAME="IDX1156"></A>
|
|
<DT><CODE>MD_STARTFILE_PREFIX</CODE>
|
|
<DD>If defined, this macro supplies an additional prefix to try after the
|
|
standard prefixes. <CODE>MD_EXEC_PREFIX</CODE> is not searched when the
|
|
<SAMP>`-b'</SAMP> option is used, or when the compiler is built as a cross
|
|
compiler.
|
|
<P>
|
|
|
|
<A NAME="IDX1157"></A>
|
|
<DT><CODE>MD_STARTFILE_PREFIX_1</CODE>
|
|
<DD>If defined, this macro supplies yet another prefix to try after the
|
|
standard prefixes. It is not searched when the <SAMP>`-b'</SAMP> option is
|
|
used, or when the compiler is built as a cross compiler.
|
|
<P>
|
|
|
|
<A NAME="IDX1158"></A>
|
|
<DT><CODE>INIT_ENVIRONMENT</CODE>
|
|
<DD>Define this macro as a C string constant if you wish to set environment
|
|
variables for programs called by the driver, such as the assembler and
|
|
loader. The driver passes the value of this macro to <CODE>putenv</CODE> to
|
|
initialize the necessary environment variables.
|
|
<P>
|
|
|
|
<A NAME="IDX1159"></A>
|
|
<DT><CODE>LOCAL_INCLUDE_DIR</CODE>
|
|
<DD>Define this macro as a C string constant if you wish to override the
|
|
standard choice of <TT>`/usr/local/include'</TT> as the default prefix to
|
|
try when searching for local header files. <CODE>LOCAL_INCLUDE_DIR</CODE>
|
|
comes before <CODE>SYSTEM_INCLUDE_DIR</CODE> in the search order.
|
|
<P>
|
|
|
|
Cross compilers do not use this macro and do not search either
|
|
<TT>`/usr/local/include'</TT> or its replacement.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1160"></A>
|
|
<DT><CODE>SYSTEM_INCLUDE_DIR</CODE>
|
|
<DD>Define this macro as a C string constant if you wish to specify a
|
|
system-specific directory to search for header files before the standard
|
|
directory. <CODE>SYSTEM_INCLUDE_DIR</CODE> comes before
|
|
<CODE>STANDARD_INCLUDE_DIR</CODE> in the search order.
|
|
<P>
|
|
|
|
Cross compilers do not use this macro and do not search the directory
|
|
specified.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1161"></A>
|
|
<DT><CODE>STANDARD_INCLUDE_DIR</CODE>
|
|
<DD>Define this macro as a C string constant if you wish to override the
|
|
standard choice of <TT>`/usr/include'</TT> as the default prefix to
|
|
try when searching for header files.
|
|
<P>
|
|
|
|
Cross compilers do not use this macro and do not search either
|
|
<TT>`/usr/include'</TT> or its replacement.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1162"></A>
|
|
<DT><CODE>STANDARD_INCLUDE_COMPONENT</CODE>
|
|
<DD>The "component" corresponding to <CODE>STANDARD_INCLUDE_DIR</CODE>.
|
|
See <CODE>INCLUDE_DEFAULTS</CODE>, below, for the description of components.
|
|
If you do not define this macro, no component is used.
|
|
<P>
|
|
|
|
<A NAME="IDX1163"></A>
|
|
<DT><CODE>INCLUDE_DEFAULTS</CODE>
|
|
<DD>Define this macro if you wish to override the entire default search path
|
|
for include files. For a native compiler, the default search path
|
|
usually consists of <CODE>GCC_INCLUDE_DIR</CODE>, <CODE>LOCAL_INCLUDE_DIR</CODE>,
|
|
<CODE>SYSTEM_INCLUDE_DIR</CODE>, <CODE>GPLUSPLUS_INCLUDE_DIR</CODE>, and
|
|
<CODE>STANDARD_INCLUDE_DIR</CODE>. In addition, <CODE>GPLUSPLUS_INCLUDE_DIR</CODE>
|
|
and <CODE>GCC_INCLUDE_DIR</CODE> are defined automatically by <TT>`Makefile'</TT>,
|
|
and specify private search areas for GCC. The directory
|
|
<CODE>GPLUSPLUS_INCLUDE_DIR</CODE> is used only for C++ programs.
|
|
<P>
|
|
|
|
The definition should be an initializer for an array of structures.
|
|
Each array element should have four elements: the directory name (a
|
|
string constant), the component name, and flag for C++-only directories,
|
|
and a flag showing that the includes in the directory don't need to be
|
|
wrapped in <CODE>extern <SAMP>`C'</SAMP></CODE> when compiling C++. Mark the end of
|
|
the array with a null element.
|
|
</P><P>
|
|
|
|
The component name denotes what GNU package the include file is part of,
|
|
if any, in all upper-case letters. For example, it might be <SAMP>`GCC'</SAMP>
|
|
or <SAMP>`BINUTILS'</SAMP>. If the package is part of the a vendor-supplied
|
|
operating system, code the component name as <SAMP>`0'</SAMP>.
|
|
</P><P>
|
|
|
|
For example, here is the definition used for VAX/VMS:
|
|
</P><P>
|
|
|
|
<TABLE><tr><td> </td><td class=example><pre>#define INCLUDE_DEFAULTS \
|
|
{ \
|
|
{ "GNU_GXX_INCLUDE:", "G++", 1, 1}, \
|
|
{ "GNU_CC_INCLUDE:", "GCC", 0, 0}, \
|
|
{ "SYS$SYSROOT:[SYSLIB.]", 0, 0, 0}, \
|
|
{ ".", 0, 0, 0}, \
|
|
{ 0, 0, 0, 0} \
|
|
}
|
|
</pre></td></tr></table></DL>
|
|
<P>
|
|
|
|
Here is the order of prefixes tried for exec files:
|
|
</P><P>
|
|
|
|
<OL>
|
|
<LI>
|
|
Any prefixes specified by the user with <SAMP>`-B'</SAMP>.
|
|
<P>
|
|
|
|
<LI>
|
|
The environment variable <CODE>GCC_EXEC_PREFIX</CODE>, if any.
|
|
<P>
|
|
|
|
<LI>
|
|
The directories specified by the environment variable <CODE>COMPILER_PATH</CODE>.
|
|
<P>
|
|
|
|
<LI>
|
|
The macro <CODE>STANDARD_EXEC_PREFIX</CODE>.
|
|
<P>
|
|
|
|
<LI>
|
|
<TT>`/usr/lib/gcc/'</TT>.
|
|
<P>
|
|
|
|
<LI>
|
|
The macro <CODE>MD_EXEC_PREFIX</CODE>, if any.
|
|
</OL>
|
|
<P>
|
|
|
|
Here is the order of prefixes tried for startfiles:
|
|
</P><P>
|
|
|
|
<OL>
|
|
<LI>
|
|
Any prefixes specified by the user with <SAMP>`-B'</SAMP>.
|
|
<P>
|
|
|
|
<LI>
|
|
The environment variable <CODE>GCC_EXEC_PREFIX</CODE>, if any.
|
|
<P>
|
|
|
|
<LI>
|
|
The directories specified by the environment variable <CODE>LIBRARY_PATH</CODE>
|
|
(native only, cross compilers do not use this).
|
|
<P>
|
|
|
|
<LI>
|
|
The macro <CODE>STANDARD_EXEC_PREFIX</CODE>.
|
|
<P>
|
|
|
|
<LI>
|
|
<TT>`/usr/lib/gcc/'</TT>.
|
|
<P>
|
|
|
|
<LI>
|
|
The macro <CODE>MD_EXEC_PREFIX</CODE>, if any.
|
|
<P>
|
|
|
|
<LI>
|
|
The macro <CODE>MD_STARTFILE_PREFIX</CODE>, if any.
|
|
<P>
|
|
|
|
<LI>
|
|
The macro <CODE>STANDARD_STARTFILE_PREFIX</CODE>.
|
|
<P>
|
|
|
|
<LI>
|
|
<TT>`/lib/'</TT>.
|
|
<P>
|
|
|
|
<LI>
|
|
<TT>`/usr/lib/'</TT>.
|
|
</OL>
|
|
<P>
|
|
|
|
<A NAME="Run-time Target"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC201"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC200" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC200"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC202" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC202"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC202" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC202"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC199" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC199"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_18.html#SEC251" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_18.html#SEC251"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H2> 17.2 Run-time Target Specification </H2>
|
|
<!--docid::SEC201::-->
|
|
<P>
|
|
|
|
Here are run-time target specifications.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1164"></A>
|
|
<DT><CODE>CPP_PREDEFINES</CODE>
|
|
<DD>Define this to be a string constant containing <SAMP>`-D'</SAMP> options to
|
|
define the predefined macros that identify this machine and system.
|
|
These macros will be predefined unless the <SAMP>`-ansi'</SAMP> option is
|
|
specified.
|
|
<P>
|
|
|
|
In addition, a parallel set of macros are predefined, whose names are
|
|
made by appending <SAMP>`__'</SAMP> at the beginning and at the end. These
|
|
<SAMP>`__'</SAMP> macros are permitted by the ANSI standard, so they are
|
|
predefined regardless of whether <SAMP>`-ansi'</SAMP> is specified.
|
|
</P><P>
|
|
|
|
For example, on the Sun, one can use the following value:
|
|
</P><P>
|
|
|
|
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>"-Dmc68000 -Dsun -Dunix"
|
|
</FONT></pre></td></tr></table></P><P>
|
|
|
|
The result is to define the macros <CODE>__mc68000__</CODE>, <CODE>__sun__</CODE>
|
|
and <CODE>__unix__</CODE> unconditionally, and the macros <CODE>mc68000</CODE>,
|
|
<CODE>sun</CODE> and <CODE>unix</CODE> provided <SAMP>`-ansi'</SAMP> is not specified.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1165"></A>
|
|
<DT><CODE>extern int target_flags;</CODE>
|
|
<DD>This declaration should be present.
|
|
<P>
|
|
|
|
<A NAME="IDX1166"></A>
|
|
<A NAME="IDX1167"></A>
|
|
<DT><CODE>TARGET_<small>...</small></CODE>
|
|
<DD>This series of macros is to allow compiler command arguments to
|
|
enable or disable the use of optional features of the target machine.
|
|
For example, one machine description serves both the 68000 and
|
|
the 68020; a command argument tells the compiler whether it should
|
|
use 68020-only instructions or not. This command argument works
|
|
by means of a macro <CODE>TARGET_68020</CODE> that tests a bit in
|
|
<CODE>target_flags</CODE>.
|
|
<P>
|
|
|
|
Define a macro <CODE>TARGET_<VAR>featurename</VAR></CODE> for each such option.
|
|
Its definition should test a bit in <CODE>target_flags</CODE>; for example:
|
|
</P><P>
|
|
|
|
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>#define TARGET_68020 (target_flags & 1)
|
|
</FONT></pre></td></tr></table></P><P>
|
|
|
|
One place where these macros are used is in the condition-expressions
|
|
of instruction patterns. Note how <CODE>TARGET_68020</CODE> appears
|
|
frequently in the 68000 machine description file, <TT>`m68k.md'</TT>.
|
|
Another place they are used is in the definitions of the other
|
|
macros in the <TT>`<VAR>machine</VAR>.h'</TT> file.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1168"></A>
|
|
<DT><CODE>TARGET_SWITCHES</CODE>
|
|
<DD>This macro defines names of command options to set and clear
|
|
bits in <CODE>target_flags</CODE>. Its definition is an initializer
|
|
with a subgrouping for each command option.
|
|
<P>
|
|
|
|
Each subgrouping contains a string constant, that defines the option
|
|
name, a number, which contains the bits to set in
|
|
<CODE>target_flags</CODE>, and a second string which is the description
|
|
displayed by --help. If the number is negative then the bits specified
|
|
by the number are cleared instead of being set. If the description
|
|
string is present but empty, then no help information will be displayed
|
|
for that option, but it will not count as an undocumented option. The
|
|
actual option name is made by appending <SAMP>`-m'</SAMP> to the specified name.
|
|
</P><P>
|
|
|
|
One of the subgroupings should have a null string. The number in
|
|
this grouping is the default value for <CODE>target_flags</CODE>. Any
|
|
target options act starting with that value.
|
|
</P><P>
|
|
|
|
Here is an example which defines <SAMP>`-m68000'</SAMP> and <SAMP>`-m68020'</SAMP>
|
|
with opposite meanings, and picks the latter as the default:
|
|
</P><P>
|
|
|
|
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>#define TARGET_SWITCHES \
|
|
{ { "68020", 1, "" }, \
|
|
{ "68000", -1, "Compile for the 68000" }, \
|
|
{ "", 1, "" }}
|
|
</FONT></pre></td></tr></table></P><P>
|
|
|
|
<A NAME="IDX1169"></A>
|
|
<DT><CODE>TARGET_OPTIONS</CODE>
|
|
<DD>This macro is similar to <CODE>TARGET_SWITCHES</CODE> but defines names of command
|
|
options that have values. Its definition is an initializer with a
|
|
subgrouping for each command option.
|
|
<P>
|
|
|
|
Each subgrouping contains a string constant, that defines the fixed part
|
|
of the option name, the address of a variable, and a description string.
|
|
The variable, type <CODE>char *</CODE>, is set to the variable part of the
|
|
given option if the fixed part matches. The actual option name is made
|
|
by appending <SAMP>`-m'</SAMP> to the specified name.
|
|
</P><P>
|
|
|
|
Here is an example which defines <SAMP>`-mshort-data-<VAR>number</VAR>'</SAMP>. If the
|
|
given option is <SAMP>`-mshort-data-512'</SAMP>, the variable <CODE>m88k_short_data</CODE>
|
|
will be set to the string <CODE>"512"</CODE>.
|
|
</P><P>
|
|
|
|
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>extern char *m88k_short_data;
|
|
#define TARGET_OPTIONS \
|
|
{ { "short-data-", &m88k_short_data, "Specify the size of the short data section" } }
|
|
</FONT></pre></td></tr></table></P><P>
|
|
|
|
<A NAME="IDX1170"></A>
|
|
<DT><CODE>TARGET_VERSION</CODE>
|
|
<DD>This macro is a C statement to print on <CODE>stderr</CODE> a string
|
|
describing the particular machine description choice. Every machine
|
|
description should define <CODE>TARGET_VERSION</CODE>. For example:
|
|
<P>
|
|
|
|
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>#ifdef MOTOROLA
|
|
#define TARGET_VERSION \
|
|
fprintf (stderr, " (68k, Motorola syntax)");
|
|
#else
|
|
#define TARGET_VERSION \
|
|
fprintf (stderr, " (68k, MIT syntax)");
|
|
#endif
|
|
</FONT></pre></td></tr></table></P><P>
|
|
|
|
<A NAME="IDX1171"></A>
|
|
<DT><CODE>OVERRIDE_OPTIONS</CODE>
|
|
<DD>Sometimes certain combinations of command options do not make sense on
|
|
a particular target machine. You can define a macro
|
|
<CODE>OVERRIDE_OPTIONS</CODE> to take account of this. This macro, if
|
|
defined, is executed once just after all the command options have been
|
|
parsed.
|
|
<P>
|
|
|
|
Don't use this macro to turn on various extra optimizations for
|
|
<SAMP>`-O'</SAMP>. That is what <CODE>OPTIMIZATION_OPTIONS</CODE> is for.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1172"></A>
|
|
<DT><CODE>OPTIMIZATION_OPTIONS (<VAR>level</VAR>, <VAR>size</VAR>)</CODE>
|
|
<DD>Some machines may desire to change what optimizations are performed for
|
|
various optimization levels. This macro, if defined, is executed once
|
|
just after the optimization level is determined and before the remainder
|
|
of the command options have been parsed. Values set in this macro are
|
|
used as the default values for the other command line options.
|
|
<P>
|
|
|
|
<VAR>level</VAR> is the optimization level specified; 2 if <SAMP>`-O2'</SAMP> is
|
|
specified, 1 if <SAMP>`-O'</SAMP> is specified, and 0 if neither is specified.
|
|
</P><P>
|
|
|
|
<VAR>size</VAR> is non-zero if <SAMP>`-Os'</SAMP> is specified and zero otherwise.
|
|
</P><P>
|
|
|
|
You should not use this macro to change options that are not
|
|
machine-specific. These should uniformly selected by the same
|
|
optimization level on all supported machines. Use this macro to enable
|
|
machine-specific optimizations.
|
|
</P><P>
|
|
|
|
<STRONG>Do not examine <CODE>write_symbols</CODE> in
|
|
this macro!</STRONG> The debugging options are not supposed to alter the
|
|
generated code.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1173"></A>
|
|
<DT><CODE>CAN_DEBUG_WITHOUT_FP</CODE>
|
|
<DD>Define this macro if debugging can be performed even without a frame
|
|
pointer. If this macro is defined, GNU CC will turn on the
|
|
<SAMP>`-fomit-frame-pointer'</SAMP> option whenever <SAMP>`-O'</SAMP> is specified.
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="Storage Layout"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC202"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC201" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC201"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC203" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC203"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC203" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC203"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC199" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC199"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_18.html#SEC251" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_18.html#SEC251"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H2> 17.3 Storage Layout </H2>
|
|
<!--docid::SEC202::-->
|
|
<P>
|
|
|
|
Note that the definitions of the macros in this table which are sizes or
|
|
alignments measured in bits do not need to be constant. They can be C
|
|
expressions that refer to static variables, such as the <CODE>target_flags</CODE>.
|
|
See section <A HREF="gcc_17.html#SEC201" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC201">17.2 Run-time Target Specification</A>.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1174"></A>
|
|
<DT><CODE>BITS_BIG_ENDIAN</CODE>
|
|
<DD>Define this macro to have the value 1 if the most significant bit in a
|
|
byte has the lowest number; otherwise define it to have the value zero.
|
|
This means that bit-field instructions count from the most significant
|
|
bit. If the machine has no bit-field instructions, then this must still
|
|
be defined, but it doesn't matter which value it is defined to. This
|
|
macro need not be a constant.
|
|
<P>
|
|
|
|
This macro does not affect the way structure fields are packed into
|
|
bytes or words; that is controlled by <CODE>BYTES_BIG_ENDIAN</CODE>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1175"></A>
|
|
<DT><CODE>BYTES_BIG_ENDIAN</CODE>
|
|
<DD>Define this macro to have the value 1 if the most significant byte in a
|
|
word has the lowest number. This macro need not be a constant.
|
|
<P>
|
|
|
|
<A NAME="IDX1176"></A>
|
|
<DT><CODE>WORDS_BIG_ENDIAN</CODE>
|
|
<DD>Define this macro to have the value 1 if, in a multiword object, the
|
|
most significant word has the lowest number. This applies to both
|
|
memory locations and registers; GNU CC fundamentally assumes that the
|
|
order of words in memory is the same as the order in registers. This
|
|
macro need not be a constant.
|
|
<P>
|
|
|
|
<A NAME="IDX1177"></A>
|
|
<DT><CODE>LIBGCC2_WORDS_BIG_ENDIAN</CODE>
|
|
<DD>Define this macro if WORDS_BIG_ENDIAN is not constant. This must be a
|
|
constant value with the same meaning as WORDS_BIG_ENDIAN, which will be
|
|
used only when compiling libgcc2.c. Typically the value will be set
|
|
based on preprocessor defines.
|
|
<P>
|
|
|
|
<A NAME="IDX1178"></A>
|
|
<DT><CODE>FLOAT_WORDS_BIG_ENDIAN</CODE>
|
|
<DD>Define this macro to have the value 1 if <CODE>DFmode</CODE>, <CODE>XFmode</CODE> or
|
|
<CODE>TFmode</CODE> floating point numbers are stored in memory with the word
|
|
containing the sign bit at the lowest address; otherwise define it to
|
|
have the value 0. This macro need not be a constant.
|
|
<P>
|
|
|
|
You need not define this macro if the ordering is the same as for
|
|
multi-word integers.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1179"></A>
|
|
<DT><CODE>BITS_PER_UNIT</CODE>
|
|
<DD>Define this macro to be the number of bits in an addressable storage
|
|
unit (byte); normally 8.
|
|
<P>
|
|
|
|
<A NAME="IDX1180"></A>
|
|
<DT><CODE>BITS_PER_WORD</CODE>
|
|
<DD>Number of bits in a word; normally 32.
|
|
<P>
|
|
|
|
<A NAME="IDX1181"></A>
|
|
<DT><CODE>MAX_BITS_PER_WORD</CODE>
|
|
<DD>Maximum number of bits in a word. If this is undefined, the default is
|
|
<CODE>BITS_PER_WORD</CODE>. Otherwise, it is the constant value that is the
|
|
largest value that <CODE>BITS_PER_WORD</CODE> can have at run-time.
|
|
<P>
|
|
|
|
<A NAME="IDX1182"></A>
|
|
<DT><CODE>UNITS_PER_WORD</CODE>
|
|
<DD>Number of storage units in a word; normally 4.
|
|
<P>
|
|
|
|
<A NAME="IDX1183"></A>
|
|
<DT><CODE>MIN_UNITS_PER_WORD</CODE>
|
|
<DD>Minimum number of units in a word. If this is undefined, the default is
|
|
<CODE>UNITS_PER_WORD</CODE>. Otherwise, it is the constant value that is the
|
|
smallest value that <CODE>UNITS_PER_WORD</CODE> can have at run-time.
|
|
<P>
|
|
|
|
<A NAME="IDX1184"></A>
|
|
<DT><CODE>POINTER_SIZE</CODE>
|
|
<DD>Width of a pointer, in bits. You must specify a value no wider than the
|
|
width of <CODE>Pmode</CODE>. If it is not equal to the width of <CODE>Pmode</CODE>,
|
|
you must define <CODE>POINTERS_EXTEND_UNSIGNED</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX1185"></A>
|
|
<DT><CODE>POINTERS_EXTEND_UNSIGNED</CODE>
|
|
<DD>A C expression whose value is nonzero if pointers that need to be
|
|
extended from being <CODE>POINTER_SIZE</CODE> bits wide to <CODE>Pmode</CODE> are to
|
|
be zero-extended and zero if they are to be sign-extended.
|
|
<P>
|
|
|
|
You need not define this macro if the <CODE>POINTER_SIZE</CODE> is equal
|
|
to the width of <CODE>Pmode</CODE>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1186"></A>
|
|
<DT><CODE>PROMOTE_MODE (<VAR>m</VAR>, <VAR>unsignedp</VAR>, <VAR>type</VAR>)</CODE>
|
|
<DD>A macro to update <VAR>m</VAR> and <VAR>unsignedp</VAR> when an object whose type
|
|
is <VAR>type</VAR> and which has the specified mode and signedness is to be
|
|
stored in a register. This macro is only called when <VAR>type</VAR> is a
|
|
scalar type.
|
|
<P>
|
|
|
|
On most RISC machines, which only have operations that operate on a full
|
|
register, define this macro to set <VAR>m</VAR> to <CODE>word_mode</CODE> if
|
|
<VAR>m</VAR> is an integer mode narrower than <CODE>BITS_PER_WORD</CODE>. In most
|
|
cases, only integer modes should be widened because wider-precision
|
|
floating-point operations are usually more expensive than their narrower
|
|
counterparts.
|
|
</P><P>
|
|
|
|
For most machines, the macro definition does not change <VAR>unsignedp</VAR>.
|
|
However, some machines, have instructions that preferentially handle
|
|
either signed or unsigned quantities of certain modes. For example, on
|
|
the DEC Alpha, 32-bit loads from memory and 32-bit add instructions
|
|
sign-extend the result to 64 bits. On such machines, set
|
|
<VAR>unsignedp</VAR> according to which kind of extension is more efficient.
|
|
</P><P>
|
|
|
|
Do not define this macro if it would never modify <VAR>m</VAR>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1187"></A>
|
|
<DT><CODE>PROMOTE_FUNCTION_ARGS</CODE>
|
|
<DD>Define this macro if the promotion described by <CODE>PROMOTE_MODE</CODE>
|
|
should also be done for outgoing function arguments.
|
|
<P>
|
|
|
|
<A NAME="IDX1188"></A>
|
|
<DT><CODE>PROMOTE_FUNCTION_RETURN</CODE>
|
|
<DD>Define this macro if the promotion described by <CODE>PROMOTE_MODE</CODE>
|
|
should also be done for the return value of functions.
|
|
<P>
|
|
|
|
If this macro is defined, <CODE>FUNCTION_VALUE</CODE> must perform the same
|
|
promotions done by <CODE>PROMOTE_MODE</CODE>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1189"></A>
|
|
<DT><CODE>PROMOTE_FOR_CALL_ONLY</CODE>
|
|
<DD>Define this macro if the promotion described by <CODE>PROMOTE_MODE</CODE>
|
|
should <EM>only</EM> be performed for outgoing function arguments or
|
|
function return values, as specified by <CODE>PROMOTE_FUNCTION_ARGS</CODE>
|
|
and <CODE>PROMOTE_FUNCTION_RETURN</CODE>, respectively.
|
|
<P>
|
|
|
|
<A NAME="IDX1190"></A>
|
|
<DT><CODE>PARM_BOUNDARY</CODE>
|
|
<DD>Normal alignment required for function parameters on the stack, in
|
|
bits. All stack parameters receive at least this much alignment
|
|
regardless of data type. On most machines, this is the same as the
|
|
size of an integer.
|
|
<P>
|
|
|
|
<A NAME="IDX1191"></A>
|
|
<DT><CODE>STACK_BOUNDARY</CODE>
|
|
<DD>Define this macro if there is a guaranteed alignment for the stack
|
|
pointer on this machine. The definition is a C expression
|
|
for the desired alignment (measured in bits). This value is used as a
|
|
default if PREFERRED_STACK_BOUNDARY is not defined.
|
|
<P>
|
|
|
|
<A NAME="IDX1192"></A>
|
|
<DT><CODE>PREFERRED_STACK_BOUNDARY</CODE>
|
|
<DD>Define this macro if you wish to preserve a certain alignment for
|
|
the stack pointer. The definition is a C expression
|
|
for the desired alignment (measured in bits). If STACK_BOUNDARY is
|
|
also defined, this macro must evaluate to a value equal to or larger
|
|
than STACK_BOUNDARY.
|
|
<P>
|
|
|
|
<A NAME="IDX1193"></A>
|
|
If <CODE>PUSH_ROUNDING</CODE> is not defined, the stack will always be aligned
|
|
to the specified boundary. If <CODE>PUSH_ROUNDING</CODE> is defined and specifies
|
|
a less strict alignment than <CODE>PREFERRED_STACK_BOUNDARY</CODE>, the stack may
|
|
be momentarily unaligned while pushing arguments.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1194"></A>
|
|
<DT><CODE>FUNCTION_BOUNDARY</CODE>
|
|
<DD>Alignment required for a function entry point, in bits.
|
|
<P>
|
|
|
|
<A NAME="IDX1195"></A>
|
|
<DT><CODE>BIGGEST_ALIGNMENT</CODE>
|
|
<DD>Biggest alignment that any data type can require on this machine, in bits.
|
|
<P>
|
|
|
|
<A NAME="IDX1196"></A>
|
|
<DT><CODE>MINIMUM_ATOMIC_ALIGNMENT</CODE>
|
|
<DD>If defined, the smallest alignment, in bits, that can be given to an
|
|
object that can be referenced in one operation, without disturbing any
|
|
nearby object. Normally, this is <CODE>BITS_PER_UNIT</CODE>, but may be larger
|
|
on machines that don't have byte or half-word store operations.
|
|
<P>
|
|
|
|
<A NAME="IDX1197"></A>
|
|
<DT><CODE>BIGGEST_FIELD_ALIGNMENT</CODE>
|
|
<DD>Biggest alignment that any structure field can require on this machine,
|
|
in bits. If defined, this overrides <CODE>BIGGEST_ALIGNMENT</CODE> for
|
|
structure fields only.
|
|
<P>
|
|
|
|
<A NAME="IDX1198"></A>
|
|
<DT><CODE>ADJUST_FIELD_ALIGN (<VAR>field</VAR>, <VAR>computed</VAR>)</CODE>
|
|
<DD>An expression for the alignment of a structure field <VAR>field</VAR> if the
|
|
alignment computed in the usual way is <VAR>computed</VAR>. GNU CC uses
|
|
this value instead of the value in <CODE>BIGGEST_ALIGNMENT</CODE> or
|
|
<CODE>BIGGEST_FIELD_ALIGNMENT</CODE>, if defined, for structure fields only.
|
|
<P>
|
|
|
|
<A NAME="IDX1199"></A>
|
|
<DT><CODE>MAX_OFILE_ALIGNMENT</CODE>
|
|
<DD>Biggest alignment supported by the object file format of this machine.
|
|
Use this macro to limit the alignment which can be specified using the
|
|
<CODE>__attribute__ ((aligned (<VAR>n</VAR>)))</CODE> construct. If not defined,
|
|
the default value is <CODE>BIGGEST_ALIGNMENT</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX1200"></A>
|
|
<DT><CODE>DATA_ALIGNMENT (<VAR>type</VAR>, <VAR>basic-align</VAR>)</CODE>
|
|
<DD>If defined, a C expression to compute the alignment for a variables in
|
|
the static store. <VAR>type</VAR> is the data type, and <VAR>basic-align</VAR> is
|
|
the alignment that the object would ordinarily have. The value of this
|
|
macro is used instead of that alignment to align the object.
|
|
<P>
|
|
|
|
If this macro is not defined, then <VAR>basic-align</VAR> is used.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1201"></A>
|
|
One use of this macro is to increase alignment of medium-size data to
|
|
make it all fit in fewer cache lines. Another is to cause character
|
|
arrays to be word-aligned so that <CODE>strcpy</CODE> calls that copy
|
|
constants to character arrays can be done inline.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1202"></A>
|
|
<DT><CODE>CONSTANT_ALIGNMENT (<VAR>constant</VAR>, <VAR>basic-align</VAR>)</CODE>
|
|
<DD>If defined, a C expression to compute the alignment given to a constant
|
|
that is being placed in memory. <VAR>constant</VAR> is the constant and
|
|
<VAR>basic-align</VAR> is the alignment that the object would ordinarily
|
|
have. The value of this macro is used instead of that alignment to
|
|
align the object.
|
|
<P>
|
|
|
|
If this macro is not defined, then <VAR>basic-align</VAR> is used.
|
|
</P><P>
|
|
|
|
The typical use of this macro is to increase alignment for string
|
|
constants to be word aligned so that <CODE>strcpy</CODE> calls that copy
|
|
constants can be done inline.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1203"></A>
|
|
<DT><CODE>LOCAL_ALIGNMENT (<VAR>type</VAR>, <VAR>basic-align</VAR>)</CODE>
|
|
<DD>If defined, a C expression to compute the alignment for a variables in
|
|
the local store. <VAR>type</VAR> is the data type, and <VAR>basic-align</VAR> is
|
|
the alignment that the object would ordinarily have. The value of this
|
|
macro is used instead of that alignment to align the object.
|
|
<P>
|
|
|
|
If this macro is not defined, then <VAR>basic-align</VAR> is used.
|
|
</P><P>
|
|
|
|
One use of this macro is to increase alignment of medium-size data to
|
|
make it all fit in fewer cache lines.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1204"></A>
|
|
<DT><CODE>EMPTY_FIELD_BOUNDARY</CODE>
|
|
<DD>Alignment in bits to be given to a structure bit field that follows an
|
|
empty field such as <CODE>int : 0;</CODE>.
|
|
<P>
|
|
|
|
Note that <CODE>PCC_BITFIELD_TYPE_MATTERS</CODE> also affects the alignment
|
|
that results from an empty field.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1205"></A>
|
|
<DT><CODE>STRUCTURE_SIZE_BOUNDARY</CODE>
|
|
<DD>Number of bits which any structure or union's size must be a multiple of.
|
|
Each structure or union's size is rounded up to a multiple of this.
|
|
<P>
|
|
|
|
If you do not define this macro, the default is the same as
|
|
<CODE>BITS_PER_UNIT</CODE>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1206"></A>
|
|
<DT><CODE>STRICT_ALIGNMENT</CODE>
|
|
<DD>Define this macro to be the value 1 if instructions will fail to work
|
|
if given data not on the nominal alignment. If instructions will merely
|
|
go slower in that case, define this macro as 0.
|
|
<P>
|
|
|
|
<A NAME="IDX1207"></A>
|
|
<DT><CODE>PCC_BITFIELD_TYPE_MATTERS</CODE>
|
|
<DD>Define this if you wish to imitate the way many other C compilers handle
|
|
alignment of bitfields and the structures that contain them.
|
|
<P>
|
|
|
|
The behavior is that the type written for a bitfield (<CODE>int</CODE>,
|
|
<CODE>short</CODE>, or other integer type) imposes an alignment for the
|
|
entire structure, as if the structure really did contain an ordinary
|
|
field of that type. In addition, the bitfield is placed within the
|
|
structure so that it would fit within such a field, not crossing a
|
|
boundary for it.
|
|
</P><P>
|
|
|
|
Thus, on most machines, a bitfield whose type is written as <CODE>int</CODE>
|
|
would not cross a four-byte boundary, and would force four-byte
|
|
alignment for the whole structure. (The alignment used may not be four
|
|
bytes; it is controlled by the other alignment parameters.)
|
|
</P><P>
|
|
|
|
If the macro is defined, its definition should be a C expression;
|
|
a nonzero value for the expression enables this behavior.
|
|
</P><P>
|
|
|
|
Note that if this macro is not defined, or its value is zero, some
|
|
bitfields may cross more than one alignment boundary. The compiler can
|
|
support such references if there are <SAMP>`insv'</SAMP>, <SAMP>`extv'</SAMP>, and
|
|
<SAMP>`extzv'</SAMP> insns that can directly reference memory.
|
|
</P><P>
|
|
|
|
The other known way of making bitfields work is to define
|
|
<CODE>STRUCTURE_SIZE_BOUNDARY</CODE> as large as <CODE>BIGGEST_ALIGNMENT</CODE>.
|
|
Then every structure can be accessed with fullwords.
|
|
</P><P>
|
|
|
|
Unless the machine has bitfield instructions or you define
|
|
<CODE>STRUCTURE_SIZE_BOUNDARY</CODE> that way, you must define
|
|
<CODE>PCC_BITFIELD_TYPE_MATTERS</CODE> to have a nonzero value.
|
|
</P><P>
|
|
|
|
If your aim is to make GNU CC use the same conventions for laying out
|
|
bitfields as are used by another compiler, here is how to investigate
|
|
what the other compiler does. Compile and run this program:
|
|
</P><P>
|
|
|
|
<TABLE><tr><td> </td><td class=example><pre>struct foo1
|
|
{
|
|
char x;
|
|
char :0;
|
|
char y;
|
|
};
|
|
|
|
struct foo2
|
|
{
|
|
char x;
|
|
int :0;
|
|
char y;
|
|
};
|
|
|
|
main ()
|
|
{
|
|
printf ("Size of foo1 is %d\n",
|
|
sizeof (struct foo1));
|
|
printf ("Size of foo2 is %d\n",
|
|
sizeof (struct foo2));
|
|
exit (0);
|
|
}
|
|
</pre></td></tr></table></P><P>
|
|
|
|
If this prints 2 and 5, then the compiler's behavior is what you would
|
|
get from <CODE>PCC_BITFIELD_TYPE_MATTERS</CODE>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1208"></A>
|
|
<DT><CODE>BITFIELD_NBYTES_LIMITED</CODE>
|
|
<DD>Like PCC_BITFIELD_TYPE_MATTERS except that its effect is limited to
|
|
aligning a bitfield within the structure.
|
|
<P>
|
|
|
|
<A NAME="IDX1209"></A>
|
|
<DT><CODE>ROUND_TYPE_SIZE (<VAR>type</VAR>, <VAR>computed</VAR>, <VAR>specified</VAR>)</CODE>
|
|
<DD>Define this macro as an expression for the overall size of a type
|
|
(given by <VAR>type</VAR> as a tree node) when the size computed in the
|
|
usual way is <VAR>computed</VAR> and the alignment is <VAR>specified</VAR>.
|
|
<P>
|
|
|
|
The default is to round <VAR>computed</VAR> up to a multiple of <VAR>specified</VAR>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1210"></A>
|
|
<DT><CODE>ROUND_TYPE_ALIGN (<VAR>type</VAR>, <VAR>computed</VAR>, <VAR>specified</VAR>)</CODE>
|
|
<DD>Define this macro as an expression for the alignment of a type (given
|
|
by <VAR>type</VAR> as a tree node) if the alignment computed in the usual
|
|
way is <VAR>computed</VAR> and the alignment explicitly specified was
|
|
<VAR>specified</VAR>.
|
|
<P>
|
|
|
|
The default is to use <VAR>specified</VAR> if it is larger; otherwise, use
|
|
the smaller of <VAR>computed</VAR> and <CODE>BIGGEST_ALIGNMENT</CODE>
|
|
</P><P>
|
|
|
|
<A NAME="IDX1211"></A>
|
|
<DT><CODE>MAX_FIXED_MODE_SIZE</CODE>
|
|
<DD>An integer expression for the size in bits of the largest integer
|
|
machine mode that should actually be used. All integer machine modes of
|
|
this size or smaller can be used for structures and unions with the
|
|
appropriate sizes. If this macro is undefined, <CODE>GET_MODE_BITSIZE
|
|
(DImode)</CODE> is assumed.
|
|
<P>
|
|
|
|
<A NAME="IDX1212"></A>
|
|
<DT><CODE>STACK_SAVEAREA_MODE (<VAR>save_level</VAR>)</CODE>
|
|
<DD>If defined, an expression of type <CODE>enum machine_mode</CODE> that
|
|
specifies the mode of the save area operand of a
|
|
<CODE>save_stack_<VAR>level</VAR></CODE> named pattern (see section <A HREF="gcc_16.html#SEC182" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_16.html#SEC182">16.7 Standard Pattern Names For Generation</A>).
|
|
<VAR>save_level</VAR> is one of <CODE>SAVE_BLOCK</CODE>, <CODE>SAVE_FUNCTION</CODE>, or
|
|
<CODE>SAVE_NONLOCAL</CODE> and selects which of the three named patterns is
|
|
having its mode specified.
|
|
<P>
|
|
|
|
You need not define this macro if it always returns <CODE>Pmode</CODE>. You
|
|
would most commonly define this macro if the
|
|
<CODE>save_stack_<VAR>level</VAR></CODE> patterns need to support both a 32- and a
|
|
64-bit mode.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1213"></A>
|
|
<DT><CODE>STACK_SIZE_MODE</CODE>
|
|
<DD>If defined, an expression of type <CODE>enum machine_mode</CODE> that
|
|
specifies the mode of the size increment operand of an
|
|
<CODE>allocate_stack</CODE> named pattern (see section <A HREF="gcc_16.html#SEC182" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_16.html#SEC182">16.7 Standard Pattern Names For Generation</A>).
|
|
<P>
|
|
|
|
You need not define this macro if it always returns <CODE>word_mode</CODE>.
|
|
You would most commonly define this macro if the <CODE>allocate_stack</CODE>
|
|
pattern needs to support both a 32- and a 64-bit mode.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1214"></A>
|
|
<DT><CODE>CHECK_FLOAT_VALUE (<VAR>mode</VAR>, <VAR>value</VAR>, <VAR>overflow</VAR>)</CODE>
|
|
<DD>A C statement to validate the value <VAR>value</VAR> (of type
|
|
<CODE>double</CODE>) for mode <VAR>mode</VAR>. This means that you check whether
|
|
<VAR>value</VAR> fits within the possible range of values for mode
|
|
<VAR>mode</VAR> on this target machine. The mode <VAR>mode</VAR> is always
|
|
a mode of class <CODE>MODE_FLOAT</CODE>. <VAR>overflow</VAR> is nonzero if
|
|
the value is already known to be out of range.
|
|
<P>
|
|
|
|
If <VAR>value</VAR> is not valid or if <VAR>overflow</VAR> is nonzero, you should
|
|
set <VAR>overflow</VAR> to 1 and then assign some valid value to <VAR>value</VAR>.
|
|
Allowing an invalid value to go through the compiler can produce
|
|
incorrect assembler code which may even cause Unix assemblers to crash.
|
|
</P><P>
|
|
|
|
This macro need not be defined if there is no work for it to do.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1215"></A>
|
|
<DT><CODE>TARGET_FLOAT_FORMAT</CODE>
|
|
<DD>A code distinguishing the floating point format of the target machine.
|
|
There are three defined values:
|
|
<P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1216"></A>
|
|
<DT><CODE>IEEE_FLOAT_FORMAT</CODE>
|
|
<DD>This code indicates IEEE floating point. It is the default; there is no
|
|
need to define this macro when the format is IEEE.
|
|
<P>
|
|
|
|
<A NAME="IDX1217"></A>
|
|
<DT><CODE>VAX_FLOAT_FORMAT</CODE>
|
|
<DD>This code indicates the peculiar format used on the Vax.
|
|
<P>
|
|
|
|
<A NAME="IDX1218"></A>
|
|
<DT><CODE>UNKNOWN_FLOAT_FORMAT</CODE>
|
|
<DD>This code indicates any other format.
|
|
</DL>
|
|
<P>
|
|
|
|
The value of this macro is compared with <CODE>HOST_FLOAT_FORMAT</CODE>
|
|
(see section <A HREF="gcc_18.html#SEC251" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_18.html#SEC251">18. The Configuration File</A>) to determine whether the target machine has the same
|
|
format as the host machine. If any other formats are actually in use on
|
|
supported machines, new codes should be defined for them.
|
|
</P><P>
|
|
|
|
The ordering of the component words of floating point values stored in
|
|
memory is controlled by <CODE>FLOAT_WORDS_BIG_ENDIAN</CODE> for the target
|
|
machine and <CODE>HOST_FLOAT_WORDS_BIG_ENDIAN</CODE> for the host.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1219"></A>
|
|
<DT><CODE>DEFAULT_VTABLE_THUNKS</CODE>
|
|
<DD>GNU CC supports two ways of implementing C++ vtables: traditional or with
|
|
so-called "thunks". The flag <SAMP>`-fvtable-thunk'</SAMP> chooses between them.
|
|
Define this macro to be a C expression for the default value of that flag.
|
|
If <CODE>DEFAULT_VTABLE_THUNKS</CODE> is 0, GNU CC uses the traditional
|
|
implementation by default. The "thunk" implementation is more efficient
|
|
(especially if you have provided an implementation of
|
|
<CODE>ASM_OUTPUT_MI_THUNK</CODE>, see <A HREF="gcc_17.html#SEC222" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC222">17.7.10 Function Entry and Exit</A>), but is not binary
|
|
compatible with code compiled using the traditional implementation.
|
|
If you are writing a new ports, define <CODE>DEFAULT_VTABLE_THUNKS</CODE> to 1.
|
|
<P>
|
|
|
|
If you do not define this macro, the default for <SAMP>`-fvtable-thunk'</SAMP> is 0.
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="Type Layout"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC203"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC202" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC202"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC204" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC204"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC204" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC204"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC199" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC199"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_18.html#SEC251" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_18.html#SEC251"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H2> 17.4 Layout of Source Language Data Types </H2>
|
|
<!--docid::SEC203::-->
|
|
<P>
|
|
|
|
These macros define the sizes and other characteristics of the standard
|
|
basic data types used in programs being compiled. Unlike the macros in
|
|
the previous section, these apply to specific features of C and related
|
|
languages, rather than to fundamental aspects of storage layout.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1220"></A>
|
|
<DT><CODE>INT_TYPE_SIZE</CODE>
|
|
<DD>A C expression for the size in bits of the type <CODE>int</CODE> on the
|
|
target machine. If you don't define this, the default is one word.
|
|
<P>
|
|
|
|
<A NAME="IDX1221"></A>
|
|
<DT><CODE>MAX_INT_TYPE_SIZE</CODE>
|
|
<DD>Maximum number for the size in bits of the type <CODE>int</CODE> on the target
|
|
machine. If this is undefined, the default is <CODE>INT_TYPE_SIZE</CODE>.
|
|
Otherwise, it is the constant value that is the largest value that
|
|
<CODE>INT_TYPE_SIZE</CODE> can have at run-time. This is used in <CODE>cpp</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX1222"></A>
|
|
<DT><CODE>SHORT_TYPE_SIZE</CODE>
|
|
<DD>A C expression for the size in bits of the type <CODE>short</CODE> on the
|
|
target machine. If you don't define this, the default is half a word.
|
|
(If this would be less than one storage unit, it is rounded up to one
|
|
unit.)
|
|
<P>
|
|
|
|
<A NAME="IDX1223"></A>
|
|
<DT><CODE>LONG_TYPE_SIZE</CODE>
|
|
<DD>A C expression for the size in bits of the type <CODE>long</CODE> on the
|
|
target machine. If you don't define this, the default is one word.
|
|
<P>
|
|
|
|
<A NAME="IDX1224"></A>
|
|
<DT><CODE>MAX_LONG_TYPE_SIZE</CODE>
|
|
<DD>Maximum number for the size in bits of the type <CODE>long</CODE> on the
|
|
target machine. If this is undefined, the default is
|
|
<CODE>LONG_TYPE_SIZE</CODE>. Otherwise, it is the constant value that is the
|
|
largest value that <CODE>LONG_TYPE_SIZE</CODE> can have at run-time. This is
|
|
used in <CODE>cpp</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX1225"></A>
|
|
<DT><CODE>LONG_LONG_TYPE_SIZE</CODE>
|
|
<DD>A C expression for the size in bits of the type <CODE>long long</CODE> on the
|
|
target machine. If you don't define this, the default is two
|
|
words. If you want to support GNU Ada on your machine, the value of
|
|
macro must be at least 64.
|
|
<P>
|
|
|
|
<A NAME="IDX1226"></A>
|
|
<DT><CODE>CHAR_TYPE_SIZE</CODE>
|
|
<DD>A C expression for the size in bits of the type <CODE>char</CODE> on the
|
|
target machine. If you don't define this, the default is one quarter
|
|
of a word. (If this would be less than one storage unit, it is rounded up
|
|
to one unit.)
|
|
<P>
|
|
|
|
<A NAME="IDX1227"></A>
|
|
<DT><CODE>MAX_CHAR_TYPE_SIZE</CODE>
|
|
<DD>Maximum number for the size in bits of the type <CODE>char</CODE> on the
|
|
target machine. If this is undefined, the default is
|
|
<CODE>CHAR_TYPE_SIZE</CODE>. Otherwise, it is the constant value that is the
|
|
largest value that <CODE>CHAR_TYPE_SIZE</CODE> can have at run-time. This is
|
|
used in <CODE>cpp</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX1228"></A>
|
|
<DT><CODE>FLOAT_TYPE_SIZE</CODE>
|
|
<DD>A C expression for the size in bits of the type <CODE>float</CODE> on the
|
|
target machine. If you don't define this, the default is one word.
|
|
<P>
|
|
|
|
<A NAME="IDX1229"></A>
|
|
<DT><CODE>DOUBLE_TYPE_SIZE</CODE>
|
|
<DD>A C expression for the size in bits of the type <CODE>double</CODE> on the
|
|
target machine. If you don't define this, the default is two
|
|
words.
|
|
<P>
|
|
|
|
<A NAME="IDX1230"></A>
|
|
<DT><CODE>LONG_DOUBLE_TYPE_SIZE</CODE>
|
|
<DD>A C expression for the size in bits of the type <CODE>long double</CODE> on
|
|
the target machine. If you don't define this, the default is two
|
|
words.
|
|
<P>
|
|
|
|
<A NAME="IDX1231"></A>
|
|
<DT><CODE>WIDEST_HARDWARE_FP_SIZE</CODE>
|
|
<DD>A C expression for the size in bits of the widest floating-point format
|
|
supported by the hardware. If you define this macro, you must specify a
|
|
value less than or equal to the value of <CODE>LONG_DOUBLE_TYPE_SIZE</CODE>.
|
|
If you do not define this macro, the value of <CODE>LONG_DOUBLE_TYPE_SIZE</CODE>
|
|
is the default.
|
|
<P>
|
|
|
|
<A NAME="IDX1232"></A>
|
|
<DT><CODE>DEFAULT_SIGNED_CHAR</CODE>
|
|
<DD>An expression whose value is 1 or 0, according to whether the type
|
|
<CODE>char</CODE> should be signed or unsigned by default. The user can
|
|
always override this default with the options <SAMP>`-fsigned-char'</SAMP>
|
|
and <SAMP>`-funsigned-char'</SAMP>.
|
|
<P>
|
|
|
|
<A NAME="IDX1233"></A>
|
|
<DT><CODE>DEFAULT_SHORT_ENUMS</CODE>
|
|
<DD>A C expression to determine whether to give an <CODE>enum</CODE> type
|
|
only as many bytes as it takes to represent the range of possible values
|
|
of that type. A nonzero value means to do that; a zero value means all
|
|
<CODE>enum</CODE> types should be allocated like <CODE>int</CODE>.
|
|
<P>
|
|
|
|
If you don't define the macro, the default is 0.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1234"></A>
|
|
<DT><CODE>SIZE_TYPE</CODE>
|
|
<DD>A C expression for a string describing the name of the data type to use
|
|
for size values. The typedef name <CODE>size_t</CODE> is defined using the
|
|
contents of the string.
|
|
<P>
|
|
|
|
The string can contain more than one keyword. If so, separate them with
|
|
spaces, and write first any length keyword, then <CODE>unsigned</CODE> if
|
|
appropriate, and finally <CODE>int</CODE>. The string must exactly match one
|
|
of the data type names defined in the function
|
|
<CODE>init_decl_processing</CODE> in the file <TT>`c-decl.c'</TT>. You may not
|
|
omit <CODE>int</CODE> or change the order--that would cause the compiler to
|
|
crash on startup.
|
|
</P><P>
|
|
|
|
If you don't define this macro, the default is <CODE>"long unsigned
|
|
int"</CODE>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1235"></A>
|
|
<DT><CODE>PTRDIFF_TYPE</CODE>
|
|
<DD>A C expression for a string describing the name of the data type to use
|
|
for the result of subtracting two pointers. The typedef name
|
|
<CODE>ptrdiff_t</CODE> is defined using the contents of the string. See
|
|
<CODE>SIZE_TYPE</CODE> above for more information.
|
|
<P>
|
|
|
|
If you don't define this macro, the default is <CODE>"long int"</CODE>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1236"></A>
|
|
<DT><CODE>WCHAR_TYPE</CODE>
|
|
<DD>A C expression for a string describing the name of the data type to use
|
|
for wide characters. The typedef name <CODE>wchar_t</CODE> is defined using
|
|
the contents of the string. See <CODE>SIZE_TYPE</CODE> above for more
|
|
information.
|
|
<P>
|
|
|
|
If you don't define this macro, the default is <CODE>"int"</CODE>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1237"></A>
|
|
<DT><CODE>WCHAR_TYPE_SIZE</CODE>
|
|
<DD>A C expression for the size in bits of the data type for wide
|
|
characters. This is used in <CODE>cpp</CODE>, which cannot make use of
|
|
<CODE>WCHAR_TYPE</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX1238"></A>
|
|
<DT><CODE>MAX_WCHAR_TYPE_SIZE</CODE>
|
|
<DD>Maximum number for the size in bits of the data type for wide
|
|
characters. If this is undefined, the default is
|
|
<CODE>WCHAR_TYPE_SIZE</CODE>. Otherwise, it is the constant value that is the
|
|
largest value that <CODE>WCHAR_TYPE_SIZE</CODE> can have at run-time. This is
|
|
used in <CODE>cpp</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX1239"></A>
|
|
<DT><CODE>OBJC_INT_SELECTORS</CODE>
|
|
<DD>Define this macro if the type of Objective C selectors should be
|
|
<CODE>int</CODE>.
|
|
<P>
|
|
|
|
If this macro is not defined, then selectors should have the type
|
|
<CODE>struct objc_selector *</CODE>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1240"></A>
|
|
<DT><CODE>OBJC_SELECTORS_WITHOUT_LABELS</CODE>
|
|
<DD>Define this macro if the compiler can group all the selectors together
|
|
into a vector and use just one label at the beginning of the vector.
|
|
Otherwise, the compiler must give each selector its own assembler
|
|
label.
|
|
<P>
|
|
|
|
On certain machines, it is important to have a separate label for each
|
|
selector because this enables the linker to eliminate duplicate selectors.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1241"></A>
|
|
<DT><CODE>TARGET_BELL</CODE>
|
|
<DD>A C constant expression for the integer value for escape sequence
|
|
<SAMP>`\a'</SAMP>.
|
|
<P>
|
|
|
|
<A NAME="IDX1242"></A>
|
|
<A NAME="IDX1243"></A>
|
|
<A NAME="IDX1244"></A>
|
|
<DT><CODE>TARGET_BS</CODE>
|
|
<DD><DT><CODE>TARGET_TAB</CODE>
|
|
<DD><DT><CODE>TARGET_NEWLINE</CODE>
|
|
<DD>C constant expressions for the integer values for escape sequences
|
|
<SAMP>`\b'</SAMP>, <SAMP>`\t'</SAMP> and <SAMP>`\n'</SAMP>.
|
|
<P>
|
|
|
|
<A NAME="IDX1245"></A>
|
|
<A NAME="IDX1246"></A>
|
|
<A NAME="IDX1247"></A>
|
|
<DT><CODE>TARGET_VT</CODE>
|
|
<DD><DT><CODE>TARGET_FF</CODE>
|
|
<DD><DT><CODE>TARGET_CR</CODE>
|
|
<DD>C constant expressions for the integer values for escape sequences
|
|
<SAMP>`\v'</SAMP>, <SAMP>`\f'</SAMP> and <SAMP>`\r'</SAMP>.
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="Registers"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC204"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC203" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC203"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC205" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC205"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC211" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC211"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC199" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC199"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC211" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC211"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H2> 17.5 Register Usage </H2>
|
|
<!--docid::SEC204::-->
|
|
<P>
|
|
|
|
This section explains how to describe what registers the target machine
|
|
has, and how (in general) they can be used.
|
|
</P><P>
|
|
|
|
The description of which registers a specific instruction can use is
|
|
done with register classes; see <A HREF="gcc_17.html#SEC211" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC211">17.6 Register Classes</A>. For information
|
|
on using registers to access a stack frame, see <A HREF="gcc_17.html#SEC215" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC215">17.7.3 Registers That Address the Stack Frame</A>.
|
|
For passing values in registers, see <A HREF="gcc_17.html#SEC218" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC218">17.7.6 Passing Arguments in Registers</A>.
|
|
For returning values in registers, see <A HREF="gcc_17.html#SEC219" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC219">17.7.7 How Scalar Function Values Are Returned</A>.
|
|
</P><P>
|
|
|
|
<BLOCKQUOTE><TABLE BORDER=0 CELLSPACING=0>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC205" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC205">17.5.1 Basic Characteristics of Registers</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">Number and kinds of registers.</TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC206" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC206">17.5.2 Order of Allocation of Registers</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">Order in which registers are allocated.</TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC207" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC207">17.5.3 How Values Fit in Registers</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">What kinds of values each reg can hold.</TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC208" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC208">17.5.4 Handling Leaf Functions</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">Renumbering registers for leaf functions.</TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC209" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC209">17.5.5 Registers That Form a Stack</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">Handling a register stack such as 80387.</TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC210" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC210">17.5.6 Obsolete Macros for Controlling Register Usage</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">Macros formerly used for the 80387.</TD></TR>
|
|
</TABLE></BLOCKQUOTE>
|
|
<P>
|
|
|
|
<A NAME="Register Basics"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC205"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC204" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC204"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC206" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC206"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC211" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC211"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC204" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC204"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC211" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC211"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H3> 17.5.1 Basic Characteristics of Registers </H3>
|
|
<!--docid::SEC205::-->
|
|
<P>
|
|
|
|
Registers have various characteristics.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1248"></A>
|
|
<DT><CODE>FIRST_PSEUDO_REGISTER</CODE>
|
|
<DD>Number of hardware registers known to the compiler. They receive
|
|
numbers 0 through <CODE>FIRST_PSEUDO_REGISTER-1</CODE>; thus, the first
|
|
pseudo register's number really is assigned the number
|
|
<CODE>FIRST_PSEUDO_REGISTER</CODE>.
|
|
<P>
|
|
|
|
<DT><CODE>FIXED_REGISTERS</CODE>
|
|
<DD><A NAME="IDX1249"></A>
|
|
<A NAME="IDX1250"></A>
|
|
An initializer that says which registers are used for fixed purposes
|
|
all throughout the compiled code and are therefore not available for
|
|
general allocation. These would include the stack pointer, the frame
|
|
pointer (except on machines where that can be used as a general
|
|
register when no frame pointer is needed), the program counter on
|
|
machines where that is considered one of the addressable registers,
|
|
and any other numbered register with a standard use.
|
|
<P>
|
|
|
|
This information is expressed as a sequence of numbers, separated by
|
|
commas and surrounded by braces. The <VAR>n</VAR>th number is 1 if
|
|
register <VAR>n</VAR> is fixed, 0 otherwise.
|
|
</P><P>
|
|
|
|
The table initialized from this macro, and the table initialized by
|
|
the following one, may be overridden at run time either automatically,
|
|
by the actions of the macro <CODE>CONDITIONAL_REGISTER_USAGE</CODE>, or by
|
|
the user with the command options <SAMP>`-ffixed-<VAR>reg</VAR>'</SAMP>,
|
|
<SAMP>`-fcall-used-<VAR>reg</VAR>'</SAMP> and <SAMP>`-fcall-saved-<VAR>reg</VAR>'</SAMP>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1251"></A>
|
|
<DT><CODE>CALL_USED_REGISTERS</CODE>
|
|
<DD><A NAME="IDX1252"></A>
|
|
<A NAME="IDX1253"></A>
|
|
<A NAME="IDX1254"></A>
|
|
Like <CODE>FIXED_REGISTERS</CODE> but has 1 for each register that is
|
|
clobbered (in general) by function calls as well as for fixed
|
|
registers. This macro therefore identifies the registers that are not
|
|
available for general allocation of values that must live across
|
|
function calls.
|
|
<P>
|
|
|
|
If a register has 0 in <CODE>CALL_USED_REGISTERS</CODE>, the compiler
|
|
automatically saves it on function entry and restores it on function
|
|
exit, if the register is used within the function.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1255"></A>
|
|
<DT><CODE>HARD_REGNO_CALL_PART_CLOBBERED (<VAR>regno</VAR>, <VAR>mode</VAR>)</CODE>
|
|
<DD><A NAME="IDX1256"></A>
|
|
<A NAME="IDX1257"></A>
|
|
<A NAME="IDX1258"></A>
|
|
A C expression that is non-zero if it is not permissible to store a
|
|
value of mode <VAR>mode</VAR> in hard register number <VAR>regno</VAR> across a
|
|
call without some part of it being clobbered. For most machines this
|
|
macro need not be defined. It is only required for machines that do not
|
|
preserve the entire contents of a register across a call.
|
|
<P>
|
|
|
|
<A NAME="IDX1259"></A>
|
|
<A NAME="IDX1260"></A>
|
|
<A NAME="IDX1261"></A>
|
|
<DT><CODE>CONDITIONAL_REGISTER_USAGE</CODE>
|
|
<DD>Zero or more C statements that may conditionally modify four variables
|
|
<CODE>fixed_regs</CODE>, <CODE>call_used_regs</CODE>, <CODE>global_regs</CODE>
|
|
(these three are of type <CODE>char []</CODE>) and <CODE>reg_class_contents</CODE>
|
|
(of type <CODE>HARD_REG_SET</CODE>).
|
|
Before the macro is called <CODE>fixed_regs</CODE>, <CODE>call_used_regs</CODE>
|
|
and <CODE>reg_class_contents</CODE> have been initialized from
|
|
<CODE>FIXED_REGISTERS</CODE>, <CODE>CALL_USED_REGISTERS</CODE> and
|
|
<CODE>REG_CLASS_CONTENTS</CODE>, respectively,
|
|
<CODE>global_regs</CODE> has been cleared, and any <SAMP>`-ffixed-<VAR>reg</VAR>'</SAMP>,
|
|
<SAMP>`-fcall-used-<VAR>reg</VAR>'</SAMP> and <SAMP>`-fcall-saved-<VAR>reg</VAR>'</SAMP> command
|
|
options have been applied.
|
|
<P>
|
|
|
|
This is necessary in case the fixed or call-clobbered registers depend
|
|
on target flags.
|
|
</P><P>
|
|
|
|
You need not define this macro if it has no work to do.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1262"></A>
|
|
<A NAME="IDX1263"></A>
|
|
If the usage of an entire class of registers depends on the target
|
|
flags, you may indicate this to GCC by using this macro to modify
|
|
<CODE>fixed_regs</CODE> and <CODE>call_used_regs</CODE> to 1 for each of the
|
|
registers in the classes which should not be used by GCC. Also define
|
|
the macro <CODE>REG_CLASS_FROM_LETTER</CODE> to return <CODE>NO_REGS</CODE> if it
|
|
is called with a letter for a class that shouldn't be used.
|
|
</P><P>
|
|
|
|
(However, if this class is not included in <CODE>GENERAL_REGS</CODE> and all
|
|
of the insn patterns whose constraints permit this class are
|
|
controlled by target switches, then GCC will automatically avoid using
|
|
these registers when the target switches are opposed to them.)
|
|
</P><P>
|
|
|
|
<A NAME="IDX1264"></A>
|
|
<DT><CODE>NON_SAVING_SETJMP</CODE>
|
|
<DD>If this macro is defined and has a nonzero value, it means that
|
|
<CODE>setjmp</CODE> and related functions fail to save the registers, or that
|
|
<CODE>longjmp</CODE> fails to restore them. To compensate, the compiler
|
|
avoids putting variables in registers in functions that use
|
|
<CODE>setjmp</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX1265"></A>
|
|
<DT><CODE>INCOMING_REGNO (<VAR>out</VAR>)</CODE>
|
|
<DD>Define this macro if the target machine has register windows. This C
|
|
expression returns the register number as seen by the called function
|
|
corresponding to the register number <VAR>out</VAR> as seen by the calling
|
|
function. Return <VAR>out</VAR> if register number <VAR>out</VAR> is not an
|
|
outbound register.
|
|
<P>
|
|
|
|
<A NAME="IDX1266"></A>
|
|
<DT><CODE>OUTGOING_REGNO (<VAR>in</VAR>)</CODE>
|
|
<DD>Define this macro if the target machine has register windows. This C
|
|
expression returns the register number as seen by the calling function
|
|
corresponding to the register number <VAR>in</VAR> as seen by the called
|
|
function. Return <VAR>in</VAR> if register number <VAR>in</VAR> is not an inbound
|
|
register.
|
|
<P>
|
|
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="Allocation Order"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC206"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC205" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC205"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC207" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC207"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC207" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC207"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC204" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC204"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC211" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC211"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H3> 17.5.2 Order of Allocation of Registers </H3>
|
|
<!--docid::SEC206::-->
|
|
<P>
|
|
|
|
Registers are allocated in order.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1267"></A>
|
|
<DT><CODE>REG_ALLOC_ORDER</CODE>
|
|
<DD>If defined, an initializer for a vector of integers, containing the
|
|
numbers of hard registers in the order in which GNU CC should prefer
|
|
to use them (from most preferred to least).
|
|
<P>
|
|
|
|
If this macro is not defined, registers are used lowest numbered first
|
|
(all else being equal).
|
|
</P><P>
|
|
|
|
One use of this macro is on machines where the highest numbered
|
|
registers must always be saved and the save-multiple-registers
|
|
instruction supports only sequences of consecutive registers. On such
|
|
machines, define <CODE>REG_ALLOC_ORDER</CODE> to be an initializer that lists
|
|
the highest numbered allocable register first.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1268"></A>
|
|
<DT><CODE>ORDER_REGS_FOR_LOCAL_ALLOC</CODE>
|
|
<DD>A C statement (sans semicolon) to choose the order in which to allocate
|
|
hard registers for pseudo-registers local to a basic block.
|
|
<P>
|
|
|
|
Store the desired register order in the array <CODE>reg_alloc_order</CODE>.
|
|
Element 0 should be the register to allocate first; element 1, the next
|
|
register; and so on.
|
|
</P><P>
|
|
|
|
The macro body should not assume anything about the contents of
|
|
<CODE>reg_alloc_order</CODE> before execution of the macro.
|
|
</P><P>
|
|
|
|
On most machines, it is not necessary to define this macro.
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="Values in Registers"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC207"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC206" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC206"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC208" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC208"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC208" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC208"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC204" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC204"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC211" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC211"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H3> 17.5.3 How Values Fit in Registers </H3>
|
|
<!--docid::SEC207::-->
|
|
<P>
|
|
|
|
This section discusses the macros that describe which kinds of values
|
|
(specifically, which machine modes) each register can hold, and how many
|
|
consecutive registers are needed for a given mode.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1269"></A>
|
|
<DT><CODE>HARD_REGNO_NREGS (<VAR>regno</VAR>, <VAR>mode</VAR>)</CODE>
|
|
<DD>A C expression for the number of consecutive hard registers, starting
|
|
at register number <VAR>regno</VAR>, required to hold a value of mode
|
|
<VAR>mode</VAR>.
|
|
<P>
|
|
|
|
On a machine where all registers are exactly one word, a suitable
|
|
definition of this macro is
|
|
</P><P>
|
|
|
|
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>#define HARD_REGNO_NREGS(REGNO, MODE) \
|
|
((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) \
|
|
/ UNITS_PER_WORD))
|
|
</FONT></pre></td></tr></table></P><P>
|
|
|
|
<A NAME="IDX1270"></A>
|
|
<DT><CODE>ALTER_HARD_SUBREG (<VAR>tgt_mode</VAR>, <VAR>word</VAR>, <VAR>src_mode</VAR>, <VAR>regno</VAR>)</CODE>
|
|
<DD>A C expression that returns an adjusted hard register number for
|
|
<P>
|
|
|
|
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(subreg:<VAR>tgt_mode</VAR> (reg:<VAR>src_mode</VAR> <VAR>regno</VAR>) <VAR>word</VAR>)
|
|
</FONT></pre></td></tr></table></P><P>
|
|
|
|
This may be needed if the target machine has mixed sized big-endian
|
|
registers, like Sparc v9.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1271"></A>
|
|
<DT><CODE>HARD_REGNO_MODE_OK (<VAR>regno</VAR>, <VAR>mode</VAR>)</CODE>
|
|
<DD>A C expression that is nonzero if it is permissible to store a value
|
|
of mode <VAR>mode</VAR> in hard register number <VAR>regno</VAR> (or in several
|
|
registers starting with that one). For a machine where all registers
|
|
are equivalent, a suitable definition is
|
|
<P>
|
|
|
|
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>#define HARD_REGNO_MODE_OK(REGNO, MODE) 1
|
|
</FONT></pre></td></tr></table></P><P>
|
|
|
|
You need not include code to check for the numbers of fixed registers,
|
|
because the allocation mechanism considers them to be always occupied.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1272"></A>
|
|
On some machines, double-precision values must be kept in even/odd
|
|
register pairs. You can implement that by defining this macro to reject
|
|
odd register numbers for such modes.
|
|
</P><P>
|
|
|
|
The minimum requirement for a mode to be OK in a register is that the
|
|
<SAMP>`mov<VAR>mode</VAR>'</SAMP> instruction pattern support moves between the
|
|
register and other hard register in the same class and that moving a
|
|
value into the register and back out not alter it.
|
|
</P><P>
|
|
|
|
Since the same instruction used to move <CODE>word_mode</CODE> will work for
|
|
all narrower integer modes, it is not necessary on any machine for
|
|
<CODE>HARD_REGNO_MODE_OK</CODE> to distinguish between these modes, provided
|
|
you define patterns <SAMP>`movhi'</SAMP>, etc., to take advantage of this. This
|
|
is useful because of the interaction between <CODE>HARD_REGNO_MODE_OK</CODE>
|
|
and <CODE>MODES_TIEABLE_P</CODE>; it is very desirable for all integer modes
|
|
to be tieable.
|
|
</P><P>
|
|
|
|
Many machines have special registers for floating point arithmetic.
|
|
Often people assume that floating point machine modes are allowed only
|
|
in floating point registers. This is not true. Any registers that
|
|
can hold integers can safely <EM>hold</EM> a floating point machine
|
|
mode, whether or not floating arithmetic can be done on it in those
|
|
registers. Integer move instructions can be used to move the values.
|
|
</P><P>
|
|
|
|
On some machines, though, the converse is true: fixed-point machine
|
|
modes may not go in floating registers. This is true if the floating
|
|
registers normalize any value stored in them, because storing a
|
|
non-floating value there would garble it. In this case,
|
|
<CODE>HARD_REGNO_MODE_OK</CODE> should reject fixed-point machine modes in
|
|
floating registers. But if the floating registers do not automatically
|
|
normalize, if you can store any bit pattern in one and retrieve it
|
|
unchanged without a trap, then any machine mode may go in a floating
|
|
register, so you can define this macro to say so.
|
|
</P><P>
|
|
|
|
The primary significance of special floating registers is rather that
|
|
they are the registers acceptable in floating point arithmetic
|
|
instructions. However, this is of no concern to
|
|
<CODE>HARD_REGNO_MODE_OK</CODE>. You handle it by writing the proper
|
|
constraints for those instructions.
|
|
</P><P>
|
|
|
|
On some machines, the floating registers are especially slow to access,
|
|
so that it is better to store a value in a stack frame than in such a
|
|
register if floating point arithmetic is not being done. As long as the
|
|
floating registers are not in class <CODE>GENERAL_REGS</CODE>, they will not
|
|
be used unless some pattern's constraint asks for one.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1273"></A>
|
|
<DT><CODE>MODES_TIEABLE_P (<VAR>mode1</VAR>, <VAR>mode2</VAR>)</CODE>
|
|
<DD>A C expression that is nonzero if a value of mode
|
|
<VAR>mode1</VAR> is accessible in mode <VAR>mode2</VAR> without copying.
|
|
<P>
|
|
|
|
If <CODE>HARD_REGNO_MODE_OK (<VAR>r</VAR>, <VAR>mode1</VAR>)</CODE> and
|
|
<CODE>HARD_REGNO_MODE_OK (<VAR>r</VAR>, <VAR>mode2</VAR>)</CODE> are always the same for
|
|
any <VAR>r</VAR>, then <CODE>MODES_TIEABLE_P (<VAR>mode1</VAR>, <VAR>mode2</VAR>)</CODE>
|
|
should be nonzero. If they differ for any <VAR>r</VAR>, you should define
|
|
this macro to return zero unless some other mechanism ensures the
|
|
accessibility of the value in a narrower mode.
|
|
</P><P>
|
|
|
|
You should define this macro to return nonzero in as many cases as
|
|
possible since doing so will allow GNU CC to perform better register
|
|
allocation.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1274"></A>
|
|
<DT><CODE>AVOID_CCMODE_COPIES</CODE>
|
|
<DD>Define this macro if the compiler should avoid copies to/from <CODE>CCmode</CODE>
|
|
registers. You should only define this macro if support fo copying to/from
|
|
<CODE>CCmode</CODE> is incomplete.
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="Leaf Functions"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC208"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC207" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC207"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC209" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC209"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC209" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC209"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC204" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC204"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC211" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC211"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H3> 17.5.4 Handling Leaf Functions </H3>
|
|
<!--docid::SEC208::-->
|
|
<P>
|
|
|
|
<A NAME="IDX1275"></A>
|
|
<A NAME="IDX1276"></A>
|
|
On some machines, a leaf function (i.e., one which makes no calls) can run
|
|
more efficiently if it does not make its own register window. Often this
|
|
means it is required to receive its arguments in the registers where they
|
|
are passed by the caller, instead of the registers where they would
|
|
normally arrive.
|
|
</P><P>
|
|
|
|
The special treatment for leaf functions generally applies only when
|
|
other conditions are met; for example, often they may use only those
|
|
registers for its own variables and temporaries. We use the term "leaf
|
|
function" to mean a function that is suitable for this special
|
|
handling, so that functions with no calls are not necessarily "leaf
|
|
functions".
|
|
</P><P>
|
|
|
|
GNU CC assigns register numbers before it knows whether the function is
|
|
suitable for leaf function treatment. So it needs to renumber the
|
|
registers in order to output a leaf function. The following macros
|
|
accomplish this.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1277"></A>
|
|
<DT><CODE>LEAF_REGISTERS</CODE>
|
|
<DD>A C initializer for a vector, indexed by hard register number, which
|
|
contains 1 for a register that is allowable in a candidate for leaf
|
|
function treatment.
|
|
<P>
|
|
|
|
If leaf function treatment involves renumbering the registers, then the
|
|
registers marked here should be the ones before renumbering--those that
|
|
GNU CC would ordinarily allocate. The registers which will actually be
|
|
used in the assembler code, after renumbering, should not be marked with 1
|
|
in this vector.
|
|
</P><P>
|
|
|
|
Define this macro only if the target machine offers a way to optimize
|
|
the treatment of leaf functions.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1278"></A>
|
|
<DT><CODE>LEAF_REG_REMAP (<VAR>regno</VAR>)</CODE>
|
|
<DD>A C expression whose value is the register number to which <VAR>regno</VAR>
|
|
should be renumbered, when a function is treated as a leaf function.
|
|
<P>
|
|
|
|
If <VAR>regno</VAR> is a register number which should not appear in a leaf
|
|
function before renumbering, then the expression should yield -1, which
|
|
will cause the compiler to abort.
|
|
</P><P>
|
|
|
|
Define this macro only if the target machine offers a way to optimize the
|
|
treatment of leaf functions, and registers need to be renumbered to do
|
|
this.
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="IDX1279"></A>
|
|
<A NAME="IDX1280"></A>
|
|
Normally, <CODE>FUNCTION_PROLOGUE</CODE> and <CODE>FUNCTION_EPILOGUE</CODE> must
|
|
treat leaf functions specially. They can test the C variable
|
|
<CODE>current_function_is_leaf</CODE> which is nonzero for leaf functions.
|
|
<CODE>current_function_is_leaf</CODE> is set prior to local register allocation
|
|
and is valid for the remaining compiler passes. They can also test the C
|
|
variable <CODE>current_function_uses_only_leaf_regs</CODE> which is nonzero for
|
|
leaf functions which only use leaf registers.
|
|
<CODE>current_function_uses_only_leaf_regs</CODE> is valid after reload and is
|
|
only useful if <CODE>LEAF_REGISTERS</CODE> is defined.
|
|
</P><P>
|
|
|
|
<A NAME="Stack Registers"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC209"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC208" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC208"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC210" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC210"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC210" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC210"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC204" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC204"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC211" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC211"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H3> 17.5.5 Registers That Form a Stack </H3>
|
|
<!--docid::SEC209::-->
|
|
<P>
|
|
|
|
There are special features to handle computers where some of the
|
|
"registers" form a stack, as in the 80387 coprocessor for the 80386.
|
|
Stack registers are normally written by pushing onto the stack, and are
|
|
numbered relative to the top of the stack.
|
|
</P><P>
|
|
|
|
Currently, GNU CC can only handle one group of stack-like registers, and
|
|
they must be consecutively numbered.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1281"></A>
|
|
<DT><CODE>STACK_REGS</CODE>
|
|
<DD>Define this if the machine has any stack-like registers.
|
|
<P>
|
|
|
|
<A NAME="IDX1282"></A>
|
|
<DT><CODE>FIRST_STACK_REG</CODE>
|
|
<DD>The number of the first stack-like register. This one is the top
|
|
of the stack.
|
|
<P>
|
|
|
|
<A NAME="IDX1283"></A>
|
|
<DT><CODE>LAST_STACK_REG</CODE>
|
|
<DD>The number of the last stack-like register. This one is the bottom of
|
|
the stack.
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="Obsolete Register Macros"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC210"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC209" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC209"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC211" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC211"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC211" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC211"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC204" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC204"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC211" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC211"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H3> 17.5.6 Obsolete Macros for Controlling Register Usage </H3>
|
|
<!--docid::SEC210::-->
|
|
<P>
|
|
|
|
These features do not work very well. They exist because they used to
|
|
be required to generate correct code for the 80387 coprocessor of the
|
|
80386. They are no longer used by that machine description and may be
|
|
removed in a later version of the compiler. Don't use them!
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1284"></A>
|
|
<DT><CODE>OVERLAPPING_REGNO_P (<VAR>regno</VAR>)</CODE>
|
|
<DD>If defined, this is a C expression whose value is nonzero if hard
|
|
register number <VAR>regno</VAR> is an overlapping register. This means a
|
|
hard register which overlaps a hard register with a different number.
|
|
(Such overlap is undesirable, but occasionally it allows a machine to
|
|
be supported which otherwise could not be.) This macro must return
|
|
nonzero for <EM>all</EM> the registers which overlap each other. GNU CC
|
|
can use an overlapping register only in certain limited ways. It can
|
|
be used for allocation within a basic block, and may be spilled for
|
|
reloading; that is all.
|
|
<P>
|
|
|
|
If this macro is not defined, it means that none of the hard registers
|
|
overlap each other. This is the usual situation.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1285"></A>
|
|
<DT><CODE>INSN_CLOBBERS_REGNO_P (<VAR>insn</VAR>, <VAR>regno</VAR>)</CODE>
|
|
<DD>If defined, this is a C expression whose value should be nonzero if
|
|
the insn <VAR>insn</VAR> has the effect of mysteriously clobbering the
|
|
contents of hard register number <VAR>regno</VAR>. By "mysterious" we
|
|
mean that the insn's RTL expression doesn't describe such an effect.
|
|
<P>
|
|
|
|
If this macro is not defined, it means that no insn clobbers registers
|
|
mysteriously. This is the usual situation; all else being equal,
|
|
it is best for the RTL expression to show all the activity.
|
|
</P><P>
|
|
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="Register Classes"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC211"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC210" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC210"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC212" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC212"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC212" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC212"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC199" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC199"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_18.html#SEC251" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_18.html#SEC251"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H2> 17.6 Register Classes </H2>
|
|
<!--docid::SEC211::-->
|
|
<P>
|
|
|
|
On many machines, the numbered registers are not all equivalent.
|
|
For example, certain registers may not be allowed for indexed addressing;
|
|
certain registers may not be allowed in some instructions. These machine
|
|
restrictions are described to the compiler using <EM>register classes</EM>.
|
|
</P><P>
|
|
|
|
You define a number of register classes, giving each one a name and saying
|
|
which of the registers belong to it. Then you can specify register classes
|
|
that are allowed as operands to particular instruction patterns.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1286"></A>
|
|
<A NAME="IDX1287"></A>
|
|
In general, each register will belong to several classes. In fact, one
|
|
class must be named <CODE>ALL_REGS</CODE> and contain all the registers. Another
|
|
class must be named <CODE>NO_REGS</CODE> and contain no registers. Often the
|
|
union of two classes will be another class; however, this is not required.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1288"></A>
|
|
One of the classes must be named <CODE>GENERAL_REGS</CODE>. There is nothing
|
|
terribly special about the name, but the operand constraint letters
|
|
<SAMP>`r'</SAMP> and <SAMP>`g'</SAMP> specify this class. If <CODE>GENERAL_REGS</CODE> is
|
|
the same as <CODE>ALL_REGS</CODE>, just define it as a macro which expands
|
|
to <CODE>ALL_REGS</CODE>.
|
|
</P><P>
|
|
|
|
Order the classes so that if class <VAR>x</VAR> is contained in class <VAR>y</VAR>
|
|
then <VAR>x</VAR> has a lower class number than <VAR>y</VAR>.
|
|
</P><P>
|
|
|
|
The way classes other than <CODE>GENERAL_REGS</CODE> are specified in operand
|
|
constraints is through machine-dependent operand constraint letters.
|
|
You can define such letters to correspond to various classes, then use
|
|
them in operand constraints.
|
|
</P><P>
|
|
|
|
You should define a class for the union of two classes whenever some
|
|
instruction allows both classes. For example, if an instruction allows
|
|
either a floating point (coprocessor) register or a general register for a
|
|
certain operand, you should define a class <CODE>FLOAT_OR_GENERAL_REGS</CODE>
|
|
which includes both of them. Otherwise you will get suboptimal code.
|
|
</P><P>
|
|
|
|
You must also specify certain redundant information about the register
|
|
classes: for each class, which classes contain it and which ones are
|
|
contained in it; for each pair of classes, the largest class contained
|
|
in their union.
|
|
</P><P>
|
|
|
|
When a value occupying several consecutive registers is expected in a
|
|
certain class, all the registers used must belong to that class.
|
|
Therefore, register classes cannot be used to enforce a requirement for
|
|
a register pair to start with an even-numbered register. The way to
|
|
specify this requirement is with <CODE>HARD_REGNO_MODE_OK</CODE>.
|
|
</P><P>
|
|
|
|
Register classes used for input-operands of bitwise-and or shift
|
|
instructions have a special requirement: each such class must have, for
|
|
each fixed-point machine mode, a subclass whose registers can transfer that
|
|
mode to or from memory. For example, on some machines, the operations for
|
|
single-byte values (<CODE>QImode</CODE>) are limited to certain registers. When
|
|
this is so, each register class that is used in a bitwise-and or shift
|
|
instruction must have a subclass consisting of registers from which
|
|
single-byte values can be loaded or stored. This is so that
|
|
<CODE>PREFERRED_RELOAD_CLASS</CODE> can always have a possible value to return.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1289"></A>
|
|
<DT><CODE>enum reg_class</CODE>
|
|
<DD>An enumeral type that must be defined with all the register class names
|
|
as enumeral values. <CODE>NO_REGS</CODE> must be first. <CODE>ALL_REGS</CODE>
|
|
must be the last register class, followed by one more enumeral value,
|
|
<CODE>LIM_REG_CLASSES</CODE>, which is not a register class but rather
|
|
tells how many classes there are.
|
|
<P>
|
|
|
|
Each register class has a number, which is the value of casting
|
|
the class name to type <CODE>int</CODE>. The number serves as an index
|
|
in many of the tables described below.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1290"></A>
|
|
<DT><CODE>N_REG_CLASSES</CODE>
|
|
<DD>The number of distinct register classes, defined as follows:
|
|
<P>
|
|
|
|
<TABLE><tr><td> </td><td class=example><pre>#define N_REG_CLASSES (int) LIM_REG_CLASSES
|
|
</pre></td></tr></table></P><P>
|
|
|
|
<A NAME="IDX1291"></A>
|
|
<DT><CODE>REG_CLASS_NAMES</CODE>
|
|
<DD>An initializer containing the names of the register classes as C string
|
|
constants. These names are used in writing some of the debugging dumps.
|
|
<P>
|
|
|
|
<A NAME="IDX1292"></A>
|
|
<DT><CODE>REG_CLASS_CONTENTS</CODE>
|
|
<DD>An initializer containing the contents of the register classes, as integers
|
|
which are bit masks. The <VAR>n</VAR>th integer specifies the contents of class
|
|
<VAR>n</VAR>. The way the integer <VAR>mask</VAR> is interpreted is that
|
|
register <VAR>r</VAR> is in the class if <CODE><VAR>mask</VAR> & (1 << <VAR>r</VAR>)</CODE> is 1.
|
|
<P>
|
|
|
|
When the machine has more than 32 registers, an integer does not suffice.
|
|
Then the integers are replaced by sub-initializers, braced groupings containing
|
|
several integers. Each sub-initializer must be suitable as an initializer
|
|
for the type <CODE>HARD_REG_SET</CODE> which is defined in <TT>`hard-reg-set.h'</TT>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1293"></A>
|
|
<DT><CODE>REGNO_REG_CLASS (<VAR>regno</VAR>)</CODE>
|
|
<DD>A C expression whose value is a register class containing hard register
|
|
<VAR>regno</VAR>. In general there is more than one such class; choose a class
|
|
which is <EM>minimal</EM>, meaning that no smaller class also contains the
|
|
register.
|
|
<P>
|
|
|
|
<A NAME="IDX1294"></A>
|
|
<DT><CODE>BASE_REG_CLASS</CODE>
|
|
<DD>A macro whose definition is the name of the class to which a valid
|
|
base register must belong. A base register is one used in an address
|
|
which is the register value plus a displacement.
|
|
<P>
|
|
|
|
<A NAME="IDX1295"></A>
|
|
<DT><CODE>INDEX_REG_CLASS</CODE>
|
|
<DD>A macro whose definition is the name of the class to which a valid
|
|
index register must belong. An index register is one used in an
|
|
address where its value is either multiplied by a scale factor or
|
|
added to another register (as well as added to a displacement).
|
|
<P>
|
|
|
|
<A NAME="IDX1296"></A>
|
|
<DT><CODE>REG_CLASS_FROM_LETTER (<VAR>char</VAR>)</CODE>
|
|
<DD>A C expression which defines the machine-dependent operand constraint
|
|
letters for register classes. If <VAR>char</VAR> is such a letter, the
|
|
value should be the register class corresponding to it. Otherwise,
|
|
the value should be <CODE>NO_REGS</CODE>. The register letter <SAMP>`r'</SAMP>,
|
|
corresponding to class <CODE>GENERAL_REGS</CODE>, will not be passed
|
|
to this macro; you do not need to handle it.
|
|
<P>
|
|
|
|
<A NAME="IDX1297"></A>
|
|
<DT><CODE>REGNO_OK_FOR_BASE_P (<VAR>num</VAR>)</CODE>
|
|
<DD>A C expression which is nonzero if register number <VAR>num</VAR> is
|
|
suitable for use as a base register in operand addresses. It may be
|
|
either a suitable hard register or a pseudo register that has been
|
|
allocated such a hard register.
|
|
<P>
|
|
|
|
<A NAME="IDX1298"></A>
|
|
<DT><CODE>REGNO_MODE_OK_FOR_BASE_P (<VAR>num</VAR>, <VAR>mode</VAR>)</CODE>
|
|
<DD>A C expression that is just like <CODE>REGNO_OK_FOR_BASE_P</CODE>, except that
|
|
that expression may examine the mode of the memory reference in
|
|
<VAR>mode</VAR>. You should define this macro if the mode of the memory
|
|
reference affects whether a register may be used as a base register. If
|
|
you define this macro, the compiler will use it instead of
|
|
<CODE>REGNO_OK_FOR_BASE_P</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX1299"></A>
|
|
<DT><CODE>REGNO_OK_FOR_INDEX_P (<VAR>num</VAR>)</CODE>
|
|
<DD>A C expression which is nonzero if register number <VAR>num</VAR> is
|
|
suitable for use as an index register in operand addresses. It may be
|
|
either a suitable hard register or a pseudo register that has been
|
|
allocated such a hard register.
|
|
<P>
|
|
|
|
The difference between an index register and a base register is that
|
|
the index register may be scaled. If an address involves the sum of
|
|
two registers, neither one of them scaled, then either one may be
|
|
labeled the "base" and the other the "index"; but whichever
|
|
labeling is used must fit the machine's constraints of which registers
|
|
may serve in each capacity. The compiler will try both labelings,
|
|
looking for one that is valid, and will reload one or both registers
|
|
only if neither labeling works.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1300"></A>
|
|
<DT><CODE>PREFERRED_RELOAD_CLASS (<VAR>x</VAR>, <VAR>class</VAR>)</CODE>
|
|
<DD>A C expression that places additional restrictions on the register class
|
|
to use when it is necessary to copy value <VAR>x</VAR> into a register in class
|
|
<VAR>class</VAR>. The value is a register class; perhaps <VAR>class</VAR>, or perhaps
|
|
another, smaller class. On many machines, the following definition is
|
|
safe:
|
|
<P>
|
|
|
|
<TABLE><tr><td> </td><td class=example><pre>#define PREFERRED_RELOAD_CLASS(X,CLASS) CLASS
|
|
</pre></td></tr></table></P><P>
|
|
|
|
Sometimes returning a more restrictive class makes better code. For
|
|
example, on the 68000, when <VAR>x</VAR> is an integer constant that is in range
|
|
for a <SAMP>`moveq'</SAMP> instruction, the value of this macro is always
|
|
<CODE>DATA_REGS</CODE> as long as <VAR>class</VAR> includes the data registers.
|
|
Requiring a data register guarantees that a <SAMP>`moveq'</SAMP> will be used.
|
|
</P><P>
|
|
|
|
If <VAR>x</VAR> is a <CODE>const_double</CODE>, by returning <CODE>NO_REGS</CODE>
|
|
you can force <VAR>x</VAR> into a memory constant. This is useful on
|
|
certain machines where immediate floating values cannot be loaded into
|
|
certain kinds of registers.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1301"></A>
|
|
<DT><CODE>PREFERRED_OUTPUT_RELOAD_CLASS (<VAR>x</VAR>, <VAR>class</VAR>)</CODE>
|
|
<DD>Like <CODE>PREFERRED_RELOAD_CLASS</CODE>, but for output reloads instead of
|
|
input reloads. If you don't define this macro, the default is to use
|
|
<VAR>class</VAR>, unchanged.
|
|
<P>
|
|
|
|
<A NAME="IDX1302"></A>
|
|
<DT><CODE>LIMIT_RELOAD_CLASS (<VAR>mode</VAR>, <VAR>class</VAR>)</CODE>
|
|
<DD>A C expression that places additional restrictions on the register class
|
|
to use when it is necessary to be able to hold a value of mode
|
|
<VAR>mode</VAR> in a reload register for which class <VAR>class</VAR> would
|
|
ordinarily be used.
|
|
<P>
|
|
|
|
Unlike <CODE>PREFERRED_RELOAD_CLASS</CODE>, this macro should be used when
|
|
there are certain modes that simply can't go in certain reload classes.
|
|
</P><P>
|
|
|
|
The value is a register class; perhaps <VAR>class</VAR>, or perhaps another,
|
|
smaller class.
|
|
</P><P>
|
|
|
|
Don't define this macro unless the target machine has limitations which
|
|
require the macro to do something nontrivial.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1303"></A>
|
|
<A NAME="IDX1304"></A>
|
|
<A NAME="IDX1305"></A>
|
|
<DT><CODE>SECONDARY_RELOAD_CLASS (<VAR>class</VAR>, <VAR>mode</VAR>, <VAR>x</VAR>)</CODE>
|
|
<DD><DT><CODE>SECONDARY_INPUT_RELOAD_CLASS (<VAR>class</VAR>, <VAR>mode</VAR>, <VAR>x</VAR>)</CODE>
|
|
<DD><DT><CODE>SECONDARY_OUTPUT_RELOAD_CLASS (<VAR>class</VAR>, <VAR>mode</VAR>, <VAR>x</VAR>)</CODE>
|
|
<DD>Many machines have some registers that cannot be copied directly to or
|
|
from memory or even from other types of registers. An example is the
|
|
<SAMP>`MQ'</SAMP> register, which on most machines, can only be copied to or
|
|
from general registers, but not memory. Some machines allow copying all
|
|
registers to and from memory, but require a scratch register for stores
|
|
to some memory locations (e.g., those with symbolic address on the RT,
|
|
and those with certain symbolic address on the Sparc when compiling
|
|
PIC). In some cases, both an intermediate and a scratch register are
|
|
required.
|
|
<P>
|
|
|
|
You should define these macros to indicate to the reload phase that it may
|
|
need to allocate at least one register for a reload in addition to the
|
|
register to contain the data. Specifically, if copying <VAR>x</VAR> to a
|
|
register <VAR>class</VAR> in <VAR>mode</VAR> requires an intermediate register,
|
|
you should define <CODE>SECONDARY_INPUT_RELOAD_CLASS</CODE> to return the
|
|
largest register class all of whose registers can be used as
|
|
intermediate registers or scratch registers.
|
|
</P><P>
|
|
|
|
If copying a register <VAR>class</VAR> in <VAR>mode</VAR> to <VAR>x</VAR> requires an
|
|
intermediate or scratch register, <CODE>SECONDARY_OUTPUT_RELOAD_CLASS</CODE>
|
|
should be defined to return the largest register class required. If the
|
|
requirements for input and output reloads are the same, the macro
|
|
<CODE>SECONDARY_RELOAD_CLASS</CODE> should be used instead of defining both
|
|
macros identically.
|
|
</P><P>
|
|
|
|
The values returned by these macros are often <CODE>GENERAL_REGS</CODE>.
|
|
Return <CODE>NO_REGS</CODE> if no spare register is needed; i.e., if <VAR>x</VAR>
|
|
can be directly copied to or from a register of <VAR>class</VAR> in
|
|
<VAR>mode</VAR> without requiring a scratch register. Do not define this
|
|
macro if it would always return <CODE>NO_REGS</CODE>.
|
|
</P><P>
|
|
|
|
If a scratch register is required (either with or without an
|
|
intermediate register), you should define patterns for
|
|
<SAMP>`reload_in<VAR>m</VAR>'</SAMP> or <SAMP>`reload_out<VAR>m</VAR>'</SAMP>, as required
|
|
(see section <A HREF="gcc_16.html#SEC182" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_16.html#SEC182">16.7 Standard Pattern Names For Generation</A>. These patterns, which will normally be
|
|
implemented with a <CODE>define_expand</CODE>, should be similar to the
|
|
<SAMP>`mov<VAR>m</VAR>'</SAMP> patterns, except that operand 2 is the scratch
|
|
register.
|
|
</P><P>
|
|
|
|
Define constraints for the reload register and scratch register that
|
|
contain a single register class. If the original reload register (whose
|
|
class is <VAR>class</VAR>) can meet the constraint given in the pattern, the
|
|
value returned by these macros is used for the class of the scratch
|
|
register. Otherwise, two additional reload registers are required.
|
|
Their classes are obtained from the constraints in the insn pattern.
|
|
</P><P>
|
|
|
|
<VAR>x</VAR> might be a pseudo-register or a <CODE>subreg</CODE> of a
|
|
pseudo-register, which could either be in a hard register or in memory.
|
|
Use <CODE>true_regnum</CODE> to find out; it will return -1 if the pseudo is
|
|
in memory and the hard register number if it is in a register.
|
|
</P><P>
|
|
|
|
These macros should not be used in the case where a particular class of
|
|
registers can only be copied to memory and not to another class of
|
|
registers. In that case, secondary reload registers are not needed and
|
|
would not be helpful. Instead, a stack location must be used to perform
|
|
the copy and the <CODE>mov<VAR>m</VAR></CODE> pattern should use memory as a
|
|
intermediate storage. This case often occurs between floating-point and
|
|
general registers.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1306"></A>
|
|
<DT><CODE>SECONDARY_MEMORY_NEEDED (<VAR>class1</VAR>, <VAR>class2</VAR>, <VAR>m</VAR>)</CODE>
|
|
<DD>Certain machines have the property that some registers cannot be copied
|
|
to some other registers without using memory. Define this macro on
|
|
those machines to be a C expression that is non-zero if objects of mode
|
|
<VAR>m</VAR> in registers of <VAR>class1</VAR> can only be copied to registers of
|
|
class <VAR>class2</VAR> by storing a register of <VAR>class1</VAR> into memory
|
|
and loading that memory location into a register of <VAR>class2</VAR>.
|
|
<P>
|
|
|
|
Do not define this macro if its value would always be zero.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1307"></A>
|
|
<DT><CODE>SECONDARY_MEMORY_NEEDED_RTX (<VAR>mode</VAR>)</CODE>
|
|
<DD>Normally when <CODE>SECONDARY_MEMORY_NEEDED</CODE> is defined, the compiler
|
|
allocates a stack slot for a memory location needed for register copies.
|
|
If this macro is defined, the compiler instead uses the memory location
|
|
defined by this macro.
|
|
<P>
|
|
|
|
Do not define this macro if you do not define
|
|
<CODE>SECONDARY_MEMORY_NEEDED</CODE>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1308"></A>
|
|
<DT><CODE>SECONDARY_MEMORY_NEEDED_MODE (<VAR>mode</VAR>)</CODE>
|
|
<DD>When the compiler needs a secondary memory location to copy between two
|
|
registers of mode <VAR>mode</VAR>, it normally allocates sufficient memory to
|
|
hold a quantity of <CODE>BITS_PER_WORD</CODE> bits and performs the store and
|
|
load operations in a mode that many bits wide and whose class is the
|
|
same as that of <VAR>mode</VAR>.
|
|
<P>
|
|
|
|
This is right thing to do on most machines because it ensures that all
|
|
bits of the register are copied and prevents accesses to the registers
|
|
in a narrower mode, which some machines prohibit for floating-point
|
|
registers.
|
|
</P><P>
|
|
|
|
However, this default behavior is not correct on some machines, such as
|
|
the DEC Alpha, that store short integers in floating-point registers
|
|
differently than in integer registers. On those machines, the default
|
|
widening will not work correctly and you must define this macro to
|
|
suppress that widening in some cases. See the file <TT>`alpha.h'</TT> for
|
|
details.
|
|
</P><P>
|
|
|
|
Do not define this macro if you do not define
|
|
<CODE>SECONDARY_MEMORY_NEEDED</CODE> or if widening <VAR>mode</VAR> to a mode that
|
|
is <CODE>BITS_PER_WORD</CODE> bits wide is correct for your machine.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1309"></A>
|
|
<DT><CODE>SMALL_REGISTER_CLASSES</CODE>
|
|
<DD>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>
|
|
|
|
Define <CODE>SMALL_REGISTER_CLASSES</CODE> to be an expression with a non-zero
|
|
value on these machines. When this macro has a non-zero value, the
|
|
compiler will try to minimize the lifetime of hard registers.
|
|
</P><P>
|
|
|
|
It is always safe to define this macro with a non-zero 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 macro
|
|
with a non-zero value when it is required, the compiler will run out of
|
|
spill registers and print a fatal error message. For most machines, you
|
|
should not define this macro at all.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1310"></A>
|
|
<DT><CODE>CLASS_LIKELY_SPILLED_P (<VAR>class</VAR>)</CODE>
|
|
<DD>A C expression whose value is nonzero if pseudos that have been assigned
|
|
to registers of class <VAR>class</VAR> would likely be spilled because
|
|
registers of <VAR>class</VAR> are needed for spill registers.
|
|
<P>
|
|
|
|
The default value of this macro returns 1 if <VAR>class</VAR> has exactly one
|
|
register and zero otherwise. On most machines, this default should be
|
|
used. Only define this macro to some other expression if pseudos
|
|
allocated by <TT>`local-alloc.c'</TT> end up in memory because their hard
|
|
registers were needed for spill registers. If this macro returns nonzero
|
|
for those classes, those pseudos will only be allocated by
|
|
<TT>`global.c'</TT>, which knows how to reallocate the pseudo to another
|
|
register. If there would not be another register available for
|
|
reallocation, you should not change the definition of this macro since
|
|
the only effect of such a definition would be to slow down register
|
|
allocation.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1311"></A>
|
|
<DT><CODE>CLASS_MAX_NREGS (<VAR>class</VAR>, <VAR>mode</VAR>)</CODE>
|
|
<DD>A C expression for the maximum number of consecutive registers
|
|
of class <VAR>class</VAR> needed to hold a value of mode <VAR>mode</VAR>.
|
|
<P>
|
|
|
|
This is closely related to the macro <CODE>HARD_REGNO_NREGS</CODE>. In fact,
|
|
the value of the macro <CODE>CLASS_MAX_NREGS (<VAR>class</VAR>, <VAR>mode</VAR>)</CODE>
|
|
should be the maximum value of <CODE>HARD_REGNO_NREGS (<VAR>regno</VAR>,
|
|
<VAR>mode</VAR>)</CODE> for all <VAR>regno</VAR> values in the class <VAR>class</VAR>.
|
|
</P><P>
|
|
|
|
This macro helps control the handling of multiple-word values
|
|
in the reload pass.
|
|
</P><P>
|
|
|
|
<DT><CODE>CLASS_CANNOT_CHANGE_SIZE</CODE>
|
|
<DD>If defined, a C expression for a class that contains registers which the
|
|
compiler must always access in a mode that is the same size as the mode
|
|
in which it loaded the register.
|
|
<P>
|
|
|
|
For the example, loading 32-bit integer or floating-point objects into
|
|
floating-point registers on the Alpha extends them to 64-bits.
|
|
Therefore loading a 64-bit object and then storing it as a 32-bit object
|
|
does not store the low-order 32-bits, as would be the case for a normal
|
|
register. Therefore, <TT>`alpha.h'</TT> defines this macro as
|
|
<CODE>FLOAT_REGS</CODE>.
|
|
</DL>
|
|
<P>
|
|
|
|
Three other special macros describe which operands fit which constraint
|
|
letters.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1312"></A>
|
|
<DT><CODE>CONST_OK_FOR_LETTER_P (<VAR>value</VAR>, <VAR>c</VAR>)</CODE>
|
|
<DD>A C expression that defines the machine-dependent operand constraint
|
|
letters (<SAMP>`I'</SAMP>, <SAMP>`J'</SAMP>, <SAMP>`K'</SAMP>, <small>...</small> <SAMP>`P'</SAMP>) that specify
|
|
particular ranges of integer values. If <VAR>c</VAR> is one of those
|
|
letters, the expression should check that <VAR>value</VAR>, an integer, is in
|
|
the appropriate range and return 1 if so, 0 otherwise. If <VAR>c</VAR> is
|
|
not one of those letters, the value should be 0 regardless of
|
|
<VAR>value</VAR>.
|
|
<P>
|
|
|
|
<A NAME="IDX1313"></A>
|
|
<DT><CODE>CONST_DOUBLE_OK_FOR_LETTER_P (<VAR>value</VAR>, <VAR>c</VAR>)</CODE>
|
|
<DD>A C expression that defines the machine-dependent operand constraint
|
|
letters that specify particular ranges of <CODE>const_double</CODE> values
|
|
(<SAMP>`G'</SAMP> or <SAMP>`H'</SAMP>).
|
|
<P>
|
|
|
|
If <VAR>c</VAR> is one of those letters, the expression should check that
|
|
<VAR>value</VAR>, an RTX of code <CODE>const_double</CODE>, is in the appropriate
|
|
range and return 1 if so, 0 otherwise. If <VAR>c</VAR> is not one of those
|
|
letters, the value should be 0 regardless of <VAR>value</VAR>.
|
|
</P><P>
|
|
|
|
<CODE>const_double</CODE> is used for all floating-point constants and for
|
|
<CODE>DImode</CODE> fixed-point constants. A given letter can accept either
|
|
or both kinds of values. It can use <CODE>GET_MODE</CODE> to distinguish
|
|
between these kinds.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1314"></A>
|
|
<DT><CODE>EXTRA_CONSTRAINT (<VAR>value</VAR>, <VAR>c</VAR>)</CODE>
|
|
<DD>A C expression that defines the optional machine-dependent constraint
|
|
letters (<SAMP>`Q'</SAMP>, <SAMP>`R'</SAMP>, <SAMP>`S'</SAMP>, <SAMP>`T'</SAMP>, <SAMP>`U'</SAMP>) that can
|
|
be used to segregate specific types of operands, usually memory
|
|
references, for the target machine. Normally this macro will not be
|
|
defined. If it is required for a particular target machine, it should
|
|
return 1 if <VAR>value</VAR> corresponds to the operand type represented by
|
|
the constraint letter <VAR>c</VAR>. If <VAR>c</VAR> is not defined as an extra
|
|
constraint, the value returned should be 0 regardless of <VAR>value</VAR>.
|
|
<P>
|
|
|
|
For example, on the ROMP, load instructions cannot have their output in r0 if
|
|
the memory reference contains a symbolic address. Constraint letter
|
|
<SAMP>`Q'</SAMP> is defined as representing a memory address that does
|
|
<EM>not</EM> contain a symbolic address. An alternative is specified with
|
|
a <SAMP>`Q'</SAMP> constraint on the input and <SAMP>`r'</SAMP> on the output. The next
|
|
alternative specifies <SAMP>`m'</SAMP> on the input and a register class that
|
|
does not include r0 on the output.
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="Stack and Calling"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC212"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC211" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC211"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC213" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC213"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC224" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC224"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC199" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC199"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC224" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC224"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H2> 17.7 Stack Layout and Calling Conventions </H2>
|
|
<!--docid::SEC212::-->
|
|
<P>
|
|
|
|
This describes the stack layout and calling conventions.
|
|
</P><P>
|
|
|
|
<BLOCKQUOTE><TABLE BORDER=0 CELLSPACING=0>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC213" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC213">17.7.1 Basic Stack Layout</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC214" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC214">17.7.2 Specifying How Stack Checking is Done</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC215" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC215">17.7.3 Registers That Address the Stack Frame</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC216" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC216">17.7.4 Eliminating Frame Pointer and Arg Pointer</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC217" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC217">17.7.5 Passing Function Arguments on the Stack</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC218" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC218">17.7.6 Passing Arguments in Registers</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC219" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC219">17.7.7 How Scalar Function Values Are Returned</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC220" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC220">17.7.8 How Large Values Are Returned</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC221" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC221">17.7.9 Caller-Saves Register Allocation</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC222" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC222">17.7.10 Function Entry and Exit</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC223" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC223">17.7.11 Generating Code for Profiling</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
|
|
</TABLE></BLOCKQUOTE>
|
|
<P>
|
|
|
|
<A NAME="Frame Layout"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC213"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC212" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC212"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC214" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC214"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC224" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC224"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC212" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC212"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC224" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC224"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H3> 17.7.1 Basic Stack Layout </H3>
|
|
<!--docid::SEC213::-->
|
|
<P>
|
|
|
|
Here is the basic stack layout.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1315"></A>
|
|
<DT><CODE>STACK_GROWS_DOWNWARD</CODE>
|
|
<DD>Define this macro if pushing a word onto the stack moves the stack
|
|
pointer to a smaller address.
|
|
<P>
|
|
|
|
When we say, "define this macro if <small>...</small>," it means that the
|
|
compiler checks this macro only with <CODE>#ifdef</CODE> so the precise
|
|
definition used does not matter.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1316"></A>
|
|
<DT><CODE>FRAME_GROWS_DOWNWARD</CODE>
|
|
<DD>Define this macro if the addresses of local variable slots are at negative
|
|
offsets from the frame pointer.
|
|
<P>
|
|
|
|
<A NAME="IDX1317"></A>
|
|
<DT><CODE>ARGS_GROW_DOWNWARD</CODE>
|
|
<DD>Define this macro if successive arguments to a function occupy decreasing
|
|
addresses on the stack.
|
|
<P>
|
|
|
|
<A NAME="IDX1318"></A>
|
|
<DT><CODE>STARTING_FRAME_OFFSET</CODE>
|
|
<DD>Offset from the frame pointer to the first local variable slot to be allocated.
|
|
<P>
|
|
|
|
If <CODE>FRAME_GROWS_DOWNWARD</CODE>, find the next slot's offset by
|
|
subtracting the first slot's length from <CODE>STARTING_FRAME_OFFSET</CODE>.
|
|
Otherwise, it is found by adding the length of the first slot to the
|
|
value <CODE>STARTING_FRAME_OFFSET</CODE>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1319"></A>
|
|
<DT><CODE>STACK_POINTER_OFFSET</CODE>
|
|
<DD>Offset from the stack pointer register to the first location at which
|
|
outgoing arguments are placed. If not specified, the default value of
|
|
zero is used. This is the proper value for most machines.
|
|
<P>
|
|
|
|
If <CODE>ARGS_GROW_DOWNWARD</CODE>, this is the offset to the location above
|
|
the first location at which outgoing arguments are placed.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1320"></A>
|
|
<DT><CODE>FIRST_PARM_OFFSET (<VAR>fundecl</VAR>)</CODE>
|
|
<DD>Offset from the argument pointer register to the first argument's
|
|
address. On some machines it may depend on the data type of the
|
|
function.
|
|
<P>
|
|
|
|
If <CODE>ARGS_GROW_DOWNWARD</CODE>, this is the offset to the location above
|
|
the first argument's address.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1321"></A>
|
|
<DT><CODE>STACK_DYNAMIC_OFFSET (<VAR>fundecl</VAR>)</CODE>
|
|
<DD>Offset from the stack pointer register to an item dynamically allocated
|
|
on the stack, e.g., by <CODE>alloca</CODE>.
|
|
<P>
|
|
|
|
The default value for this macro is <CODE>STACK_POINTER_OFFSET</CODE> plus the
|
|
length of the outgoing arguments. The default is correct for most
|
|
machines. See <TT>`function.c'</TT> for details.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1322"></A>
|
|
<DT><CODE>DYNAMIC_CHAIN_ADDRESS (<VAR>frameaddr</VAR>)</CODE>
|
|
<DD>A C expression whose value is RTL representing the address in a stack
|
|
frame where the pointer to the caller's frame is stored. Assume that
|
|
<VAR>frameaddr</VAR> is an RTL expression for the address of the stack frame
|
|
itself.
|
|
<P>
|
|
|
|
If you don't define this macro, the default is to return the value
|
|
of <VAR>frameaddr</VAR>---that is, the stack frame address is also the
|
|
address of the stack word that points to the previous frame.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1323"></A>
|
|
<DT><CODE>SETUP_FRAME_ADDRESSES</CODE>
|
|
<DD>If defined, a C expression that produces the machine-specific code to
|
|
setup the stack so that arbitrary frames can be accessed. For example,
|
|
on the Sparc, we must flush all of the register windows to the stack
|
|
before we can access arbitrary stack frames. You will seldom need to
|
|
define this macro.
|
|
<P>
|
|
|
|
<A NAME="IDX1324"></A>
|
|
<DT><CODE>BUILTIN_SETJMP_FRAME_VALUE</CODE>
|
|
<DD>If defined, a C expression that contains an rtx that is used to store
|
|
the address of the current frame into the built in <CODE>setjmp</CODE> buffer.
|
|
The default value, <CODE>virtual_stack_vars_rtx</CODE>, is correct for most
|
|
machines. One reason you may need to define this macro is if
|
|
<CODE>hard_frame_pointer_rtx</CODE> is the appropriate value on your machine.
|
|
<P>
|
|
|
|
<A NAME="IDX1325"></A>
|
|
<DT><CODE>RETURN_ADDR_RTX (<VAR>count</VAR>, <VAR>frameaddr</VAR>)</CODE>
|
|
<DD>A C expression whose value is RTL representing the value of the return
|
|
address for the frame <VAR>count</VAR> steps up from the current frame, after
|
|
the prologue. <VAR>frameaddr</VAR> is the frame pointer of the <VAR>count</VAR>
|
|
frame, or the frame pointer of the <VAR>count</VAR> - 1 frame if
|
|
<CODE>RETURN_ADDR_IN_PREVIOUS_FRAME</CODE> is defined.
|
|
<P>
|
|
|
|
The value of the expression must always be the correct address when
|
|
<VAR>count</VAR> is zero, but may be <CODE>NULL_RTX</CODE> if there is not way to
|
|
determine the return address of other frames.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1326"></A>
|
|
<DT><CODE>RETURN_ADDR_IN_PREVIOUS_FRAME</CODE>
|
|
<DD>Define this if the return address of a particular stack frame is accessed
|
|
from the frame pointer of the previous stack frame.
|
|
<P>
|
|
|
|
<A NAME="IDX1327"></A>
|
|
<DT><CODE>INCOMING_RETURN_ADDR_RTX</CODE>
|
|
<DD>A C expression whose value is RTL representing the location of the
|
|
incoming return address at the beginning of any function, before the
|
|
prologue. This RTL is either a <CODE>REG</CODE>, indicating that the return
|
|
value is saved in <SAMP>`REG'</SAMP>, or a <CODE>MEM</CODE> representing a location in
|
|
the stack.
|
|
<P>
|
|
|
|
You only need to define this macro if you want to support call frame
|
|
debugging information like that provided by DWARF 2.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1328"></A>
|
|
<DT><CODE>INCOMING_FRAME_SP_OFFSET</CODE>
|
|
<DD>A C expression whose value is an integer giving the offset, in bytes,
|
|
from the value of the stack pointer register to the top of the stack
|
|
frame at the beginning of any function, before the prologue. The top of
|
|
the frame is defined to be the value of the stack pointer in the
|
|
previous frame, just before the call instruction.
|
|
<P>
|
|
|
|
You only need to define this macro if you want to support call frame
|
|
debugging information like that provided by DWARF 2.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1329"></A>
|
|
<DT><CODE>ARG_POINTER_CFA_OFFSET</CODE>
|
|
<DD>A C expression whose value is an integer giving the offset, in bytes,
|
|
from the argument pointer to the canonical frame address (cfa). The
|
|
final value should coincide with that calculated by
|
|
<CODE>INCOMING_FRAME_SP_OFFSET</CODE>. Which is unfortunately not usable
|
|
during virtual register instantiation.
|
|
<P>
|
|
|
|
You only need to define this macro if you want to support call frame
|
|
debugging information like that provided by DWARF 2.
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="Stack Checking"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC214"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC213" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC213"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC215" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC215"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC215" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC215"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC212" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC212"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC224" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC224"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H3> 17.7.2 Specifying How Stack Checking is Done </H3>
|
|
<!--docid::SEC214::-->
|
|
<P>
|
|
|
|
GNU CC will check that stack references are within the boundaries of
|
|
the stack, if the <SAMP>`-fstack-check'</SAMP> is specified, in one of three ways:
|
|
</P><P>
|
|
|
|
<OL>
|
|
<LI>
|
|
If the value of the <CODE>STACK_CHECK_BUILTIN</CODE> macro is nonzero, GNU CC
|
|
will assume that you have arranged for stack checking to be done at
|
|
appropriate places in the configuration files, e.g., in
|
|
<CODE>FUNCTION_PROLOGUE</CODE>. GNU CC will do not other special processing.
|
|
<P>
|
|
|
|
<LI>
|
|
If <CODE>STACK_CHECK_BUILTIN</CODE> is zero and you defined a named pattern
|
|
called <CODE>check_stack</CODE> in your <TT>`md'</TT> file, GNU CC will call that
|
|
pattern with one argument which is the address to compare the stack
|
|
value against. You must arrange for this pattern to report an error if
|
|
the stack pointer is out of range.
|
|
<P>
|
|
|
|
<LI>
|
|
If neither of the above are true, GNU CC will generate code to periodically
|
|
"probe" the stack pointer using the values of the macros defined below.
|
|
</OL>
|
|
<P>
|
|
|
|
Normally, you will use the default values of these macros, so GNU CC
|
|
will use the third approach.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1330"></A>
|
|
<DT><CODE>STACK_CHECK_BUILTIN</CODE>
|
|
<DD>A nonzero value if stack checking is done by the configuration files in a
|
|
machine-dependent manner. You should define this macro if stack checking
|
|
is require by the ABI of your machine or if you would like to have to stack
|
|
checking in some more efficient way than GNU CC's portable approach.
|
|
The default value of this macro is zero.
|
|
<P>
|
|
|
|
<A NAME="IDX1331"></A>
|
|
<DT><CODE>STACK_CHECK_PROBE_INTERVAL</CODE>
|
|
<DD>An integer representing the interval at which GNU CC must generate stack
|
|
probe instructions. You will normally define this macro to be no larger
|
|
than the size of the "guard pages" at the end of a stack area. The
|
|
default value of 4096 is suitable for most systems.
|
|
<P>
|
|
|
|
<A NAME="IDX1332"></A>
|
|
<DT><CODE>STACK_CHECK_PROBE_LOAD</CODE>
|
|
<DD>A integer which is nonzero if GNU CC should perform the stack probe
|
|
as a load instruction and zero if GNU CC should use a store instruction.
|
|
The default is zero, which is the most efficient choice on most systems.
|
|
<P>
|
|
|
|
<A NAME="IDX1333"></A>
|
|
<DT><CODE>STACK_CHECK_PROTECT</CODE>
|
|
<DD>The number of bytes of stack needed to recover from a stack overflow,
|
|
for languages where such a recovery is supported. The default value of
|
|
75 words should be adequate for most machines.
|
|
<P>
|
|
|
|
<A NAME="IDX1334"></A>
|
|
<DT><CODE>STACK_CHECK_MAX_FRAME_SIZE</CODE>
|
|
<DD>The maximum size of a stack frame, in bytes. GNU CC will generate probe
|
|
instructions in non-leaf functions to ensure at least this many bytes of
|
|
stack are available. If a stack frame is larger than this size, stack
|
|
checking will not be reliable and GNU CC will issue a warning. The
|
|
default is chosen so that GNU CC only generates one instruction on most
|
|
systems. You should normally not change the default value of this macro.
|
|
<P>
|
|
|
|
<A NAME="IDX1335"></A>
|
|
<DT><CODE>STACK_CHECK_FIXED_FRAME_SIZE</CODE>
|
|
<DD>GNU CC uses this value to generate the above warning message. It
|
|
represents the amount of fixed frame used by a function, not including
|
|
space for any callee-saved registers, temporaries and user variables.
|
|
You need only specify an upper bound for this amount and will normally
|
|
use the default of four words.
|
|
<P>
|
|
|
|
<A NAME="IDX1336"></A>
|
|
<DT><CODE>STACK_CHECK_MAX_VAR_SIZE</CODE>
|
|
<DD>The maximum size, in bytes, of an object that GNU CC will place in the
|
|
fixed area of the stack frame when the user specifies
|
|
<SAMP>`-fstack-check'</SAMP>.
|
|
GNU CC computed the default from the values of the above macros and you will
|
|
normally not need to override that default.
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="Frame Registers"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC215"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC214" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC214"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC216" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC216"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC216" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC216"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC212" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC212"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC224" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC224"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H3> 17.7.3 Registers That Address the Stack Frame </H3>
|
|
<!--docid::SEC215::-->
|
|
<P>
|
|
|
|
This discusses registers that address the stack frame.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1337"></A>
|
|
<DT><CODE>STACK_POINTER_REGNUM</CODE>
|
|
<DD>The register number of the stack pointer register, which must also be a
|
|
fixed register according to <CODE>FIXED_REGISTERS</CODE>. On most machines,
|
|
the hardware determines which register this is.
|
|
<P>
|
|
|
|
<A NAME="IDX1338"></A>
|
|
<DT><CODE>FRAME_POINTER_REGNUM</CODE>
|
|
<DD>The register number of the frame pointer register, which is used to
|
|
access automatic variables in the stack frame. On some machines, the
|
|
hardware determines which register this is. On other machines, you can
|
|
choose any register you wish for this purpose.
|
|
<P>
|
|
|
|
<A NAME="IDX1339"></A>
|
|
<DT><CODE>HARD_FRAME_POINTER_REGNUM</CODE>
|
|
<DD>On some machines the offset between the frame pointer and starting
|
|
offset of the automatic variables is not known until after register
|
|
allocation has been done (for example, because the saved registers are
|
|
between these two locations). On those machines, define
|
|
<CODE>FRAME_POINTER_REGNUM</CODE> the number of a special, fixed register to
|
|
be used internally until the offset is known, and define
|
|
<CODE>HARD_FRAME_POINTER_REGNUM</CODE> to be the actual hard register number
|
|
used for the frame pointer.
|
|
<P>
|
|
|
|
You should define this macro only in the very rare circumstances when it
|
|
is not possible to calculate the offset between the frame pointer and
|
|
the automatic variables until after register allocation has been
|
|
completed. When this macro is defined, you must also indicate in your
|
|
definition of <CODE>ELIMINABLE_REGS</CODE> how to eliminate
|
|
<CODE>FRAME_POINTER_REGNUM</CODE> into either <CODE>HARD_FRAME_POINTER_REGNUM</CODE>
|
|
or <CODE>STACK_POINTER_REGNUM</CODE>.
|
|
</P><P>
|
|
|
|
Do not define this macro if it would be the same as
|
|
<CODE>FRAME_POINTER_REGNUM</CODE>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1340"></A>
|
|
<DT><CODE>ARG_POINTER_REGNUM</CODE>
|
|
<DD>The register number of the arg pointer register, which is used to access
|
|
the function's argument list. On some machines, this is the same as the
|
|
frame pointer register. On some machines, the hardware determines which
|
|
register this is. On other machines, you can choose any register you
|
|
wish for this purpose. If this is not the same register as the frame
|
|
pointer register, then you must mark it as a fixed register according to
|
|
<CODE>FIXED_REGISTERS</CODE>, or arrange to be able to eliminate it
|
|
(see section <A HREF="gcc_17.html#SEC216" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC216">17.7.4 Eliminating Frame Pointer and Arg Pointer</A>).
|
|
<P>
|
|
|
|
<A NAME="IDX1341"></A>
|
|
<DT><CODE>RETURN_ADDRESS_POINTER_REGNUM</CODE>
|
|
<DD>The register number of the return address pointer register, which is used to
|
|
access the current function's return address from the stack. On some
|
|
machines, the return address is not at a fixed offset from the frame
|
|
pointer or stack pointer or argument pointer. This register can be defined
|
|
to point to the return address on the stack, and then be converted by
|
|
<CODE>ELIMINABLE_REGS</CODE> into either the frame pointer or stack pointer.
|
|
<P>
|
|
|
|
Do not define this macro unless there is no other way to get the return
|
|
address from the stack.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1342"></A>
|
|
<A NAME="IDX1343"></A>
|
|
<DT><CODE>STATIC_CHAIN_REGNUM</CODE>
|
|
<DD><DT><CODE>STATIC_CHAIN_INCOMING_REGNUM</CODE>
|
|
<DD>Register numbers used for passing a function's static chain pointer. If
|
|
register windows are used, the register number as seen by the called
|
|
function is <CODE>STATIC_CHAIN_INCOMING_REGNUM</CODE>, while the register
|
|
number as seen by the calling function is <CODE>STATIC_CHAIN_REGNUM</CODE>. If
|
|
these registers are the same, <CODE>STATIC_CHAIN_INCOMING_REGNUM</CODE> need
|
|
not be defined.<P>
|
|
|
|
The static chain register need not be a fixed register.
|
|
</P><P>
|
|
|
|
If the static chain is passed in memory, these macros should not be
|
|
defined; instead, the next two macros should be defined.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1344"></A>
|
|
<A NAME="IDX1345"></A>
|
|
<DT><CODE>STATIC_CHAIN</CODE>
|
|
<DD><DT><CODE>STATIC_CHAIN_INCOMING</CODE>
|
|
<DD>If the static chain is passed in memory, these macros provide rtx giving
|
|
<CODE>mem</CODE> expressions that denote where they are stored.
|
|
<CODE>STATIC_CHAIN</CODE> and <CODE>STATIC_CHAIN_INCOMING</CODE> give the locations
|
|
as seen by the calling and called functions, respectively. Often the former
|
|
will be at an offset from the stack pointer and the latter at an offset from
|
|
the frame pointer.<P>
|
|
|
|
<A NAME="IDX1346"></A>
|
|
<A NAME="IDX1347"></A>
|
|
<A NAME="IDX1348"></A>
|
|
The variables <CODE>stack_pointer_rtx</CODE>, <CODE>frame_pointer_rtx</CODE>, and
|
|
<CODE>arg_pointer_rtx</CODE> will have been initialized prior to the use of these
|
|
macros and should be used to refer to those items.
|
|
</P><P>
|
|
|
|
If the static chain is passed in a register, the two previous macros should
|
|
be defined instead.
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="Elimination"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC216"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC215" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC215"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC217" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC217"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC217" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC217"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC212" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC212"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC224" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC224"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H3> 17.7.4 Eliminating Frame Pointer and Arg Pointer </H3>
|
|
<!--docid::SEC216::-->
|
|
<P>
|
|
|
|
This is about eliminating the frame pointer and arg pointer.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1349"></A>
|
|
<DT><CODE>FRAME_POINTER_REQUIRED</CODE>
|
|
<DD>A C expression which is nonzero if a function must have and use a frame
|
|
pointer. This expression is evaluated in the reload pass. If its value is
|
|
nonzero the function will have a frame pointer.
|
|
<P>
|
|
|
|
The expression can in principle examine the current function and decide
|
|
according to the facts, but on most machines the constant 0 or the
|
|
constant 1 suffices. Use 0 when the machine allows code to be generated
|
|
with no frame pointer, and doing so saves some time or space. Use 1
|
|
when there is no possible advantage to avoiding a frame pointer.
|
|
</P><P>
|
|
|
|
In certain cases, the compiler does not know how to produce valid code
|
|
without a frame pointer. The compiler recognizes those cases and
|
|
automatically gives the function a frame pointer regardless of what
|
|
<CODE>FRAME_POINTER_REQUIRED</CODE> says. You don't need to worry about
|
|
them.</P><P>
|
|
|
|
In a function that does not require a frame pointer, the frame pointer
|
|
register can be allocated for ordinary usage, unless you mark it as a
|
|
fixed register. See <CODE>FIXED_REGISTERS</CODE> for more information.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1350"></A>
|
|
<A NAME="IDX1351"></A>
|
|
<DT><CODE>INITIAL_FRAME_POINTER_OFFSET (<VAR>depth-var</VAR>)</CODE>
|
|
<DD>A C statement to store in the variable <VAR>depth-var</VAR> the difference
|
|
between the frame pointer and the stack pointer values immediately after
|
|
the function prologue. The value would be computed from information
|
|
such as the result of <CODE>get_frame_size ()</CODE> and the tables of
|
|
registers <CODE>regs_ever_live</CODE> and <CODE>call_used_regs</CODE>.
|
|
<P>
|
|
|
|
If <CODE>ELIMINABLE_REGS</CODE> is defined, this macro will be not be used and
|
|
need not be defined. Otherwise, it must be defined even if
|
|
<CODE>FRAME_POINTER_REQUIRED</CODE> is defined to always be true; in that
|
|
case, you may set <VAR>depth-var</VAR> to anything.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1352"></A>
|
|
<DT><CODE>ELIMINABLE_REGS</CODE>
|
|
<DD>If defined, this macro specifies a table of register pairs used to
|
|
eliminate unneeded registers that point into the stack frame. If it is not
|
|
defined, the only elimination attempted by the compiler is to replace
|
|
references to the frame pointer with references to the stack pointer.
|
|
<P>
|
|
|
|
The definition of this macro is a list of structure initializations, each
|
|
of which specifies an original and replacement register.
|
|
</P><P>
|
|
|
|
On some machines, the position of the argument pointer is not known until
|
|
the compilation is completed. In such a case, a separate hard register
|
|
must be used for the argument pointer. This register can be eliminated by
|
|
replacing it with either the frame pointer or the argument pointer,
|
|
depending on whether or not the frame pointer has been eliminated.
|
|
</P><P>
|
|
|
|
In this case, you might specify:
|
|
<TABLE><tr><td> </td><td class=example><pre>#define ELIMINABLE_REGS \
|
|
{{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
|
|
{ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
|
|
{FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
|
|
</pre></td></tr></table></P><P>
|
|
|
|
Note that the elimination of the argument pointer with the stack pointer is
|
|
specified first since that is the preferred elimination.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1353"></A>
|
|
<DT><CODE>CAN_ELIMINATE (<VAR>from-reg</VAR>, <VAR>to-reg</VAR>)</CODE>
|
|
<DD>A C expression that returns non-zero if the compiler is allowed to try
|
|
to replace register number <VAR>from-reg</VAR> with register number
|
|
<VAR>to-reg</VAR>. This macro need only be defined if <CODE>ELIMINABLE_REGS</CODE>
|
|
is defined, and will usually be the constant 1, since most of the cases
|
|
preventing register elimination are things that the compiler already
|
|
knows about.
|
|
<P>
|
|
|
|
<A NAME="IDX1354"></A>
|
|
<DT><CODE>INITIAL_ELIMINATION_OFFSET (<VAR>from-reg</VAR>, <VAR>to-reg</VAR>, <VAR>offset-var</VAR>)</CODE>
|
|
<DD>This macro is similar to <CODE>INITIAL_FRAME_POINTER_OFFSET</CODE>. It
|
|
specifies the initial difference between the specified pair of
|
|
registers. This macro must be defined if <CODE>ELIMINABLE_REGS</CODE> is
|
|
defined.
|
|
<P>
|
|
|
|
<A NAME="IDX1355"></A>
|
|
<DT><CODE>LONGJMP_RESTORE_FROM_STACK</CODE>
|
|
<DD>Define this macro if the <CODE>longjmp</CODE> function restores registers from
|
|
the stack frames, rather than from those saved specifically by
|
|
<CODE>setjmp</CODE>. Certain quantities must not be kept in registers across
|
|
a call to <CODE>setjmp</CODE> on such machines.
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="Stack Arguments"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC217"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC216" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC216"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC218" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC218"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC218" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC218"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC212" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC212"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC224" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC224"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H3> 17.7.5 Passing Function Arguments on the Stack </H3>
|
|
<!--docid::SEC217::-->
|
|
<P>
|
|
|
|
The macros in this section control how arguments are passed
|
|
on the stack. See the following section for other macros that
|
|
control passing certain arguments in registers.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1356"></A>
|
|
<DT><CODE>PROMOTE_PROTOTYPES</CODE>
|
|
<DD>Define this macro if an argument declared in a prototype as an
|
|
integral type smaller than <CODE>int</CODE> should actually be passed as an
|
|
<CODE>int</CODE>. In addition to avoiding errors in certain cases of
|
|
mismatch, it also makes for better code on certain machines.
|
|
<P>
|
|
|
|
<A NAME="IDX1357"></A>
|
|
<DT><CODE>PUSH_ROUNDING (<VAR>npushed</VAR>)</CODE>
|
|
<DD>A C expression that is the number of bytes actually pushed onto the
|
|
stack when an instruction attempts to push <VAR>npushed</VAR> bytes.
|
|
<P>
|
|
|
|
If the target machine does not have a push instruction, do not define
|
|
this macro. That directs GNU CC to use an alternate strategy: to
|
|
allocate the entire argument block and then store the arguments into
|
|
it.
|
|
</P><P>
|
|
|
|
On some machines, the definition
|
|
</P><P>
|
|
|
|
<TABLE><tr><td> </td><td class=example><pre>#define PUSH_ROUNDING(BYTES) (BYTES)
|
|
</pre></td></tr></table></P><P>
|
|
|
|
will suffice. But on other machines, instructions that appear
|
|
to push one byte actually push two bytes in an attempt to maintain
|
|
alignment. Then the definition should be
|
|
</P><P>
|
|
|
|
<TABLE><tr><td> </td><td class=example><pre>#define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & ~1)
|
|
</pre></td></tr></table></P><P>
|
|
|
|
<A NAME="IDX1358"></A>
|
|
<A NAME="IDX1359"></A>
|
|
<DT><CODE>ACCUMULATE_OUTGOING_ARGS</CODE>
|
|
<DD>If defined, the maximum amount of space required for outgoing arguments
|
|
will be computed and placed into the variable
|
|
<CODE>current_function_outgoing_args_size</CODE>. No space will be pushed
|
|
onto the stack for each call; instead, the function prologue should
|
|
increase the stack frame size by this amount.
|
|
<P>
|
|
|
|
Defining both <CODE>PUSH_ROUNDING</CODE> and <CODE>ACCUMULATE_OUTGOING_ARGS</CODE>
|
|
is not proper.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1360"></A>
|
|
<DT><CODE>REG_PARM_STACK_SPACE (<VAR>fndecl</VAR>)</CODE>
|
|
<DD>Define this macro if functions should assume that stack space has been
|
|
allocated for arguments even when their values are passed in
|
|
registers.
|
|
<P>
|
|
|
|
The value of this macro is the size, in bytes, of the area reserved for
|
|
arguments passed in registers for the function represented by <VAR>fndecl</VAR>,
|
|
which can be zero if GNU CC is calling a library function.
|
|
</P><P>
|
|
|
|
This space can be allocated by the caller, or be a part of the
|
|
machine-dependent stack frame: <CODE>OUTGOING_REG_PARM_STACK_SPACE</CODE> says
|
|
which.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1361"></A>
|
|
<A NAME="IDX1362"></A>
|
|
<DT><CODE>MAYBE_REG_PARM_STACK_SPACE</CODE>
|
|
<DD><DT><CODE>FINAL_REG_PARM_STACK_SPACE (<VAR>const_size</VAR>, <VAR>var_size</VAR>)</CODE>
|
|
<DD>Define these macros in addition to the one above if functions might
|
|
allocate stack space for arguments even when their values are passed
|
|
in registers. These should be used when the stack space allocated
|
|
for arguments in registers is not a simple constant independent of the
|
|
function declaration.
|
|
<P>
|
|
|
|
The value of the first macro is the size, in bytes, of the area that
|
|
we should initially assume would be reserved for arguments passed in registers.
|
|
</P><P>
|
|
|
|
The value of the second macro is the actual size, in bytes, of the area
|
|
that will be reserved for arguments passed in registers. This takes two
|
|
arguments: an integer representing the number of bytes of fixed sized
|
|
arguments on the stack, and a tree representing the number of bytes of
|
|
variable sized arguments on the stack.
|
|
</P><P>
|
|
|
|
When these macros are defined, <CODE>REG_PARM_STACK_SPACE</CODE> will only be
|
|
called for libcall functions, the current function, or for a function
|
|
being called when it is known that such stack space must be allocated.
|
|
In each case this value can be easily computed.
|
|
</P><P>
|
|
|
|
When deciding whether a called function needs such stack space, and how
|
|
much space to reserve, GNU CC uses these two macros instead of
|
|
<CODE>REG_PARM_STACK_SPACE</CODE>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1363"></A>
|
|
<DT><CODE>OUTGOING_REG_PARM_STACK_SPACE</CODE>
|
|
<DD>Define this if it is the responsibility of the caller to allocate the area
|
|
reserved for arguments passed in registers.
|
|
<P>
|
|
|
|
If <CODE>ACCUMULATE_OUTGOING_ARGS</CODE> is defined, this macro controls
|
|
whether the space for these arguments counts in the value of
|
|
<CODE>current_function_outgoing_args_size</CODE>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1364"></A>
|
|
<DT><CODE>STACK_PARMS_IN_REG_PARM_AREA</CODE>
|
|
<DD>Define this macro if <CODE>REG_PARM_STACK_SPACE</CODE> is defined, but the
|
|
stack parameters don't skip the area specified by it.
|
|
<P>
|
|
|
|
Normally, when a parameter is not passed in registers, it is placed on the
|
|
stack beyond the <CODE>REG_PARM_STACK_SPACE</CODE> area. Defining this macro
|
|
suppresses this behavior and causes the parameter to be passed on the
|
|
stack in its natural location.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1365"></A>
|
|
<DT><CODE>RETURN_POPS_ARGS (<VAR>fundecl</VAR>, <VAR>funtype</VAR>, <VAR>stack-size</VAR>)</CODE>
|
|
<DD>A C expression that should indicate the number of bytes of its own
|
|
arguments that a function pops on returning, or 0 if the
|
|
function pops no arguments and the caller must therefore pop them all
|
|
after the function returns.
|
|
<P>
|
|
|
|
<VAR>fundecl</VAR> is a C variable whose value is a tree node that describes
|
|
the function in question. Normally it is a node of type
|
|
<CODE>FUNCTION_DECL</CODE> that describes the declaration of the function.
|
|
From this you can obtain the DECL_MACHINE_ATTRIBUTES of the function.
|
|
</P><P>
|
|
|
|
<VAR>funtype</VAR> is a C variable whose value is a tree node that
|
|
describes the function in question. Normally it is a node of type
|
|
<CODE>FUNCTION_TYPE</CODE> that describes the data type of the function.
|
|
From this it is possible to obtain the data types of the value and
|
|
arguments (if known).
|
|
</P><P>
|
|
|
|
When a call to a library function is being considered, <VAR>fundecl</VAR>
|
|
will contain an identifier node for the library function. Thus, if
|
|
you need to distinguish among various library functions, you can do so
|
|
by their names. Note that "library function" in this context means
|
|
a function used to perform arithmetic, whose name is known specially
|
|
in the compiler and was not mentioned in the C code being compiled.
|
|
</P><P>
|
|
|
|
<VAR>stack-size</VAR> is the number of bytes of arguments passed on the
|
|
stack. If a variable number of bytes is passed, it is zero, and
|
|
argument popping will always be the responsibility of the calling function.
|
|
</P><P>
|
|
|
|
On the Vax, all functions always pop their arguments, so the definition
|
|
of this macro is <VAR>stack-size</VAR>. On the 68000, using the standard
|
|
calling convention, no functions pop their arguments, so the value of
|
|
the macro is always 0 in this case. But an alternative calling
|
|
convention is available in which functions that take a fixed number of
|
|
arguments pop them but other functions (such as <CODE>printf</CODE>) pop
|
|
nothing (the caller pops all). When this convention is in use,
|
|
<VAR>funtype</VAR> is examined to determine whether a function takes a fixed
|
|
number of arguments.
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="Register Arguments"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC218"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC217" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC217"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC219" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC219"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC219" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC219"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC212" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC212"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC224" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC224"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H3> 17.7.6 Passing Arguments in Registers </H3>
|
|
<!--docid::SEC218::-->
|
|
<P>
|
|
|
|
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.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1366"></A>
|
|
<DT><CODE>FUNCTION_ARG (<VAR>cum</VAR>, <VAR>mode</VAR>, <VAR>type</VAR>, <VAR>named</VAR>)</CODE>
|
|
<DD>A C expression that controls whether a function argument is passed
|
|
in a register, and which register.
|
|
<P>
|
|
|
|
The arguments are <VAR>cum</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 1 for an ordinary argument and 0 for nameless arguments that
|
|
correspond to <SAMP>`<small>...</small>'</SAMP> in the called function's prototype.
|
|
</P><P>
|
|
|
|
The value of the expression 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><P>
|
|
|
|
For machines like the Vax and 68000, where normally all arguments are
|
|
pushed, zero suffices as a definition.
|
|
</P><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
|
|
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 bytes
|
|
starting from the second operand of that <CODE>expr_list</CODE> are stored on
|
|
the stack and not held in a register.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1367"></A>
|
|
The usual way to make the ANSI library <TT>`stdarg.h'</TT> 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>FUNCTION_ARG</CODE> return 0 whenever <VAR>named</VAR> is 0.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1368"></A>
|
|
<A NAME="IDX1369"></A>
|
|
You may use the macro <CODE>MUST_PASS_IN_STACK (<VAR>mode</VAR>, <VAR>type</VAR>)</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>FUNCTION_ARG</CODE> returns non-zero 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><P>
|
|
|
|
<A NAME="IDX1370"></A>
|
|
<DT><CODE>MUST_PASS_IN_STACK (<VAR>mode</VAR>, <VAR>type</VAR>)</CODE>
|
|
<DD>Define as a C expression that evaluates to nonzero if we do not know how
|
|
to pass TYPE solely in registers. The file <TT>`expr.h'</TT> defines a
|
|
definition that is usually appropriate, refer to <TT>`expr.h'</TT> for additional
|
|
documentation.
|
|
<P>
|
|
|
|
<A NAME="IDX1371"></A>
|
|
<DT><CODE>FUNCTION_INCOMING_ARG (<VAR>cum</VAR>, <VAR>mode</VAR>, <VAR>type</VAR>, <VAR>named</VAR>)</CODE>
|
|
<DD>Define this macro 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>FUNCTION_ARG</CODE> computes the register in which
|
|
the caller passes the value, and <CODE>FUNCTION_INCOMING_ARG</CODE> should
|
|
be defined in a similar fashion to tell the function being called
|
|
where the arguments will arrive.
|
|
</P><P>
|
|
|
|
If <CODE>FUNCTION_INCOMING_ARG</CODE> is not defined, <CODE>FUNCTION_ARG</CODE>
|
|
serves both purposes.</P><P>
|
|
|
|
<A NAME="IDX1372"></A>
|
|
<DT><CODE>FUNCTION_ARG_PARTIAL_NREGS (<VAR>cum</VAR>, <VAR>mode</VAR>, <VAR>type</VAR>, <VAR>named</VAR>)</CODE>
|
|
<DD>A C expression for the number of words, at the beginning of an
|
|
argument, 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 <VAR>n</VAR> 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 of the words should go in
|
|
registers.
|
|
</P><P>
|
|
|
|
<CODE>FUNCTION_ARG</CODE> for these arguments should return the first
|
|
register to be used by the caller for this argument; likewise
|
|
<CODE>FUNCTION_INCOMING_ARG</CODE>, for the called function.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1373"></A>
|
|
<DT><CODE>FUNCTION_ARG_PASS_BY_REFERENCE (<VAR>cum</VAR>, <VAR>mode</VAR>, <VAR>type</VAR>, <VAR>named</VAR>)</CODE>
|
|
<DD>A C expression that indicates when an argument must be passed by reference.
|
|
If nonzero for an argument, 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>
|
|
|
|
On machines where <CODE>REG_PARM_STACK_SPACE</CODE> is not defined, a suitable
|
|
definition of this macro might be
|
|
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>#define FUNCTION_ARG_PASS_BY_REFERENCE\
|
|
(CUM, MODE, TYPE, NAMED) \
|
|
MUST_PASS_IN_STACK (MODE, TYPE)
|
|
</FONT></pre></td></tr></table></P><P>
|
|
|
|
<A NAME="IDX1374"></A>
|
|
<DT><CODE>FUNCTION_ARG_CALLEE_COPIES (<VAR>cum</VAR>, <VAR>mode</VAR>, <VAR>type</VAR>, <VAR>named</VAR>)</CODE>
|
|
<DD>If defined, a C expression that indicates when it is the called function's
|
|
responsibility to make a copy of arguments passed by invisible reference.
|
|
Normally, the caller makes a copy and passes the address of the copy to the
|
|
routine being called. When FUNCTION_ARG_CALLEE_COPIES is defined and is
|
|
nonzero, the caller does not make a copy. Instead, it passes a pointer to the
|
|
"live" value. The called function must not modify this value. If it can be
|
|
determined that the value won't be modified, it need not make a copy;
|
|
otherwise a copy must be made.
|
|
<P>
|
|
|
|
<A NAME="IDX1375"></A>
|
|
<DT><CODE>CUMULATIVE_ARGS</CODE>
|
|
<DD>A C type for declaring a variable that is used as the first argument of
|
|
<CODE>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><P>
|
|
|
|
<A NAME="IDX1376"></A>
|
|
<DT><CODE>INIT_CUMULATIVE_ARGS (<VAR>cum</VAR>, <VAR>fntype</VAR>, <VAR>libname</VAR>, <VAR>indirect</VAR>)</CODE>
|
|
<DD>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. The value of
|
|
<VAR>indirect</VAR> is nonzero when processing an indirect call, for example
|
|
a call through a function pointer. The value of <VAR>indirect</VAR> is zero
|
|
for a call to an explicitly named function, a library function call, or when
|
|
<CODE>INIT_CUMULATIVE_ARGS</CODE> is used to find arguments for the function
|
|
being compiled.
|
|
<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><P>
|
|
|
|
<A NAME="IDX1377"></A>
|
|
<DT><CODE>INIT_CUMULATIVE_INCOMING_ARGS (<VAR>cum</VAR>, <VAR>fntype</VAR>, <VAR>libname</VAR>)</CODE>
|
|
<DD>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 GNU CC. The
|
|
argument <VAR>libname</VAR> exists for symmetry with
|
|
<CODE>INIT_CUMULATIVE_ARGS</CODE>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1378"></A>
|
|
<DT><CODE>FUNCTION_ARG_ADVANCE (<VAR>cum</VAR>, <VAR>mode</VAR>, <VAR>type</VAR>, <VAR>named</VAR>)</CODE>
|
|
<DD>A C statement (sans semicolon) to update the summarizer variable
|
|
<VAR>cum</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>FUNCTION_ARG</CODE>, etc.<P>
|
|
|
|
This macro 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><P>
|
|
|
|
<A NAME="IDX1379"></A>
|
|
<DT><CODE>FUNCTION_ARG_PADDING (<VAR>mode</VAR>, <VAR>type</VAR>)</CODE>
|
|
<DD>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 always just enough to reach the next
|
|
multiple of <CODE>FUNCTION_ARG_BOUNDARY</CODE>; this macro does not control
|
|
it.
|
|
</P><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><P>
|
|
|
|
<A NAME="IDX1380"></A>
|
|
<DT><CODE>FUNCTION_ARG_BOUNDARY (<VAR>mode</VAR>, <VAR>type</VAR>)</CODE>
|
|
<DD>If defined, a C expression that gives the alignment boundary, in bits,
|
|
of an argument with the specified mode and type. If it is not defined,
|
|
<CODE>PARM_BOUNDARY</CODE> is used for all arguments.
|
|
<P>
|
|
|
|
<A NAME="IDX1381"></A>
|
|
<DT><CODE>FUNCTION_ARG_REGNO_P (<VAR>regno</VAR>)</CODE>
|
|
<DD>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>
|
|
|
|
<A NAME="IDX1382"></A>
|
|
<DT><CODE>LOAD_ARGS_REVERSED</CODE>
|
|
<DD>If defined, the order in which arguments are loaded into their
|
|
respective argument registers is reversed so that the last
|
|
argument is loaded first. This macro only effects arguments
|
|
passed in registers.
|
|
<P>
|
|
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="Scalar Return"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC219"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC218" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC218"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC220" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC220"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC220" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC220"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC212" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC212"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC224" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC224"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H3> 17.7.7 How Scalar Function Values Are Returned </H3>
|
|
<!--docid::SEC219::-->
|
|
<P>
|
|
|
|
This section discusses the macros that control returning scalars as
|
|
values--values that can fit in registers.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1383"></A>
|
|
<DT><CODE>TRADITIONAL_RETURN_FLOAT</CODE>
|
|
<DD>Define this macro if <SAMP>`-traditional'</SAMP> should not cause functions
|
|
declared to return <CODE>float</CODE> to convert the value to <CODE>double</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX1384"></A>
|
|
<DT><CODE>FUNCTION_VALUE (<VAR>valtype</VAR>, <VAR>func</VAR>)</CODE>
|
|
<DD>A C expression to create an RTX representing the place where a
|
|
function returns a value of data type <VAR>valtype</VAR>. <VAR>valtype</VAR> is
|
|
a tree node representing a data type. Write <CODE>TYPE_MODE
|
|
(<VAR>valtype</VAR>)</CODE> to get the machine mode used to represent that type.
|
|
On many machines, only the mode is relevant. (Actually, on most
|
|
machines, scalar values are returned in the same place regardless of
|
|
mode).<P>
|
|
|
|
The value of the expression is usually a <CODE>reg</CODE> RTX for the hard
|
|
register where the return value is stored. The value can also be a
|
|
<CODE>parallel</CODE> RTX, if the return value is in multiple places. See
|
|
<CODE>FUNCTION_ARG</CODE> for an explanation of the <CODE>parallel</CODE> form.
|
|
</P><P>
|
|
|
|
If <CODE>PROMOTE_FUNCTION_RETURN</CODE> is defined, you must apply the same
|
|
promotion rules specified in <CODE>PROMOTE_MODE</CODE> if <VAR>valtype</VAR> is a
|
|
scalar type.
|
|
</P><P>
|
|
|
|
If the precise function being called is known, <VAR>func</VAR> is a tree
|
|
node (<CODE>FUNCTION_DECL</CODE>) for it; otherwise, <VAR>func</VAR> is a null
|
|
pointer. This makes it possible to use a different value-returning
|
|
convention for specific functions when all their calls are
|
|
known.</P><P>
|
|
|
|
<CODE>FUNCTION_VALUE</CODE> is not used for return vales with aggregate data
|
|
types, because these are returned in another way. See
|
|
<CODE>STRUCT_VALUE_REGNUM</CODE> and related macros, below.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1385"></A>
|
|
<DT><CODE>FUNCTION_OUTGOING_VALUE (<VAR>valtype</VAR>, <VAR>func</VAR>)</CODE>
|
|
<DD>Define this macro if the target machine has "register windows"
|
|
so that the register in which a function returns its value is not
|
|
the same as the one in which the caller sees the value.
|
|
<P>
|
|
|
|
For such machines, <CODE>FUNCTION_VALUE</CODE> computes the register in which
|
|
the caller will see the value. <CODE>FUNCTION_OUTGOING_VALUE</CODE> should be
|
|
defined in a similar fashion to tell the function where to put the
|
|
value.</P><P>
|
|
|
|
If <CODE>FUNCTION_OUTGOING_VALUE</CODE> is not defined,
|
|
<CODE>FUNCTION_VALUE</CODE> serves both purposes.</P><P>
|
|
|
|
<CODE>FUNCTION_OUTGOING_VALUE</CODE> is not used for return vales with
|
|
aggregate data types, because these are returned in another way. See
|
|
<CODE>STRUCT_VALUE_REGNUM</CODE> and related macros, below.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1386"></A>
|
|
<DT><CODE>LIBCALL_VALUE (<VAR>mode</VAR>)</CODE>
|
|
<DD>A C expression to create an RTX representing the place where a library
|
|
function returns a value of mode <VAR>mode</VAR>. If the precise function
|
|
being called is known, <VAR>func</VAR> is a tree node
|
|
(<CODE>FUNCTION_DECL</CODE>) for it; otherwise, <VAR>func</VAR> is a null
|
|
pointer. This makes it possible to use a different value-returning
|
|
convention for specific functions when all their calls are
|
|
known.<P>
|
|
|
|
Note that "library function" in this context means a compiler
|
|
support routine, used to perform arithmetic, whose name is known
|
|
specially by the compiler and was not mentioned in the C code being
|
|
compiled.
|
|
</P><P>
|
|
|
|
The definition of <CODE>LIBRARY_VALUE</CODE> need not be concerned aggregate
|
|
data types, because none of the library functions returns such types.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1387"></A>
|
|
<DT><CODE>FUNCTION_VALUE_REGNO_P (<VAR>regno</VAR>)</CODE>
|
|
<DD>A C expression that is nonzero if <VAR>regno</VAR> is the number of a hard
|
|
register in which the values of called function may come back.
|
|
<P>
|
|
|
|
A register whose use for returning values is limited to serving as the
|
|
second of a pair (for a value of type <CODE>double</CODE>, say) need not be
|
|
recognized by this macro. So for most machines, this definition
|
|
suffices:
|
|
</P><P>
|
|
|
|
<TABLE><tr><td> </td><td class=example><pre>#define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
|
|
</pre></td></tr></table></P><P>
|
|
|
|
If the machine has register windows, so that the caller and the called
|
|
function use different registers for the return value, this macro
|
|
should recognize only the caller's register numbers.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1388"></A>
|
|
<DT><CODE>APPLY_RESULT_SIZE</CODE>
|
|
<DD>Define this macro if <SAMP>`untyped_call'</SAMP> and <SAMP>`untyped_return'</SAMP>
|
|
need more space than is implied by <CODE>FUNCTION_VALUE_REGNO_P</CODE> for
|
|
saving and restoring an arbitrary return value.
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="Aggregate Return"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC220"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC219" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC219"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC221" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC221"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC221" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC221"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC212" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC212"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC224" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC224"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H3> 17.7.8 How Large Values Are Returned </H3>
|
|
<!--docid::SEC220::-->
|
|
<P>
|
|
|
|
When a function value's mode is <CODE>BLKmode</CODE> (and in some other
|
|
cases), the value is not returned according to <CODE>FUNCTION_VALUE</CODE>
|
|
(see section <A HREF="gcc_17.html#SEC219" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC219">17.7.7 How Scalar Function Values Are Returned</A>). Instead, the caller passes the address of a
|
|
block of memory in which the value should be stored. This address
|
|
is called the <EM>structure value address</EM>.
|
|
</P><P>
|
|
|
|
This section describes how to control returning structure values in
|
|
memory.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1389"></A>
|
|
<DT><CODE>RETURN_IN_MEMORY (<VAR>type</VAR>)</CODE>
|
|
<DD>A C expression which can inhibit the returning of certain function
|
|
values in registers, based on the type of value. A nonzero value says
|
|
to return the function value in memory, just as large structures are
|
|
always returned. Here <VAR>type</VAR> will be a C expression of type
|
|
<CODE>tree</CODE>, representing the data type of the value.
|
|
<P>
|
|
|
|
Note that values of mode <CODE>BLKmode</CODE> must be explicitly handled
|
|
by this macro. Also, the option <SAMP>`-fpcc-struct-return'</SAMP>
|
|
takes effect regardless of this macro. On most systems, it is
|
|
possible to leave the macro undefined; this causes a default
|
|
definition to be used, whose value is the constant 1 for <CODE>BLKmode</CODE>
|
|
values, and 0 otherwise.
|
|
</P><P>
|
|
|
|
Do not use this macro to indicate that structures and unions should always
|
|
be returned in memory. You should instead use <CODE>DEFAULT_PCC_STRUCT_RETURN</CODE>
|
|
to indicate this.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1390"></A>
|
|
<DT><CODE>DEFAULT_PCC_STRUCT_RETURN</CODE>
|
|
<DD>Define this macro to be 1 if all structure and union return values must be
|
|
in memory. Since this results in slower code, this should be defined
|
|
only if needed for compatibility with other compilers or with an ABI.
|
|
If you define this macro to be 0, then the conventions used for structure
|
|
and union return values are decided by the <CODE>RETURN_IN_MEMORY</CODE> macro.
|
|
<P>
|
|
|
|
If not defined, this defaults to the value 1.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1391"></A>
|
|
<DT><CODE>STRUCT_VALUE_REGNUM</CODE>
|
|
<DD>If the structure value address is passed in a register, then
|
|
<CODE>STRUCT_VALUE_REGNUM</CODE> should be the number of that register.
|
|
<P>
|
|
|
|
<A NAME="IDX1392"></A>
|
|
<DT><CODE>STRUCT_VALUE</CODE>
|
|
<DD>If the structure value address is not passed in a register, define
|
|
<CODE>STRUCT_VALUE</CODE> as an expression returning an RTX for the place
|
|
where the address is passed. If it returns 0, the address is passed as
|
|
an "invisible" first argument.
|
|
<P>
|
|
|
|
<A NAME="IDX1393"></A>
|
|
<DT><CODE>STRUCT_VALUE_INCOMING_REGNUM</CODE>
|
|
<DD>On some architectures the place where the structure value address
|
|
is found by the called function is not the same place that the
|
|
caller put it. This can be due to register windows, or it could
|
|
be because the function prologue moves it to a different place.
|
|
<P>
|
|
|
|
If the incoming location of the structure value address is in a
|
|
register, define this macro as the register number.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1394"></A>
|
|
<DT><CODE>STRUCT_VALUE_INCOMING</CODE>
|
|
<DD>If the incoming location is not a register, then you should define
|
|
<CODE>STRUCT_VALUE_INCOMING</CODE> as an expression for an RTX for where the
|
|
called function should find the value. If it should find the value on
|
|
the stack, define this to create a <CODE>mem</CODE> which refers to the frame
|
|
pointer. A definition of 0 means that the address is passed as an
|
|
"invisible" first argument.
|
|
<P>
|
|
|
|
<A NAME="IDX1395"></A>
|
|
<DT><CODE>PCC_STATIC_STRUCT_RETURN</CODE>
|
|
<DD>Define this macro if the usual system convention on the target machine
|
|
for returning structures and unions is for the called function to return
|
|
the address of a static variable containing the value.
|
|
<P>
|
|
|
|
Do not define this if the usual system convention is for the caller to
|
|
pass an address to the subroutine.
|
|
</P><P>
|
|
|
|
This macro has effect in <SAMP>`-fpcc-struct-return'</SAMP> mode, but it does
|
|
nothing when you use <SAMP>`-freg-struct-return'</SAMP> mode.
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="Caller Saves"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC221"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC220" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC220"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC222" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC222"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC224" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC224"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC212" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC212"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC224" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC224"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H3> 17.7.9 Caller-Saves Register Allocation </H3>
|
|
<!--docid::SEC221::-->
|
|
<P>
|
|
|
|
If you enable it, GNU CC can save registers around function calls. This
|
|
makes it possible to use call-clobbered registers to hold variables that
|
|
must live across calls.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1396"></A>
|
|
<DT><CODE>DEFAULT_CALLER_SAVES</CODE>
|
|
<DD>Define this macro if function calls on the target machine do not preserve
|
|
any registers; in other words, if <CODE>CALL_USED_REGISTERS</CODE> has 1
|
|
for all registers. When defined, this macro enables <SAMP>`-fcaller-saves'</SAMP>
|
|
by default for all optimization levels. It has no effect for optimization
|
|
levels 2 and higher, where <SAMP>`-fcaller-saves'</SAMP> is the default.
|
|
<P>
|
|
|
|
<A NAME="IDX1397"></A>
|
|
<DT><CODE>CALLER_SAVE_PROFITABLE (<VAR>refs</VAR>, <VAR>calls</VAR>)</CODE>
|
|
<DD>A C expression to determine whether it is worthwhile to consider placing
|
|
a pseudo-register in a call-clobbered hard register and saving and
|
|
restoring it around each function call. The expression should be 1 when
|
|
this is worth doing, and 0 otherwise.
|
|
<P>
|
|
|
|
If you don't define this macro, a default is used which is good on most
|
|
machines: <CODE>4 * <VAR>calls</VAR> < <VAR>refs</VAR></CODE>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1398"></A>
|
|
<DT><CODE>HARD_REGNO_CALLER_SAVE_MODE (<VAR>regno</VAR>, <VAR>nregs</VAR>)</CODE>
|
|
<DD>A C expression specifying which mode is required for saving <VAR>nregs</VAR>
|
|
of a pseudo-register in call-clobbered hard register <VAR>regno</VAR>. If
|
|
<VAR>regno</VAR> is unsuitable for caller save, <CODE>VOIDmode</CODE> should be
|
|
returned. For most machines this macro need not be defined since GCC
|
|
will select the smallest suitable mode.
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="Function Entry"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC222"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC221" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC221"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC223" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC223"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC214" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC214"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC212" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC212"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC224" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC224"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H3> 17.7.10 Function Entry and Exit </H3>
|
|
<!--docid::SEC222::-->
|
|
<P>
|
|
|
|
This section describes the macros that output function entry
|
|
(<EM>prologue</EM>) and exit (<EM>epilogue</EM>) code.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1399"></A>
|
|
<DT><CODE>FUNCTION_PROLOGUE (<VAR>file</VAR>, <VAR>size</VAR>)</CODE>
|
|
<DD>A C compound statement that outputs the assembler code for entry to a
|
|
function. The prologue is responsible for setting up the stack frame,
|
|
initializing the frame pointer register, saving registers that must be
|
|
saved, and allocating <VAR>size</VAR> additional bytes of storage for the
|
|
local variables. <VAR>size</VAR> is an integer. <VAR>file</VAR> is a stdio
|
|
stream to which the assembler code should be output.
|
|
<P>
|
|
|
|
The label for the beginning of the function need not be output by this
|
|
macro. That has already been done when the macro is run.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1400"></A>
|
|
To determine which registers to save, the macro can refer to the array
|
|
<CODE>regs_ever_live</CODE>: element <VAR>r</VAR> is nonzero if hard register
|
|
<VAR>r</VAR> is used anywhere within the function. This implies the function
|
|
prologue should save register <VAR>r</VAR>, provided it is not one of the
|
|
call-used registers. (<CODE>FUNCTION_EPILOGUE</CODE> must likewise use
|
|
<CODE>regs_ever_live</CODE>.)
|
|
</P><P>
|
|
|
|
On machines that have "register windows", the function entry code does
|
|
not save on the stack the registers that are in the windows, even if
|
|
they are supposed to be preserved by function calls; instead it takes
|
|
appropriate steps to "push" the register stack, if any non-call-used
|
|
registers are used in the function.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1401"></A>
|
|
On machines where functions may or may not have frame-pointers, the
|
|
function entry code must vary accordingly; it must set up the frame
|
|
pointer if one is wanted, and not otherwise. To determine whether a
|
|
frame pointer is in wanted, the macro can refer to the variable
|
|
<CODE>frame_pointer_needed</CODE>. The variable's value will be 1 at run
|
|
time in a function that needs a frame pointer. See section <A HREF="gcc_17.html#SEC216" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC216">17.7.4 Eliminating Frame Pointer and Arg Pointer</A>.
|
|
</P><P>
|
|
|
|
The function entry code is responsible for allocating any stack space
|
|
required for the function. This stack space consists of the regions
|
|
listed below. In most cases, these regions are allocated in the
|
|
order listed, with the last listed region closest to the top of the
|
|
stack (the lowest address if <CODE>STACK_GROWS_DOWNWARD</CODE> is defined, and
|
|
the highest address if it is not defined). You can use a different order
|
|
for a machine if doing so is more convenient or required for
|
|
compatibility reasons. Except in cases where required by standard
|
|
or by a debugger, there is no reason why the stack layout used by GCC
|
|
need agree with that used by other compilers for a machine.
|
|
</P><P>
|
|
|
|
<UL>
|
|
<LI>
|
|
<A NAME="IDX1402"></A>
|
|
A region of <CODE>current_function_pretend_args_size</CODE> bytes of
|
|
uninitialized space just underneath the first argument arriving on the
|
|
stack. (This may not be at the very start of the allocated stack region
|
|
if the calling sequence has pushed anything else since pushing the stack
|
|
arguments. But usually, on such machines, nothing else has been pushed
|
|
yet, because the function prologue itself does all the pushing.) This
|
|
region is used on machines where an argument may be passed partly in
|
|
registers and partly in memory, and, in some cases to support the
|
|
features in <TT>`varargs.h'</TT> and <TT>`stdargs.h'</TT>.
|
|
<P>
|
|
|
|
<LI>
|
|
An area of memory used to save certain registers used by the function.
|
|
The size of this area, which may also include space for such things as
|
|
the return address and pointers to previous stack frames, is
|
|
machine-specific and usually depends on which registers have been used
|
|
in the function. Machines with register windows often do not require
|
|
a save area.
|
|
<P>
|
|
|
|
<LI>
|
|
A region of at least <VAR>size</VAR> bytes, possibly rounded up to an allocation
|
|
boundary, to contain the local variables of the function. On some machines,
|
|
this region and the save area may occur in the opposite order, with the
|
|
save area closer to the top of the stack.
|
|
<P>
|
|
|
|
<LI>
|
|
<A NAME="IDX1403"></A>
|
|
Optionally, when <CODE>ACCUMULATE_OUTGOING_ARGS</CODE> is defined, a region of
|
|
<CODE>current_function_outgoing_args_size</CODE> bytes to be used for outgoing
|
|
argument lists of the function. See section <A HREF="gcc_17.html#SEC217" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC217">17.7.5 Passing Function Arguments on the Stack</A>.
|
|
</UL>
|
|
<P>
|
|
|
|
Normally, it is necessary for the macros <CODE>FUNCTION_PROLOGUE</CODE> and
|
|
<CODE>FUNCTION_EPILOGUE</CODE> to treat leaf functions specially. The C
|
|
variable <CODE>current_function_is_leaf</CODE> is nonzero for such a function.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1404"></A>
|
|
<DT><CODE>EXIT_IGNORE_STACK</CODE>
|
|
<DD>Define this macro as a C expression that is nonzero if the return
|
|
instruction or the function epilogue ignores the value of the stack
|
|
pointer; in other words, if it is safe to delete an instruction to
|
|
adjust the stack pointer before a return from the function.
|
|
<P>
|
|
|
|
Note that this macro's value is relevant only for functions for which
|
|
frame pointers are maintained. It is never safe to delete a final
|
|
stack adjustment in a function that has no frame pointer, and the
|
|
compiler knows this regardless of <CODE>EXIT_IGNORE_STACK</CODE>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1405"></A>
|
|
<DT><CODE>EPILOGUE_USES (<VAR>regno</VAR>)</CODE>
|
|
<DD>Define this macro as a C expression that is nonzero for registers are
|
|
used by the epilogue or the <SAMP>`return'</SAMP> pattern. The stack and frame
|
|
pointer registers are already be assumed to be used as needed.
|
|
<P>
|
|
|
|
<A NAME="IDX1406"></A>
|
|
<DT><CODE>FUNCTION_EPILOGUE (<VAR>file</VAR>, <VAR>size</VAR>)</CODE>
|
|
<DD>A C compound statement that outputs the assembler code for exit from a
|
|
function. The epilogue is responsible for restoring the saved
|
|
registers and stack pointer to their values when the function was
|
|
called, and returning control to the caller. This macro takes the
|
|
same arguments as the macro <CODE>FUNCTION_PROLOGUE</CODE>, and the
|
|
registers to restore are determined from <CODE>regs_ever_live</CODE> and
|
|
<CODE>CALL_USED_REGISTERS</CODE> in the same way.
|
|
<P>
|
|
|
|
On some machines, there is a single instruction that does all the work
|
|
of returning from the function. On these machines, give that
|
|
instruction the name <SAMP>`return'</SAMP> and do not define the macro
|
|
<CODE>FUNCTION_EPILOGUE</CODE> at all.
|
|
</P><P>
|
|
|
|
Do not define a pattern named <SAMP>`return'</SAMP> if you want the
|
|
<CODE>FUNCTION_EPILOGUE</CODE> to be used. If you want the target switches
|
|
to control whether return instructions or epilogues are used, define a
|
|
<SAMP>`return'</SAMP> pattern with a validity condition that tests the target
|
|
switches appropriately. If the <SAMP>`return'</SAMP> pattern's validity
|
|
condition is false, epilogues will be used.
|
|
</P><P>
|
|
|
|
On machines where functions may or may not have frame-pointers, the
|
|
function exit code must vary accordingly. Sometimes the code for these
|
|
two cases is completely different. To determine whether a frame pointer
|
|
is wanted, the macro can refer to the variable
|
|
<CODE>frame_pointer_needed</CODE>. The variable's value will be 1 when compiling
|
|
a function that needs a frame pointer.
|
|
</P><P>
|
|
|
|
Normally, <CODE>FUNCTION_PROLOGUE</CODE> and <CODE>FUNCTION_EPILOGUE</CODE> must
|
|
treat leaf functions specially. The C variable <CODE>current_function_is_leaf</CODE>
|
|
is nonzero for such a function. See section <A HREF="gcc_17.html#SEC208" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC208">17.5.4 Handling Leaf Functions</A>.
|
|
</P><P>
|
|
|
|
On some machines, some functions pop their arguments on exit while
|
|
others leave that for the caller to do. For example, the 68020 when
|
|
given <SAMP>`-mrtd'</SAMP> pops arguments in functions that take a fixed
|
|
number of arguments.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1407"></A>
|
|
Your definition of the macro <CODE>RETURN_POPS_ARGS</CODE> decides which
|
|
functions pop their own arguments. <CODE>FUNCTION_EPILOGUE</CODE> needs to
|
|
know what was decided. The variable that is called
|
|
<CODE>current_function_pops_args</CODE> is the number of bytes of its
|
|
arguments that a function should pop. See section <A HREF="gcc_17.html#SEC219" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC219">17.7.7 How Scalar Function Values Are Returned</A>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1408"></A>
|
|
<DT><CODE>DELAY_SLOTS_FOR_EPILOGUE</CODE>
|
|
<DD>Define this macro if the function epilogue contains delay slots to which
|
|
instructions from the rest of the function can be "moved". The
|
|
definition should be a C expression whose value is an integer
|
|
representing the number of delay slots there.
|
|
<P>
|
|
|
|
<A NAME="IDX1409"></A>
|
|
<DT><CODE>ELIGIBLE_FOR_EPILOGUE_DELAY (<VAR>insn</VAR>, <VAR>n</VAR>)</CODE>
|
|
<DD>A C expression that returns 1 if <VAR>insn</VAR> can be placed in delay
|
|
slot number <VAR>n</VAR> of the epilogue.
|
|
<P>
|
|
|
|
The argument <VAR>n</VAR> is an integer which identifies the delay slot now
|
|
being considered (since different slots may have different rules of
|
|
eligibility). It is never negative and is always less than the number
|
|
of epilogue delay slots (what <CODE>DELAY_SLOTS_FOR_EPILOGUE</CODE> returns).
|
|
If you reject a particular insn for a given delay slot, in principle, it
|
|
may be reconsidered for a subsequent delay slot. Also, other insns may
|
|
(at least in principle) be considered for the so far unfilled delay
|
|
slot.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1410"></A>
|
|
<A NAME="IDX1411"></A>
|
|
The insns accepted to fill the epilogue delay slots are put in an RTL
|
|
list made with <CODE>insn_list</CODE> objects, stored in the variable
|
|
<CODE>current_function_epilogue_delay_list</CODE>. The insn for the first
|
|
delay slot comes first in the list. Your definition of the macro
|
|
<CODE>FUNCTION_EPILOGUE</CODE> should fill the delay slots by outputting the
|
|
insns in this list, usually by calling <CODE>final_scan_insn</CODE>.
|
|
</P><P>
|
|
|
|
You need not define this macro if you did not define
|
|
<CODE>DELAY_SLOTS_FOR_EPILOGUE</CODE>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1412"></A>
|
|
<DT><CODE>ASM_OUTPUT_MI_THUNK (<VAR>file</VAR>, <VAR>thunk_fndecl</VAR>, <VAR>delta</VAR>, <VAR>function</VAR>)</CODE>
|
|
<DD>A C compound statement that outputs the assembler code for a thunk
|
|
function, used to implement C++ virtual function calls with multiple
|
|
inheritance. The thunk acts as a wrapper around a virtual function,
|
|
adjusting the implicit object parameter before handing control off to
|
|
the real function.
|
|
<P>
|
|
|
|
First, emit code to add the integer <VAR>delta</VAR> to the location that
|
|
contains the incoming first argument. Assume that this argument
|
|
contains a pointer, and is the one used to pass the <CODE>this</CODE> pointer
|
|
in C++. This is the incoming argument <EM>before</EM> the function prologue,
|
|
e.g. <SAMP>`%o0'</SAMP> on a sparc. The addition must preserve the values of
|
|
all other incoming arguments.
|
|
</P><P>
|
|
|
|
After the addition, emit code to jump to <VAR>function</VAR>, which is a
|
|
<CODE>FUNCTION_DECL</CODE>. This is a direct pure jump, not a call, and does
|
|
not touch the return address. Hence returning from <VAR>FUNCTION</VAR> will
|
|
return to whoever called the current <SAMP>`thunk'</SAMP>.
|
|
</P><P>
|
|
|
|
The effect must be as if <VAR>function</VAR> had been called directly with
|
|
the adjusted first argument. This macro is responsible for emitting all
|
|
of the code for a thunk function; <CODE>FUNCTION_PROLOGUE</CODE> and
|
|
<CODE>FUNCTION_EPILOGUE</CODE> are not invoked.
|
|
</P><P>
|
|
|
|
The <VAR>thunk_fndecl</VAR> is redundant. (<VAR>delta</VAR> and <VAR>function</VAR>
|
|
have already been extracted from it.) It might possibly be useful on
|
|
some targets, but probably not.
|
|
</P><P>
|
|
|
|
If you do not define this macro, the target-independent code in the C++
|
|
frontend will generate a less efficient heavyweight thunk that calls
|
|
<VAR>function</VAR> instead of jumping to it. The generic approach does
|
|
not support varargs.
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="Profiling"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC223"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC222" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC222"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC224" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC224"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC214" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC214"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC212" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC212"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC224" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC224"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H3> 17.7.11 Generating Code for Profiling </H3>
|
|
<!--docid::SEC223::-->
|
|
<P>
|
|
|
|
These macros will help you generate code for profiling.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1413"></A>
|
|
<DT><CODE>FUNCTION_PROFILER (<VAR>file</VAR>, <VAR>labelno</VAR>)</CODE>
|
|
<DD>A C statement or compound statement to output to <VAR>file</VAR> some
|
|
assembler code to call the profiling subroutine <CODE>mcount</CODE>.
|
|
Before calling, the assembler code must load the address of a
|
|
counter variable into a register where <CODE>mcount</CODE> expects to
|
|
find the address. The name of this variable is <SAMP>`LP'</SAMP> followed
|
|
by the number <VAR>labelno</VAR>, so you would generate the name using
|
|
<SAMP>`LP%d'</SAMP> in a <CODE>fprintf</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX1414"></A>
|
|
The details of how the address should be passed to <CODE>mcount</CODE> are
|
|
determined by your operating system environment, not by GNU CC. To
|
|
figure them out, compile a small program for profiling using the
|
|
system's installed C compiler and look at the assembler code that
|
|
results.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1415"></A>
|
|
<DT><CODE>PROFILE_BEFORE_PROLOGUE</CODE>
|
|
<DD>Define this macro if the code for function profiling should come before
|
|
the function prologue. Normally, the profiling code comes after.
|
|
<P>
|
|
|
|
<A NAME="IDX1416"></A>
|
|
<A NAME="IDX1417"></A>
|
|
<DT><CODE>FUNCTION_BLOCK_PROFILER (<VAR>file</VAR>, <VAR>labelno</VAR>)</CODE>
|
|
<DD>A C statement or compound statement to output to <VAR>file</VAR> some
|
|
assembler code to initialize basic-block profiling for the current
|
|
object module. The global compile flag <CODE>profile_block_flag</CODE>
|
|
distinguishes two profile modes.
|
|
<P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1418"></A>
|
|
<DT><CODE>profile_block_flag != 2</CODE>
|
|
<DD>Output code to call the subroutine <CODE>__bb_init_func</CODE> once per
|
|
object module, passing it as its sole argument the address of a block
|
|
allocated in the object module.
|
|
<P>
|
|
|
|
The name of the block is a local symbol made with this statement:
|
|
</P><P>
|
|
|
|
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>ASM_GENERATE_INTERNAL_LABEL (<VAR>buffer</VAR>, "LPBX", 0);
|
|
</FONT></pre></td></tr></table></P><P>
|
|
|
|
Of course, since you are writing the definition of
|
|
<CODE>ASM_GENERATE_INTERNAL_LABEL</CODE> as well as that of this macro, you
|
|
can take a short cut in the definition of this macro and use the name
|
|
that you know will result.
|
|
</P><P>
|
|
|
|
The first word of this block is a flag which will be nonzero if the
|
|
object module has already been initialized. So test this word first,
|
|
and do not call <CODE>__bb_init_func</CODE> if the flag is
|
|
nonzero. BLOCK_OR_LABEL contains a unique number which may be used to
|
|
generate a label as a branch destination when <CODE>__bb_init_func</CODE>
|
|
will not be called.
|
|
</P><P>
|
|
|
|
Described in assembler language, the code to be output looks like:
|
|
</P><P>
|
|
|
|
<TABLE><tr><td> </td><td class=example><pre> cmp (LPBX0),0
|
|
bne local_label
|
|
parameter1 <- LPBX0
|
|
call __bb_init_func
|
|
local_label:
|
|
</pre></td></tr></table></P><P>
|
|
|
|
<A NAME="IDX1419"></A>
|
|
<DT><CODE>profile_block_flag == 2</CODE>
|
|
<DD>Output code to call the subroutine <CODE>__bb_init_trace_func</CODE>
|
|
and pass two parameters to it. The first parameter is the same as
|
|
for <CODE>__bb_init_func</CODE>. The second parameter is the number of the
|
|
first basic block of the function as given by BLOCK_OR_LABEL. Note
|
|
that <CODE>__bb_init_trace_func</CODE> has to be called, even if the object
|
|
module has been initialized already.
|
|
<P>
|
|
|
|
Described in assembler language, the code to be output looks like:
|
|
<TABLE><tr><td> </td><td class=example><pre>parameter1 <- LPBX0
|
|
parameter2 <- BLOCK_OR_LABEL
|
|
call __bb_init_trace_func
|
|
</pre></td></tr></table></DL>
|
|
<P>
|
|
|
|
<A NAME="IDX1420"></A>
|
|
<A NAME="IDX1421"></A>
|
|
<DT><CODE>BLOCK_PROFILER (<VAR>file</VAR>, <VAR>blockno</VAR>)</CODE>
|
|
<DD>A C statement or compound statement to output to <VAR>file</VAR> some
|
|
assembler code to increment the count associated with the basic
|
|
block number <VAR>blockno</VAR>. The global compile flag
|
|
<CODE>profile_block_flag</CODE> distinguishes two profile modes.
|
|
<P>
|
|
|
|
<DL COMPACT>
|
|
<DT><CODE>profile_block_flag != 2</CODE>
|
|
<DD>Output code to increment the counter directly. Basic blocks are
|
|
numbered separately from zero within each compilation. The count
|
|
associated with block number <VAR>blockno</VAR> is at index
|
|
<VAR>blockno</VAR> in a vector of words; the name of this array is a local
|
|
symbol made with this statement:
|
|
<P>
|
|
|
|
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>ASM_GENERATE_INTERNAL_LABEL (<VAR>buffer</VAR>, "LPBX", 2);
|
|
</FONT></pre></td></tr></table></P><P>
|
|
|
|
Of course, since you are writing the definition of
|
|
<CODE>ASM_GENERATE_INTERNAL_LABEL</CODE> as well as that of this macro, you
|
|
can take a short cut in the definition of this macro and use the name
|
|
that you know will result.
|
|
</P><P>
|
|
|
|
Described in assembler language, the code to be output looks like:
|
|
</P><P>
|
|
|
|
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>inc (LPBX2+4*BLOCKNO)
|
|
</FONT></pre></td></tr></table></P><P>
|
|
|
|
<A NAME="IDX1422"></A>
|
|
<A NAME="IDX1423"></A>
|
|
<DT><CODE>profile_block_flag == 2</CODE>
|
|
<DD>Output code to initialize the global structure <CODE>__bb</CODE> and
|
|
call the function <CODE>__bb_trace_func</CODE>, which will increment the
|
|
counter.
|
|
<P>
|
|
|
|
<CODE>__bb</CODE> consists of two words. In the first word, the current
|
|
basic block number, as given by BLOCKNO, has to be stored. In
|
|
the second word, the address of a block allocated in the object
|
|
module has to be stored. The address is given by the label created
|
|
with this statement:
|
|
</P><P>
|
|
|
|
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>ASM_GENERATE_INTERNAL_LABEL (<VAR>buffer</VAR>, "LPBX", 0);
|
|
</FONT></pre></td></tr></table></P><P>
|
|
|
|
Described in assembler language, the code to be output looks like:
|
|
<TABLE><tr><td> </td><td class=example><pre>move BLOCKNO -> (__bb)
|
|
move LPBX0 -> (__bb+4)
|
|
call __bb_trace_func
|
|
</pre></td></tr></table></DL>
|
|
<P>
|
|
|
|
<A NAME="IDX1424"></A>
|
|
<A NAME="IDX1425"></A>
|
|
<A NAME="IDX1426"></A>
|
|
<DT><CODE>FUNCTION_BLOCK_PROFILER_EXIT (<VAR>file</VAR>)</CODE>
|
|
<DD>A C statement or compound statement to output to <VAR>file</VAR>
|
|
assembler code to call function <CODE>__bb_trace_ret</CODE>. The
|
|
assembler code should only be output
|
|
if the global compile flag <CODE>profile_block_flag</CODE> == 2. This
|
|
macro has to be used at every place where code for returning from
|
|
a function is generated (e.g. <CODE>FUNCTION_EPILOGUE</CODE>). Although
|
|
you have to write the definition of <CODE>FUNCTION_EPILOGUE</CODE>
|
|
as well, you have to define this macro to tell the compiler, that
|
|
the proper call to <CODE>__bb_trace_ret</CODE> is produced.
|
|
<P>
|
|
|
|
<A NAME="IDX1427"></A>
|
|
<A NAME="IDX1428"></A>
|
|
<A NAME="IDX1429"></A>
|
|
<A NAME="IDX1430"></A>
|
|
<DT><CODE>MACHINE_STATE_SAVE (<VAR>id</VAR>)</CODE>
|
|
<DD>A C statement or compound statement to save all registers, which may
|
|
be clobbered by a function call, including condition codes. The
|
|
<CODE>asm</CODE> statement will be mostly likely needed to handle this
|
|
task. Local labels in the assembler code can be concatenated with the
|
|
string <VAR>id</VAR>, to obtain a unique lable name.
|
|
<P>
|
|
|
|
Registers or condition codes clobbered by <CODE>FUNCTION_PROLOGUE</CODE> or
|
|
<CODE>FUNCTION_EPILOGUE</CODE> must be saved in the macros
|
|
<CODE>FUNCTION_BLOCK_PROFILER</CODE>, <CODE>FUNCTION_BLOCK_PROFILER_EXIT</CODE> and
|
|
<CODE>BLOCK_PROFILER</CODE> prior calling <CODE>__bb_init_trace_func</CODE>,
|
|
<CODE>__bb_trace_ret</CODE> and <CODE>__bb_trace_func</CODE> respectively.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1431"></A>
|
|
<A NAME="IDX1432"></A>
|
|
<A NAME="IDX1433"></A>
|
|
<A NAME="IDX1434"></A>
|
|
<DT><CODE>MACHINE_STATE_RESTORE (<VAR>id</VAR>)</CODE>
|
|
<DD>A C statement or compound statement to restore all registers, including
|
|
condition codes, saved by <CODE>MACHINE_STATE_SAVE</CODE>.
|
|
<P>
|
|
|
|
Registers or condition codes clobbered by <CODE>FUNCTION_PROLOGUE</CODE> or
|
|
<CODE>FUNCTION_EPILOGUE</CODE> must be restored in the macros
|
|
<CODE>FUNCTION_BLOCK_PROFILER</CODE>, <CODE>FUNCTION_BLOCK_PROFILER_EXIT</CODE> and
|
|
<CODE>BLOCK_PROFILER</CODE> after calling <CODE>__bb_init_trace_func</CODE>,
|
|
<CODE>__bb_trace_ret</CODE> and <CODE>__bb_trace_func</CODE> respectively.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1435"></A>
|
|
<DT><CODE>BLOCK_PROFILER_CODE</CODE>
|
|
<DD>A C function or functions which are needed in the library to
|
|
support block profiling.
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="Varargs"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC224"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC223" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC223"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC225" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC225"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC225" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC225"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC199" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC199"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_18.html#SEC251" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_18.html#SEC251"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H2> 17.8 Implementing the Varargs Macros </H2>
|
|
<!--docid::SEC224::-->
|
|
<P>
|
|
|
|
GNU CC comes with an implementation of <TT>`varargs.h'</TT> and
|
|
<TT>`stdarg.h'</TT> that work without change on machines that pass arguments
|
|
on the stack. Other machines require their own implementations of
|
|
varargs, and the two machine independent header files must have
|
|
conditionals to include it.
|
|
</P><P>
|
|
|
|
ANSI <TT>`stdarg.h'</TT> differs from traditional <TT>`varargs.h'</TT> mainly in
|
|
the calling convention for <CODE>va_start</CODE>. The traditional
|
|
implementation takes just one argument, which is the variable in which
|
|
to store the argument pointer. The ANSI implementation of
|
|
<CODE>va_start</CODE> takes an additional second argument. The user is
|
|
supposed to write the last named argument of the function here.
|
|
</P><P>
|
|
|
|
However, <CODE>va_start</CODE> should not use this argument. The way to find
|
|
the end of the named arguments is with the built-in functions described
|
|
below.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1436"></A>
|
|
<DT><CODE>__builtin_saveregs ()</CODE>
|
|
<DD>Use this built-in function to save the argument registers in memory so
|
|
that the varargs mechanism can access them. Both ANSI and traditional
|
|
versions of <CODE>va_start</CODE> must use <CODE>__builtin_saveregs</CODE>, unless
|
|
you use <CODE>SETUP_INCOMING_VARARGS</CODE> (see below) instead.
|
|
<P>
|
|
|
|
On some machines, <CODE>__builtin_saveregs</CODE> is open-coded under the
|
|
control of the macro <CODE>EXPAND_BUILTIN_SAVEREGS</CODE>. On other machines,
|
|
it calls a routine written in assembler language, found in
|
|
<TT>`libgcc2.c'</TT>.
|
|
</P><P>
|
|
|
|
Code generated for the call to <CODE>__builtin_saveregs</CODE> appears at the
|
|
beginning of the function, as opposed to where the call to
|
|
<CODE>__builtin_saveregs</CODE> is written, regardless of what the code is.
|
|
This is because the registers must be saved before the function starts
|
|
to use them for its own purposes.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1437"></A>
|
|
<DT><CODE>__builtin_args_info (<VAR>category</VAR>)</CODE>
|
|
<DD>Use this built-in function to find the first anonymous arguments in
|
|
registers.
|
|
<P>
|
|
|
|
In general, a machine may have several categories of registers used for
|
|
arguments, each for a particular category of data types. (For example,
|
|
on some machines, floating-point registers are used for floating-point
|
|
arguments while other arguments are passed in the general registers.)
|
|
To make non-varargs functions use the proper calling convention, you
|
|
have defined the <CODE>CUMULATIVE_ARGS</CODE> data type to record how many
|
|
registers in each category have been used so far
|
|
</P><P>
|
|
|
|
<CODE>__builtin_args_info</CODE> accesses the same data structure of type
|
|
<CODE>CUMULATIVE_ARGS</CODE> after the ordinary argument layout is finished
|
|
with it, with <VAR>category</VAR> specifying which word to access. Thus, the
|
|
value indicates the first unused register in a given category.
|
|
</P><P>
|
|
|
|
Normally, you would use <CODE>__builtin_args_info</CODE> in the implementation
|
|
of <CODE>va_start</CODE>, accessing each category just once and storing the
|
|
value in the <CODE>va_list</CODE> object. This is because <CODE>va_list</CODE> will
|
|
have to update the values, and there is no way to alter the
|
|
values accessed by <CODE>__builtin_args_info</CODE>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1438"></A>
|
|
<DT><CODE>__builtin_next_arg (<VAR>lastarg</VAR>)</CODE>
|
|
<DD>This is the equivalent of <CODE>__builtin_args_info</CODE>, for stack
|
|
arguments. It returns the address of the first anonymous stack
|
|
argument, as type <CODE>void *</CODE>. If <CODE>ARGS_GROW_DOWNWARD</CODE>, it
|
|
returns the address of the location above the first anonymous stack
|
|
argument. Use it in <CODE>va_start</CODE> to initialize the pointer for
|
|
fetching arguments from the stack. Also use it in <CODE>va_start</CODE> to
|
|
verify that the second parameter <VAR>lastarg</VAR> is the last named argument
|
|
of the current function.
|
|
<P>
|
|
|
|
<A NAME="IDX1439"></A>
|
|
<DT><CODE>__builtin_classify_type (<VAR>object</VAR>)</CODE>
|
|
<DD>Since each machine has its own conventions for which data types are
|
|
passed in which kind of register, your implementation of <CODE>va_arg</CODE>
|
|
has to embody these conventions. The easiest way to categorize the
|
|
specified data type is to use <CODE>__builtin_classify_type</CODE> together
|
|
with <CODE>sizeof</CODE> and <CODE>__alignof__</CODE>.
|
|
<P>
|
|
|
|
<CODE>__builtin_classify_type</CODE> ignores the value of <VAR>object</VAR>,
|
|
considering only its data type. It returns an integer describing what
|
|
kind of type that is--integer, floating, pointer, structure, and so on.
|
|
</P><P>
|
|
|
|
The file <TT>`typeclass.h'</TT> defines an enumeration that you can use to
|
|
interpret the values of <CODE>__builtin_classify_type</CODE>.
|
|
</DL>
|
|
<P>
|
|
|
|
These machine description macros help implement varargs:
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1440"></A>
|
|
<DT><CODE>EXPAND_BUILTIN_SAVEREGS (<VAR>args</VAR>)</CODE>
|
|
<DD>If defined, is a C expression that produces the machine-specific code
|
|
for a call to <CODE>__builtin_saveregs</CODE>. This code will be moved to the
|
|
very beginning of the function, before any parameter access are made.
|
|
The return value of this function should be an RTX that contains the
|
|
value to use as the return of <CODE>__builtin_saveregs</CODE>.
|
|
<P>
|
|
|
|
The argument <VAR>args</VAR> is a <CODE>tree_list</CODE> containing the arguments
|
|
that were passed to <CODE>__builtin_saveregs</CODE>.
|
|
</P><P>
|
|
|
|
If this macro is not defined, the compiler will output an ordinary
|
|
call to the library function <SAMP>`__builtin_saveregs'</SAMP>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1441"></A>
|
|
<DT><CODE>SETUP_INCOMING_VARARGS (<VAR>args_so_far</VAR>, <VAR>mode</VAR>, <VAR>type</VAR>, <VAR>pretend_args_size</VAR>, <VAR>second_time</VAR>)</CODE>
|
|
<DD>This macro offers an alternative to using <CODE>__builtin_saveregs</CODE> and
|
|
defining the macro <CODE>EXPAND_BUILTIN_SAVEREGS</CODE>. Use it to store the
|
|
anonymous register arguments into the stack so that all the arguments
|
|
appear to have been passed consecutively on the stack. Once this is
|
|
done, you can use the standard implementation of varargs that works for
|
|
machines that pass all their arguments on the stack.
|
|
<P>
|
|
|
|
The argument <VAR>args_so_far</VAR> is the <CODE>CUMULATIVE_ARGS</CODE> data
|
|
structure, containing the values that obtain after processing of the
|
|
named arguments. The arguments <VAR>mode</VAR> and <VAR>type</VAR> describe the
|
|
last named argument--its machine mode and its data type as a tree node.
|
|
</P><P>
|
|
|
|
The macro implementation should do two things: first, push onto the
|
|
stack all the argument registers <EM>not</EM> used for the named
|
|
arguments, and second, store the size of the data thus pushed into the
|
|
<CODE>int</CODE>-valued variable whose name is supplied as the argument
|
|
<VAR>pretend_args_size</VAR>. The value that you store here will serve as
|
|
additional offset for setting up the stack frame.
|
|
</P><P>
|
|
|
|
Because you must generate code to push the anonymous arguments at
|
|
compile time without knowing their data types,
|
|
<CODE>SETUP_INCOMING_VARARGS</CODE> is only useful on machines that have just
|
|
a single category of argument register and use it uniformly for all data
|
|
types.
|
|
</P><P>
|
|
|
|
If the argument <VAR>second_time</VAR> is nonzero, it means that the
|
|
arguments of the function are being analyzed for the second time. This
|
|
happens for an inline function, which is not actually compiled until the
|
|
end of the source file. The macro <CODE>SETUP_INCOMING_VARARGS</CODE> should
|
|
not generate any instructions in this case.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1442"></A>
|
|
<DT><CODE>STRICT_ARGUMENT_NAMING</CODE>
|
|
<DD>Define this macro to be a nonzero value if the location where a function
|
|
argument is passed depends on whether or not it is a named argument.
|
|
<P>
|
|
|
|
This macro controls how the <VAR>named</VAR> argument to <CODE>FUNCTION_ARG</CODE>
|
|
is set for varargs and stdarg functions. If this macro returns a
|
|
nonzero value, the <VAR>named</VAR> argument is always true for named
|
|
arguments, and false for unnamed arguments. If it returns a value of
|
|
zero, but <CODE>SETUP_INCOMING_VARARGS</CODE> is defined, then all arguments
|
|
are treated as named. Otherwise, all named arguments except the last
|
|
are treated as named.
|
|
</P><P>
|
|
|
|
You need not define this macro if it always returns zero.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1443"></A>
|
|
<DT><CODE>PRETEND_OUTGOING_VARARGS_NAMED</CODE>
|
|
<DD>If you need to conditionally change ABIs so that one works with
|
|
<CODE>SETUP_INCOMING_VARARGS</CODE>, but the other works like neither
|
|
<CODE>SETUP_INCOMING_VARARGS</CODE> nor <CODE>STRICT_ARGUMENT_NAMING</CODE> was
|
|
defined, then define this macro to return nonzero if
|
|
<CODE>SETUP_INCOMING_VARARGS</CODE> is used, zero otherwise.
|
|
Otherwise, you should not define this macro.
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="Trampolines"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC225"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC224" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC224"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC226" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC226"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC199" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC199"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC199" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC199"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_18.html#SEC251" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_18.html#SEC251"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H2> 17.9 Trampolines for Nested Functions </H2>
|
|
<!--docid::SEC225::-->
|
|
<P>
|
|
|
|
A <EM>trampoline</EM> is a small piece of code that is created at run time
|
|
when the address of a nested function is taken. It normally resides on
|
|
the stack, in the stack frame of the containing function. These macros
|
|
tell GNU CC how to generate code to allocate and initialize a
|
|
trampoline.
|
|
</P><P>
|
|
|
|
The instructions in the trampoline must do two things: load a constant
|
|
address into the static chain register, and jump to the real address of
|
|
the nested function. On CISC machines such as the m68k, this requires
|
|
two instructions, a move immediate and a jump. Then the two addresses
|
|
exist in the trampoline as word-long immediate operands. On RISC
|
|
machines, it is often necessary to load each address into a register in
|
|
two parts. Then pieces of each address form separate immediate
|
|
operands.
|
|
</P><P>
|
|
|
|
The code generated to initialize the trampoline must store the variable
|
|
parts--the static chain value and the function address--into the
|
|
immediate operands of the instructions. On a CISC machine, this is
|
|
simply a matter of copying each address to a memory reference at the
|
|
proper offset from the start of the trampoline. On a RISC machine, it
|
|
may be necessary to take out pieces of the address and store them
|
|
separately.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1444"></A>
|
|
<DT><CODE>TRAMPOLINE_TEMPLATE (<VAR>file</VAR>)</CODE>
|
|
<DD>A C statement to output, on the stream <VAR>file</VAR>, assembler code for a
|
|
block of data that contains the constant parts of a trampoline. This
|
|
code should not include a label--the label is taken care of
|
|
automatically.
|
|
<P>
|
|
|
|
If you do not define this macro, it means no template is needed
|
|
for the target. Do not define this macro on systems where the block move
|
|
code to copy the trampoline into place would be larger than the code
|
|
to generate it on the spot.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1445"></A>
|
|
<DT><CODE>TRAMPOLINE_SECTION</CODE>
|
|
<DD>The name of a subroutine to switch to the section in which the
|
|
trampoline template is to be placed (see section <A HREF="gcc_17.html#SEC230" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC230">17.14 Dividing the Output into Sections (Texts, Data, <small>...</small>)</A>). The default is
|
|
a value of <SAMP>`readonly_data_section'</SAMP>, which places the trampoline in
|
|
the section containing read-only data.
|
|
<P>
|
|
|
|
<A NAME="IDX1446"></A>
|
|
<DT><CODE>TRAMPOLINE_SIZE</CODE>
|
|
<DD>A C expression for the size in bytes of the trampoline, as an integer.
|
|
<P>
|
|
|
|
<A NAME="IDX1447"></A>
|
|
<DT><CODE>TRAMPOLINE_ALIGNMENT</CODE>
|
|
<DD>Alignment required for trampolines, in bits.
|
|
<P>
|
|
|
|
If you don't define this macro, the value of <CODE>BIGGEST_ALIGNMENT</CODE>
|
|
is used for aligning trampolines.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1448"></A>
|
|
<DT><CODE>INITIALIZE_TRAMPOLINE (<VAR>addr</VAR>, <VAR>fnaddr</VAR>, <VAR>static_chain</VAR>)</CODE>
|
|
<DD>A C statement to initialize the variable parts of a trampoline.
|
|
<VAR>addr</VAR> is an RTX for the address of the trampoline; <VAR>fnaddr</VAR> is
|
|
an RTX for the address of the nested function; <VAR>static_chain</VAR> is an
|
|
RTX for the static chain value that should be passed to the function
|
|
when it is called.
|
|
<P>
|
|
|
|
<A NAME="IDX1449"></A>
|
|
<DT><CODE>ALLOCATE_TRAMPOLINE (<VAR>fp</VAR>)</CODE>
|
|
<DD>A C expression to allocate run-time space for a trampoline. The
|
|
expression value should be an RTX representing a memory reference to the
|
|
space for the trampoline.
|
|
<P>
|
|
|
|
<A NAME="IDX1450"></A>
|
|
<A NAME="IDX1451"></A>
|
|
If this macro is not defined, by default the trampoline is allocated as
|
|
a stack slot. This default is right for most machines. The exceptions
|
|
are machines where it is impossible to execute instructions in the stack
|
|
area. On such machines, you may have to implement a separate stack,
|
|
using this macro in conjunction with <CODE>FUNCTION_PROLOGUE</CODE> and
|
|
<CODE>FUNCTION_EPILOGUE</CODE>.
|
|
</P><P>
|
|
|
|
<VAR>fp</VAR> points to a data structure, a <CODE>struct function</CODE>, which
|
|
describes the compilation status of the immediate containing function of
|
|
the function which the trampoline is for. Normally (when
|
|
<CODE>ALLOCATE_TRAMPOLINE</CODE> is not defined), the stack slot for the
|
|
trampoline is in the stack frame of this containing function. Other
|
|
allocation strategies probably must do something analogous with this
|
|
information.
|
|
</DL>
|
|
<P>
|
|
|
|
Implementing trampolines is difficult on many machines because they have
|
|
separate instruction and data caches. Writing into a stack location
|
|
fails to clear the memory in the instruction cache, so when the program
|
|
jumps to that location, it executes the old contents.
|
|
</P><P>
|
|
|
|
Here are two possible solutions. One is to clear the relevant parts of
|
|
the instruction cache whenever a trampoline is set up. The other is to
|
|
make all trampolines identical, by having them jump to a standard
|
|
subroutine. The former technique makes trampoline execution faster; the
|
|
latter makes initialization faster.
|
|
</P><P>
|
|
|
|
To clear the instruction cache when a trampoline is initialized, define
|
|
the following macros which describe the shape of the cache.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1452"></A>
|
|
<DT><CODE>INSN_CACHE_SIZE</CODE>
|
|
<DD>The total size in bytes of the cache.
|
|
<P>
|
|
|
|
<A NAME="IDX1453"></A>
|
|
<DT><CODE>INSN_CACHE_LINE_WIDTH</CODE>
|
|
<DD>The length in bytes of each cache line. The cache is divided into cache
|
|
lines which are disjoint slots, each holding a contiguous chunk of data
|
|
fetched from memory. Each time data is brought into the cache, an
|
|
entire line is read at once. The data loaded into a cache line is
|
|
always aligned on a boundary equal to the line size.
|
|
<P>
|
|
|
|
<A NAME="IDX1454"></A>
|
|
<DT><CODE>INSN_CACHE_DEPTH</CODE>
|
|
<DD>The number of alternative cache lines that can hold any particular memory
|
|
location.
|
|
</DL>
|
|
<P>
|
|
|
|
Alternatively, if the machine has system calls or instructions to clear
|
|
the instruction cache directly, you can define the following macro.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1455"></A>
|
|
<DT><CODE>CLEAR_INSN_CACHE (<VAR>BEG</VAR>, <VAR>END</VAR>)</CODE>
|
|
<DD>If defined, expands to a C expression clearing the <EM>instruction
|
|
cache</EM> in the specified interval. If it is not defined, and the macro
|
|
INSN_CACHE_SIZE is defined, some generic code is generated to clear the
|
|
cache. The definition of this macro would typically be a series of
|
|
<CODE>asm</CODE> statements. Both <VAR>BEG</VAR> and <VAR>END</VAR> are both pointer
|
|
expressions.
|
|
</DL>
|
|
<P>
|
|
|
|
To use a standard subroutine, define the following macro. In addition,
|
|
you must make sure that the instructions in a trampoline fill an entire
|
|
cache line with identical instructions, or else ensure that the
|
|
beginning of the trampoline code is always aligned at the same point in
|
|
its cache line. Look in <TT>`m68k.h'</TT> as a guide.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1456"></A>
|
|
<DT><CODE>TRANSFER_FROM_TRAMPOLINE</CODE>
|
|
<DD>Define this macro if trampolines need a special subroutine to do their
|
|
work. The macro should expand to a series of <CODE>asm</CODE> statements
|
|
which will be compiled with GNU CC. They go in a library function named
|
|
<CODE>__transfer_from_trampoline</CODE>.
|
|
<P>
|
|
|
|
If you need to avoid executing the ordinary prologue code of a compiled
|
|
C function when you jump to the subroutine, you can do so by placing a
|
|
special label of your own in the assembler code. Use one <CODE>asm</CODE>
|
|
statement to generate an assembler label, and another to make the label
|
|
global. Then trampolines can use that label to jump directly to your
|
|
special assembler code.
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="Library Calls"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC226"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC225" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC225"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC227" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC227"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC201" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC201"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC199" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC199"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_18.html#SEC251" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_18.html#SEC251"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H2> 17.10 Implicit Calls to Library Routines </H2>
|
|
<!--docid::SEC226::-->
|
|
<P>
|
|
|
|
Here is an explanation of implicit calls to library routines.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1457"></A>
|
|
<DT><CODE>MULSI3_LIBCALL</CODE>
|
|
<DD>A C string constant giving the name of the function to call for
|
|
multiplication of one signed full-word by another. If you do not
|
|
define this macro, the default name is used, which is <CODE>__mulsi3</CODE>,
|
|
a function defined in <TT>`libgcc.a'</TT>.
|
|
<P>
|
|
|
|
<A NAME="IDX1458"></A>
|
|
<DT><CODE>DIVSI3_LIBCALL</CODE>
|
|
<DD>A C string constant giving the name of the function to call for
|
|
division of one signed full-word by another. If you do not define
|
|
this macro, the default name is used, which is <CODE>__divsi3</CODE>, a
|
|
function defined in <TT>`libgcc.a'</TT>.
|
|
<P>
|
|
|
|
<A NAME="IDX1459"></A>
|
|
<DT><CODE>UDIVSI3_LIBCALL</CODE>
|
|
<DD>A C string constant giving the name of the function to call for
|
|
division of one unsigned full-word by another. If you do not define
|
|
this macro, the default name is used, which is <CODE>__udivsi3</CODE>, a
|
|
function defined in <TT>`libgcc.a'</TT>.
|
|
<P>
|
|
|
|
<A NAME="IDX1460"></A>
|
|
<DT><CODE>MODSI3_LIBCALL</CODE>
|
|
<DD>A C string constant giving the name of the function to call for the
|
|
remainder in division of one signed full-word by another. If you do
|
|
not define this macro, the default name is used, which is
|
|
<CODE>__modsi3</CODE>, a function defined in <TT>`libgcc.a'</TT>.
|
|
<P>
|
|
|
|
<A NAME="IDX1461"></A>
|
|
<DT><CODE>UMODSI3_LIBCALL</CODE>
|
|
<DD>A C string constant giving the name of the function to call for the
|
|
remainder in division of one unsigned full-word by another. If you do
|
|
not define this macro, the default name is used, which is
|
|
<CODE>__umodsi3</CODE>, a function defined in <TT>`libgcc.a'</TT>.
|
|
<P>
|
|
|
|
<A NAME="IDX1462"></A>
|
|
<DT><CODE>MULDI3_LIBCALL</CODE>
|
|
<DD>A C string constant giving the name of the function to call for
|
|
multiplication of one signed double-word by another. If you do not
|
|
define this macro, the default name is used, which is <CODE>__muldi3</CODE>,
|
|
a function defined in <TT>`libgcc.a'</TT>.
|
|
<P>
|
|
|
|
<A NAME="IDX1463"></A>
|
|
<DT><CODE>DIVDI3_LIBCALL</CODE>
|
|
<DD>A C string constant giving the name of the function to call for
|
|
division of one signed double-word by another. If you do not define
|
|
this macro, the default name is used, which is <CODE>__divdi3</CODE>, a
|
|
function defined in <TT>`libgcc.a'</TT>.
|
|
<P>
|
|
|
|
<A NAME="IDX1464"></A>
|
|
<DT><CODE>UDIVDI3_LIBCALL</CODE>
|
|
<DD>A C string constant giving the name of the function to call for
|
|
division of one unsigned full-word by another. If you do not define
|
|
this macro, the default name is used, which is <CODE>__udivdi3</CODE>, a
|
|
function defined in <TT>`libgcc.a'</TT>.
|
|
<P>
|
|
|
|
<A NAME="IDX1465"></A>
|
|
<DT><CODE>MODDI3_LIBCALL</CODE>
|
|
<DD>A C string constant giving the name of the function to call for the
|
|
remainder in division of one signed double-word by another. If you do
|
|
not define this macro, the default name is used, which is
|
|
<CODE>__moddi3</CODE>, a function defined in <TT>`libgcc.a'</TT>.
|
|
<P>
|
|
|
|
<A NAME="IDX1466"></A>
|
|
<DT><CODE>UMODDI3_LIBCALL</CODE>
|
|
<DD>A C string constant giving the name of the function to call for the
|
|
remainder in division of one unsigned full-word by another. If you do
|
|
not define this macro, the default name is used, which is
|
|
<CODE>__umoddi3</CODE>, a function defined in <TT>`libgcc.a'</TT>.
|
|
<P>
|
|
|
|
<A NAME="IDX1467"></A>
|
|
<DT><CODE>INIT_TARGET_OPTABS</CODE>
|
|
<DD>Define this macro as a C statement that declares additional library
|
|
routines renames existing ones. <CODE>init_optabs</CODE> calls this macro after
|
|
initializing all the normal library routines.
|
|
<P>
|
|
|
|
<A NAME="IDX1468"></A>
|
|
<A NAME="IDX1469"></A>
|
|
<DT><CODE>TARGET_EDOM</CODE>
|
|
<DD>The value of <CODE>EDOM</CODE> on the target machine, as a C integer constant
|
|
expression. If you don't define this macro, GNU CC does not attempt to
|
|
deposit the value of <CODE>EDOM</CODE> into <CODE>errno</CODE> directly. Look in
|
|
<TT>`/usr/include/errno.h'</TT> to find the value of <CODE>EDOM</CODE> on your
|
|
system.
|
|
<P>
|
|
|
|
If you do not define <CODE>TARGET_EDOM</CODE>, then compiled code reports
|
|
domain errors by calling the library function and letting it report the
|
|
error. If mathematical functions on your system use <CODE>matherr</CODE> when
|
|
there is an error, then you should leave <CODE>TARGET_EDOM</CODE> undefined so
|
|
that <CODE>matherr</CODE> is used normally.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1470"></A>
|
|
<A NAME="IDX1471"></A>
|
|
<DT><CODE>GEN_ERRNO_RTX</CODE>
|
|
<DD>Define this macro as a C expression to create an rtl expression that
|
|
refers to the global "variable" <CODE>errno</CODE>. (On certain systems,
|
|
<CODE>errno</CODE> may not actually be a variable.) If you don't define this
|
|
macro, a reasonable default is used.
|
|
<P>
|
|
|
|
<A NAME="IDX1472"></A>
|
|
<A NAME="IDX1473"></A>
|
|
<A NAME="IDX1474"></A>
|
|
<A NAME="IDX1475"></A>
|
|
<A NAME="IDX1476"></A>
|
|
<DT><CODE>TARGET_MEM_FUNCTIONS</CODE>
|
|
<DD>Define this macro if GNU CC should generate calls to the System V
|
|
(and ANSI C) library functions <CODE>memcpy</CODE> and <CODE>memset</CODE>
|
|
rather than the BSD functions <CODE>bcopy</CODE> and <CODE>bzero</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX1477"></A>
|
|
<DT><CODE>LIBGCC_NEEDS_DOUBLE</CODE>
|
|
<DD>Define this macro if only <CODE>float</CODE> arguments cannot be passed to
|
|
library routines (so they must be converted to <CODE>double</CODE>). This
|
|
macro affects both how library calls are generated and how the library
|
|
routines in <TT>`libgcc1.c'</TT> accept their arguments. It is useful on
|
|
machines where floating and fixed point arguments are passed
|
|
differently, such as the i860.
|
|
<P>
|
|
|
|
<A NAME="IDX1478"></A>
|
|
<DT><CODE>FLOAT_ARG_TYPE</CODE>
|
|
<DD>Define this macro to override the type used by the library routines to
|
|
pick up arguments of type <CODE>float</CODE>. (By default, they use a union
|
|
of <CODE>float</CODE> and <CODE>int</CODE>.)
|
|
<P>
|
|
|
|
The obvious choice would be <CODE>float</CODE>---but that won't work with
|
|
traditional C compilers that expect all arguments declared as <CODE>float</CODE>
|
|
to arrive as <CODE>double</CODE>. To avoid this conversion, the library routines
|
|
ask for the value as some other type and then treat it as a <CODE>float</CODE>.
|
|
</P><P>
|
|
|
|
On some systems, no other type will work for this. For these systems,
|
|
you must use <CODE>LIBGCC_NEEDS_DOUBLE</CODE> instead, to force conversion of
|
|
the values <CODE>double</CODE> before they are passed.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1479"></A>
|
|
<DT><CODE>FLOATIFY (<VAR>passed-value</VAR>)</CODE>
|
|
<DD>Define this macro to override the way library routines redesignate a
|
|
<CODE>float</CODE> argument as a <CODE>float</CODE> instead of the type it was
|
|
passed as. The default is an expression which takes the <CODE>float</CODE>
|
|
field of the union.
|
|
<P>
|
|
|
|
<A NAME="IDX1480"></A>
|
|
<DT><CODE>FLOAT_VALUE_TYPE</CODE>
|
|
<DD>Define this macro to override the type used by the library routines to
|
|
return values that ought to have type <CODE>float</CODE>. (By default, they
|
|
use <CODE>int</CODE>.)
|
|
<P>
|
|
|
|
The obvious choice would be <CODE>float</CODE>---but that won't work with
|
|
traditional C compilers gratuitously convert values declared as
|
|
<CODE>float</CODE> into <CODE>double</CODE>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1481"></A>
|
|
<DT><CODE>INTIFY (<VAR>float-value</VAR>)</CODE>
|
|
<DD>Define this macro to override the way the value of a
|
|
<CODE>float</CODE>-returning library routine should be packaged in order to
|
|
return it. These functions are actually declared to return type
|
|
<CODE>FLOAT_VALUE_TYPE</CODE> (normally <CODE>int</CODE>).
|
|
<P>
|
|
|
|
These values can't be returned as type <CODE>float</CODE> because traditional
|
|
C compilers would gratuitously convert the value to a <CODE>double</CODE>.
|
|
</P><P>
|
|
|
|
A local variable named <CODE>intify</CODE> is always available when the macro
|
|
<CODE>INTIFY</CODE> is used. It is a union of a <CODE>float</CODE> field named
|
|
<CODE>f</CODE> and a field named <CODE>i</CODE> whose type is
|
|
<CODE>FLOAT_VALUE_TYPE</CODE> or <CODE>int</CODE>.
|
|
</P><P>
|
|
|
|
If you don't define this macro, the default definition works by copying
|
|
the value through that union.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1482"></A>
|
|
<DT><CODE>nongcc_SI_type</CODE>
|
|
<DD>Define this macro as the name of the data type corresponding to
|
|
<CODE>SImode</CODE> in the system's own C compiler.
|
|
<P>
|
|
|
|
You need not define this macro if that type is <CODE>long int</CODE>, as it usually
|
|
is.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1483"></A>
|
|
<DT><CODE>nongcc_word_type</CODE>
|
|
<DD>Define this macro as the name of the data type corresponding to the
|
|
word_mode in the system's own C compiler.
|
|
<P>
|
|
|
|
You need not define this macro if that type is <CODE>long int</CODE>, as it usually
|
|
is.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1484"></A>
|
|
<DT><CODE>perform_<small>...</small></CODE>
|
|
<DD>Define these macros to supply explicit C statements to carry out various
|
|
arithmetic operations on types <CODE>float</CODE> and <CODE>double</CODE> in the
|
|
library routines in <TT>`libgcc1.c'</TT>. See that file for a full list
|
|
of these macros and their arguments.
|
|
<P>
|
|
|
|
On most machines, you don't need to define any of these macros, because
|
|
the C compiler that comes with the system takes care of doing them.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1485"></A>
|
|
<DT><CODE>NEXT_OBJC_RUNTIME</CODE>
|
|
<DD>Define this macro to generate code for Objective C message sending using
|
|
the calling convention of the NeXT system. This calling convention
|
|
involves passing the object, the selector and the method arguments all
|
|
at once to the method-lookup library function.
|
|
<P>
|
|
|
|
The default calling convention passes just the object and the selector
|
|
to the lookup function, which returns a pointer to the method.
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="Addressing Modes"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC227"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC226" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC226"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC228" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC228"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC201" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC201"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC199" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC199"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_18.html#SEC251" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_18.html#SEC251"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H2> 17.11 Addressing Modes </H2>
|
|
<!--docid::SEC227::-->
|
|
<P>
|
|
|
|
This is about addressing modes.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1486"></A>
|
|
<DT><CODE>HAVE_POST_INCREMENT</CODE>
|
|
<DD>A C expression that is nonzero the machine supports post-increment addressing.
|
|
<P>
|
|
|
|
<A NAME="IDX1487"></A>
|
|
<A NAME="IDX1488"></A>
|
|
<A NAME="IDX1489"></A>
|
|
<DT><CODE>HAVE_PRE_INCREMENT</CODE>
|
|
<DD><DT><CODE>HAVE_POST_DECREMENT</CODE>
|
|
<DD><DT><CODE>HAVE_PRE_DECREMENT</CODE>
|
|
<DD>Similar for other kinds of addressing.
|
|
<P>
|
|
|
|
<A NAME="IDX1490"></A>
|
|
<DT><CODE>CONSTANT_ADDRESS_P (<VAR>x</VAR>)</CODE>
|
|
<DD>A C expression that is 1 if the RTX <VAR>x</VAR> is a constant which
|
|
is a valid address. On most machines, this can be defined as
|
|
<CODE>CONSTANT_P (<VAR>x</VAR>)</CODE>, but a few machines are more restrictive
|
|
in which constant addresses are supported.
|
|
<P>
|
|
|
|
<A NAME="IDX1491"></A>
|
|
<CODE>CONSTANT_P</CODE> accepts integer-values expressions whose values are
|
|
not explicitly known, such as <CODE>symbol_ref</CODE>, <CODE>label_ref</CODE>, and
|
|
<CODE>high</CODE> expressions and <CODE>const</CODE> arithmetic expressions, in
|
|
addition to <CODE>const_int</CODE> and <CODE>const_double</CODE> expressions.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1492"></A>
|
|
<DT><CODE>MAX_REGS_PER_ADDRESS</CODE>
|
|
<DD>A number, the maximum number of registers that can appear in a valid
|
|
memory address. Note that it is up to you to specify a value equal to
|
|
the maximum number that <CODE>GO_IF_LEGITIMATE_ADDRESS</CODE> would ever
|
|
accept.
|
|
<P>
|
|
|
|
<A NAME="IDX1493"></A>
|
|
<DT><CODE>GO_IF_LEGITIMATE_ADDRESS (<VAR>mode</VAR>, <VAR>x</VAR>, <VAR>label</VAR>)</CODE>
|
|
<DD>A C compound statement with a conditional <CODE>goto <VAR>label</VAR>;</CODE>
|
|
executed if <VAR>x</VAR> (an RTX) is a legitimate memory address on the
|
|
target machine for a memory operand of mode <VAR>mode</VAR>.
|
|
<P>
|
|
|
|
It usually pays to define several simpler macros to serve as
|
|
subroutines for this one. Otherwise it may be too complicated to
|
|
understand.
|
|
</P><P>
|
|
|
|
This macro must exist in two variants: a strict variant and a
|
|
non-strict one. The strict variant is used in the reload pass. It
|
|
must be defined so that any pseudo-register that has not been
|
|
allocated a hard register is considered a memory reference. In
|
|
contexts where some kind of register is required, a pseudo-register
|
|
with no hard register must be rejected.
|
|
</P><P>
|
|
|
|
The non-strict variant is used in other passes. It must be defined to
|
|
accept all pseudo-registers in every context where some kind of
|
|
register is required.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1494"></A>
|
|
Compiler source files that want to use the strict variant of this
|
|
macro define the macro <CODE>REG_OK_STRICT</CODE>. You should use an
|
|
<CODE>#ifdef REG_OK_STRICT</CODE> conditional to define the strict variant
|
|
in that case and the non-strict variant otherwise.
|
|
</P><P>
|
|
|
|
Subroutines to check for acceptable registers for various purposes (one
|
|
for base registers, one for index registers, and so on) are typically
|
|
among the subroutines used to define <CODE>GO_IF_LEGITIMATE_ADDRESS</CODE>.
|
|
Then only these subroutine macros need have two variants; the higher
|
|
levels of macros may be the same whether strict or not.</P><P>
|
|
|
|
Normally, constant addresses which are the sum of a <CODE>symbol_ref</CODE>
|
|
and an integer are stored inside a <CODE>const</CODE> RTX to mark them as
|
|
constant. Therefore, there is no need to recognize such sums
|
|
specifically as legitimate addresses. Normally you would simply
|
|
recognize any <CODE>const</CODE> as legitimate.
|
|
</P><P>
|
|
|
|
Usually <CODE>PRINT_OPERAND_ADDRESS</CODE> is not prepared to handle constant
|
|
sums that are not marked with <CODE>const</CODE>. It assumes that a naked
|
|
<CODE>plus</CODE> indicates indexing. If so, then you <EM>must</EM> reject such
|
|
naked constant sums as illegitimate addresses, so that none of them will
|
|
be given to <CODE>PRINT_OPERAND_ADDRESS</CODE>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1495"></A>
|
|
On some machines, whether a symbolic address is legitimate depends on
|
|
the section that the address refers to. On these machines, define the
|
|
macro <CODE>ENCODE_SECTION_INFO</CODE> to store the information into the
|
|
<CODE>symbol_ref</CODE>, and then check for it here. When you see a
|
|
<CODE>const</CODE>, you will have to look inside it to find the
|
|
<CODE>symbol_ref</CODE> in order to determine the section. See section <A HREF="gcc_17.html#SEC232" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC232">17.16 Defining the Output Assembler Language</A>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1496"></A>
|
|
The best way to modify the name string is by adding text to the
|
|
beginning, with suitable punctuation to prevent any ambiguity. Allocate
|
|
the new name in <CODE>saveable_obstack</CODE>. You will have to modify
|
|
<CODE>ASM_OUTPUT_LABELREF</CODE> to remove and decode the added text and
|
|
output the name accordingly, and define <CODE>STRIP_NAME_ENCODING</CODE> to
|
|
access the original name string.
|
|
</P><P>
|
|
|
|
You can check the information stored here into the <CODE>symbol_ref</CODE> in
|
|
the definitions of the macros <CODE>GO_IF_LEGITIMATE_ADDRESS</CODE> and
|
|
<CODE>PRINT_OPERAND_ADDRESS</CODE>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1497"></A>
|
|
<DT><CODE>REG_OK_FOR_BASE_P (<VAR>x</VAR>)</CODE>
|
|
<DD>A C expression that is nonzero if <VAR>x</VAR> (assumed to be a <CODE>reg</CODE>
|
|
RTX) is valid for use as a base register. For hard registers, it
|
|
should always accept those which the hardware permits and reject the
|
|
others. Whether the macro accepts or rejects pseudo registers must be
|
|
controlled by <CODE>REG_OK_STRICT</CODE> as described above. This usually
|
|
requires two variant definitions, of which <CODE>REG_OK_STRICT</CODE>
|
|
controls the one actually used.
|
|
<P>
|
|
|
|
<A NAME="IDX1498"></A>
|
|
<DT><CODE>REG_MODE_OK_FOR_BASE_P (<VAR>x</VAR>, <VAR>mode</VAR>)</CODE>
|
|
<DD>A C expression that is just like <CODE>REG_OK_FOR_BASE_P</CODE>, except that
|
|
that expression may examine the mode of the memory reference in
|
|
<VAR>mode</VAR>. You should define this macro if the mode of the memory
|
|
reference affects whether a register may be used as a base register. If
|
|
you define this macro, the compiler will use it instead of
|
|
<CODE>REG_OK_FOR_BASE_P</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX1499"></A>
|
|
<DT><CODE>REG_OK_FOR_INDEX_P (<VAR>x</VAR>)</CODE>
|
|
<DD>A C expression that is nonzero if <VAR>x</VAR> (assumed to be a <CODE>reg</CODE>
|
|
RTX) is valid for use as an index register.
|
|
<P>
|
|
|
|
The difference between an index register and a base register is that
|
|
the index register may be scaled. If an address involves the sum of
|
|
two registers, neither one of them scaled, then either one may be
|
|
labeled the "base" and the other the "index"; but whichever
|
|
labeling is used must fit the machine's constraints of which registers
|
|
may serve in each capacity. The compiler will try both labelings,
|
|
looking for one that is valid, and will reload one or both registers
|
|
only if neither labeling works.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1500"></A>
|
|
<DT><CODE>LEGITIMIZE_ADDRESS (<VAR>x</VAR>, <VAR>oldx</VAR>, <VAR>mode</VAR>, <VAR>win</VAR>)</CODE>
|
|
<DD>A C compound statement that attempts to replace <VAR>x</VAR> with a valid
|
|
memory address for an operand of mode <VAR>mode</VAR>. <VAR>win</VAR> will be a
|
|
C statement label elsewhere in the code; the macro definition may use
|
|
<P>
|
|
|
|
<TABLE><tr><td> </td><td class=example><pre>GO_IF_LEGITIMATE_ADDRESS (<VAR>mode</VAR>, <VAR>x</VAR>, <VAR>win</VAR>);
|
|
</pre></td></tr></table></P><P>
|
|
|
|
to avoid further processing if the address has become legitimate.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1501"></A>
|
|
<VAR>x</VAR> will always be the result of a call to <CODE>break_out_memory_refs</CODE>,
|
|
and <VAR>oldx</VAR> will be the operand that was given to that function to produce
|
|
<VAR>x</VAR>.
|
|
</P><P>
|
|
|
|
The code generated by this macro should not alter the substructure of
|
|
<VAR>x</VAR>. If it transforms <VAR>x</VAR> into a more legitimate form, it
|
|
should assign <VAR>x</VAR> (which will always be a C variable) a new value.
|
|
</P><P>
|
|
|
|
It is not necessary for this macro to come up with a legitimate
|
|
address. The compiler has standard ways of doing so in all cases. In
|
|
fact, it is safe for this macro to do nothing. But often a
|
|
machine-dependent strategy can generate better code.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1502"></A>
|
|
<DT><CODE>LEGITIMIZE_RELOAD_ADDRESS (<VAR>x</VAR>, <VAR>mode</VAR>, <VAR>opnum</VAR>, <VAR>type</VAR>, <VAR>ind_levels</VAR>, <VAR>win</VAR>)</CODE>
|
|
<DD>A C compound statement that attempts to replace <VAR>x</VAR>, which is an address
|
|
that needs reloading, with a valid memory address for an operand of mode
|
|
<VAR>mode</VAR>. <VAR>win</VAR> will be a C statement label elsewhere in the code.
|
|
It is not necessary to define this macro, but it might be useful for
|
|
performance reasons.
|
|
<P>
|
|
|
|
For example, on the i386, it is sometimes possible to use a single
|
|
reload register instead of two by reloading a sum of two pseudo
|
|
registers into a register. On the other hand, for number of RISC
|
|
processors offsets are limited so that often an intermediate address
|
|
needs to be generated in order to address a stack slot. By defining
|
|
LEGITIMIZE_RELOAD_ADDRESS appropriately, the intermediate addresses
|
|
generated for adjacent some stack slots can be made identical, and thus
|
|
be shared.
|
|
</P><P>
|
|
|
|
<EM>Note</EM>: This macro should be used with caution. It is necessary
|
|
to know something of how reload works in order to effectively use this,
|
|
and it is quite easy to produce macros that build in too much knowledge
|
|
of reload internals.
|
|
</P><P>
|
|
|
|
<EM>Note</EM>: This macro must be able to reload an address created by a
|
|
previous invocation of this macro. If it fails to handle such addresses
|
|
then the compiler may generate incorrect code or abort.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1503"></A>
|
|
The macro definition should use <CODE>push_reload</CODE> to indicate parts that
|
|
need reloading; <VAR>opnum</VAR>, <VAR>type</VAR> and <VAR>ind_levels</VAR> are usually
|
|
suitable to be passed unaltered to <CODE>push_reload</CODE>.
|
|
</P><P>
|
|
|
|
The code generated by this macro must not alter the substructure of
|
|
<VAR>x</VAR>. If it transforms <VAR>x</VAR> into a more legitimate form, it
|
|
should assign <VAR>x</VAR> (which will always be a C variable) a new value.
|
|
This also applies to parts that you change indirectly by calling
|
|
<CODE>push_reload</CODE>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1504"></A>
|
|
The macro definition may use <CODE>strict_memory_address_p</CODE> to test if
|
|
the address has become legitimate.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1505"></A>
|
|
If you want to change only a part of <VAR>x</VAR>, one standard way of doing
|
|
this is to use <CODE>copy_rtx</CODE>. Note, however, that is unshares only a
|
|
single level of rtl. Thus, if the part to be changed is not at the
|
|
top level, you'll need to replace first the top leve
|
|
It is not necessary for this macro to come up with a legitimate
|
|
address; but often a machine-dependent strategy can generate better code.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1506"></A>
|
|
<DT><CODE>GO_IF_MODE_DEPENDENT_ADDRESS (<VAR>addr</VAR>, <VAR>label</VAR>)</CODE>
|
|
<DD>A C statement or compound statement with a conditional <CODE>goto
|
|
<VAR>label</VAR>;</CODE> executed if memory address <VAR>x</VAR> (an RTX) can have
|
|
different meanings depending on the machine mode of the memory
|
|
reference it is used for or if the address is valid for some modes
|
|
but not others.
|
|
<P>
|
|
|
|
Autoincrement and autodecrement addresses typically have mode-dependent
|
|
effects because the amount of the increment or decrement is the size
|
|
of the operand being addressed. Some machines have other mode-dependent
|
|
addresses. Many RISC machines have no mode-dependent addresses.
|
|
</P><P>
|
|
|
|
You may assume that <VAR>addr</VAR> is a valid address for the machine.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1507"></A>
|
|
<DT><CODE>LEGITIMATE_CONSTANT_P (<VAR>x</VAR>)</CODE>
|
|
<DD>A C expression that is nonzero if <VAR>x</VAR> is a legitimate constant for
|
|
an immediate operand on the target machine. You can assume that
|
|
<VAR>x</VAR> satisfies <CODE>CONSTANT_P</CODE>, so you need not check this. In fact,
|
|
<SAMP>`1'</SAMP> is a suitable definition for this macro on machines where
|
|
anything <CODE>CONSTANT_P</CODE> is valid.</DL>
|
|
<P>
|
|
|
|
<A NAME="Condition Code"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC228"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC227" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC227"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC229" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC229"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC201" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC201"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC199" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC199"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_18.html#SEC251" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_18.html#SEC251"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H2> 17.12 Condition Code Status </H2>
|
|
<!--docid::SEC228::-->
|
|
<P>
|
|
|
|
This describes the condition code status.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1508"></A>
|
|
The file <TT>`conditions.h'</TT> defines a variable <CODE>cc_status</CODE> to
|
|
describe how the condition code was computed (in case the interpretation of
|
|
the condition code depends on the instruction that it was set by). This
|
|
variable contains the RTL expressions on which the condition code is
|
|
currently based, and several standard flags.
|
|
</P><P>
|
|
|
|
Sometimes additional machine-specific flags must be defined in the machine
|
|
description header file. It can also add additional machine-specific
|
|
information by defining <CODE>CC_STATUS_MDEP</CODE>.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1509"></A>
|
|
<DT><CODE>CC_STATUS_MDEP</CODE>
|
|
<DD>C code for a data type which is used for declaring the <CODE>mdep</CODE>
|
|
component of <CODE>cc_status</CODE>. It defaults to <CODE>int</CODE>.
|
|
<P>
|
|
|
|
This macro is not used on machines that do not use <CODE>cc0</CODE>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1510"></A>
|
|
<DT><CODE>CC_STATUS_MDEP_INIT</CODE>
|
|
<DD>A C expression to initialize the <CODE>mdep</CODE> field to "empty".
|
|
The default definition does nothing, since most machines don't use
|
|
the field anyway. If you want to use the field, you should probably
|
|
define this macro to initialize it.
|
|
<P>
|
|
|
|
This macro is not used on machines that do not use <CODE>cc0</CODE>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1511"></A>
|
|
<DT><CODE>NOTICE_UPDATE_CC (<VAR>exp</VAR>, <VAR>insn</VAR>)</CODE>
|
|
<DD>A C compound statement to set the components of <CODE>cc_status</CODE>
|
|
appropriately for an insn <VAR>insn</VAR> whose body is <VAR>exp</VAR>. It is
|
|
this macro's responsibility to recognize insns that set the condition
|
|
code as a byproduct of other activity as well as those that explicitly
|
|
set <CODE>(cc0)</CODE>.
|
|
<P>
|
|
|
|
This macro is not used on machines that do not use <CODE>cc0</CODE>.
|
|
</P><P>
|
|
|
|
If there are insns that do not set the condition code but do alter
|
|
other machine registers, this macro must check to see whether they
|
|
invalidate the expressions that the condition code is recorded as
|
|
reflecting. For example, on the 68000, insns that store in address
|
|
registers do not set the condition code, which means that usually
|
|
<CODE>NOTICE_UPDATE_CC</CODE> can leave <CODE>cc_status</CODE> unaltered for such
|
|
insns. But suppose that the previous insn set the condition code
|
|
based on location <SAMP>`a4@(102)'</SAMP> and the current insn stores a new
|
|
value in <SAMP>`a4'</SAMP>. Although the condition code is not changed by
|
|
this, it will no longer be true that it reflects the contents of
|
|
<SAMP>`a4@(102)'</SAMP>. Therefore, <CODE>NOTICE_UPDATE_CC</CODE> must alter
|
|
<CODE>cc_status</CODE> in this case to say that nothing is known about the
|
|
condition code value.
|
|
</P><P>
|
|
|
|
The definition of <CODE>NOTICE_UPDATE_CC</CODE> must be prepared to deal
|
|
with the results of peephole optimization: insns whose patterns are
|
|
<CODE>parallel</CODE> RTXs containing various <CODE>reg</CODE>, <CODE>mem</CODE> or
|
|
constants which are just the operands. The RTL structure of these
|
|
insns is not sufficient to indicate what the insns actually do. What
|
|
<CODE>NOTICE_UPDATE_CC</CODE> should do when it sees one is just to run
|
|
<CODE>CC_STATUS_INIT</CODE>.
|
|
</P><P>
|
|
|
|
A possible definition of <CODE>NOTICE_UPDATE_CC</CODE> is to call a function
|
|
that looks at an attribute (see section <A HREF="gcc_16.html#SEC190" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_16.html#SEC190">16.15 Instruction Attributes</A>) named, for example,
|
|
<SAMP>`cc'</SAMP>. This avoids having detailed information about patterns in
|
|
two places, the <TT>`md'</TT> file and in <CODE>NOTICE_UPDATE_CC</CODE>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1512"></A>
|
|
<DT><CODE>EXTRA_CC_MODES</CODE>
|
|
<DD>A list of names to be used for additional modes for condition code
|
|
values in registers (see section <A HREF="gcc_16.html#SEC185" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_16.html#SEC185">16.10 Defining Jump Instruction Patterns</A>). These names are added
|
|
to <CODE>enum machine_mode</CODE> and all have class <CODE>MODE_CC</CODE>. By
|
|
convention, they should start with <SAMP>`CC'</SAMP> and end with <SAMP>`mode'</SAMP>.
|
|
<P>
|
|
|
|
You should only define this macro if your machine does not use <CODE>cc0</CODE>
|
|
and only if additional modes are required.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1513"></A>
|
|
<DT><CODE>EXTRA_CC_NAMES</CODE>
|
|
<DD>A list of C strings giving the names for the modes listed in
|
|
<CODE>EXTRA_CC_MODES</CODE>. For example, the Sparc defines this macro and
|
|
<CODE>EXTRA_CC_MODES</CODE> as
|
|
<P>
|
|
|
|
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>#define EXTRA_CC_MODES CC_NOOVmode, CCFPmode, CCFPEmode
|
|
#define EXTRA_CC_NAMES "CC_NOOV", "CCFP", "CCFPE"
|
|
</FONT></pre></td></tr></table></P><P>
|
|
|
|
This macro is not required if <CODE>EXTRA_CC_MODES</CODE> is not defined.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1514"></A>
|
|
<DT><CODE>SELECT_CC_MODE (<VAR>op</VAR>, <VAR>x</VAR>, <VAR>y</VAR>)</CODE>
|
|
<DD>Returns a mode from class <CODE>MODE_CC</CODE> to be used when comparison
|
|
operation code <VAR>op</VAR> is applied to rtx <VAR>x</VAR> and <VAR>y</VAR>. For
|
|
example, on the Sparc, <CODE>SELECT_CC_MODE</CODE> is defined as (see
|
|
see section <A HREF="gcc_16.html#SEC185" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_16.html#SEC185">16.10 Defining Jump Instruction Patterns</A> for a description of the reason for this
|
|
definition)
|
|
<P>
|
|
|
|
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>#define SELECT_CC_MODE(OP,X,Y) \
|
|
(GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
|
|
? ((OP == EQ || OP == NE) ? CCFPmode : CCFPEmode) \
|
|
: ((GET_CODE (X) == PLUS || GET_CODE (X) == MINUS \
|
|
|| GET_CODE (X) == NEG) \
|
|
? CC_NOOVmode : CCmode))
|
|
</FONT></pre></td></tr></table></P><P>
|
|
|
|
You need not define this macro if <CODE>EXTRA_CC_MODES</CODE> is not defined.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1515"></A>
|
|
<DT><CODE>CANONICALIZE_COMPARISON (<VAR>code</VAR>, <VAR>op0</VAR>, <VAR>op1</VAR>)</CODE>
|
|
<DD>One some machines not all possible comparisons are defined, but you can
|
|
convert an invalid comparison into a valid one. For example, the Alpha
|
|
does not have a <CODE>GT</CODE> comparison, but you can use an <CODE>LT</CODE>
|
|
comparison instead and swap the order of the operands.
|
|
<P>
|
|
|
|
On such machines, define this macro to be a C statement to do any
|
|
required conversions. <VAR>code</VAR> is the initial comparison code
|
|
and <VAR>op0</VAR> and <VAR>op1</VAR> are the left and right operands of the
|
|
comparison, respectively. You should modify <VAR>code</VAR>, <VAR>op0</VAR>, and
|
|
<VAR>op1</VAR> as required.
|
|
</P><P>
|
|
|
|
GNU CC will not assume that the comparison resulting from this macro is
|
|
valid but will see if the resulting insn matches a pattern in the
|
|
<TT>`md'</TT> file.
|
|
</P><P>
|
|
|
|
You need not define this macro if it would never change the comparison
|
|
code or operands.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1516"></A>
|
|
<DT><CODE>REVERSIBLE_CC_MODE (<VAR>mode</VAR>)</CODE>
|
|
<DD>A C expression whose value is one if it is always safe to reverse a
|
|
comparison whose mode is <VAR>mode</VAR>. If <CODE>SELECT_CC_MODE</CODE>
|
|
can ever return <VAR>mode</VAR> for a floating-point inequality comparison,
|
|
then <CODE>REVERSIBLE_CC_MODE (<VAR>mode</VAR>)</CODE> must be zero.
|
|
<P>
|
|
|
|
You need not define this macro if it would always returns zero or if the
|
|
floating-point format is anything other than <CODE>IEEE_FLOAT_FORMAT</CODE>.
|
|
For example, here is the definition used on the Sparc, where floating-point
|
|
inequality comparisons are always given <CODE>CCFPEmode</CODE>:
|
|
</P><P>
|
|
|
|
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>#define REVERSIBLE_CC_MODE(MODE) ((MODE) != CCFPEmode)
|
|
</FONT></pre></td></tr></table></P><P>
|
|
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="Costs"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC229"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC228" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC228"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC230" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC230"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC201" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC201"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC199" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC199"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_18.html#SEC251" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_18.html#SEC251"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H2> 17.13 Describing Relative Costs of Operations </H2>
|
|
<!--docid::SEC229::-->
|
|
<P>
|
|
|
|
These macros let you describe the relative speed of various operations
|
|
on the target machine.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1517"></A>
|
|
<DT><CODE>CONST_COSTS (<VAR>x</VAR>, <VAR>code</VAR>, <VAR>outer_code</VAR>)</CODE>
|
|
<DD>A part of a C <CODE>switch</CODE> statement that describes the relative costs
|
|
of constant RTL expressions. It must contain <CODE>case</CODE> labels for
|
|
expression codes <CODE>const_int</CODE>, <CODE>const</CODE>, <CODE>symbol_ref</CODE>,
|
|
<CODE>label_ref</CODE> and <CODE>const_double</CODE>. Each case must ultimately
|
|
reach a <CODE>return</CODE> statement to return the relative cost of the use
|
|
of that kind of constant value in an expression. The cost may depend on
|
|
the precise value of the constant, which is available for examination in
|
|
<VAR>x</VAR>, and the rtx code of the expression in which it is contained,
|
|
found in <VAR>outer_code</VAR>.
|
|
<P>
|
|
|
|
<VAR>code</VAR> is the expression code--redundant, since it can be
|
|
obtained with <CODE>GET_CODE (<VAR>x</VAR>)</CODE>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1518"></A>
|
|
<A NAME="IDX1519"></A>
|
|
<DT><CODE>RTX_COSTS (<VAR>x</VAR>, <VAR>code</VAR>, <VAR>outer_code</VAR>)</CODE>
|
|
<DD>Like <CODE>CONST_COSTS</CODE> but applies to nonconstant RTL expressions.
|
|
This can be used, for example, to indicate how costly a multiply
|
|
instruction is. In writing this macro, you can use the construct
|
|
<CODE>COSTS_N_INSNS (<VAR>n</VAR>)</CODE> to specify a cost equal to <VAR>n</VAR> fast
|
|
instructions. <VAR>outer_code</VAR> is the code of the expression in which
|
|
<VAR>x</VAR> is contained.
|
|
<P>
|
|
|
|
This macro is optional; do not define it if the default cost assumptions
|
|
are adequate for the target machine.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1520"></A>
|
|
<DT><CODE>DEFAULT_RTX_COSTS (<VAR>x</VAR>, <VAR>code</VAR>, <VAR>outer_code</VAR>)</CODE>
|
|
<DD>This macro, if defined, is called for any case not handled by the
|
|
<CODE>RTX_COSTS</CODE> or <CODE>CONST_COSTS</CODE> macros. This eliminates the need
|
|
to put case labels into the macro, but the code, or any functions it
|
|
calls, must assume that the RTL in <VAR>x</VAR> could be of any type that has
|
|
not already been handled. The arguments are the same as for
|
|
<CODE>RTX_COSTS</CODE>, and the macro should execute a return statement giving
|
|
the cost of any RTL expressions that it can handle. The default cost
|
|
calculation is used for any RTL for which this macro does not return a
|
|
value.
|
|
<P>
|
|
|
|
This macro is optional; do not define it if the default cost assumptions
|
|
are adequate for the target machine.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1521"></A>
|
|
<DT><CODE>ADDRESS_COST (<VAR>address</VAR>)</CODE>
|
|
<DD>An expression giving the cost of an addressing mode that contains
|
|
<VAR>address</VAR>. If not defined, the cost is computed from
|
|
the <VAR>address</VAR> expression and the <CODE>CONST_COSTS</CODE> values.
|
|
<P>
|
|
|
|
For most CISC machines, the default cost is a good approximation of the
|
|
true cost of the addressing mode. However, on RISC machines, all
|
|
instructions normally have the same length and execution time. Hence
|
|
all addresses will have equal costs.
|
|
</P><P>
|
|
|
|
In cases where more than one form of an address is known, the form with
|
|
the lowest cost will be used. If multiple forms have the same, lowest,
|
|
cost, the one that is the most complex will be used.
|
|
</P><P>
|
|
|
|
For example, suppose an address that is equal to the sum of a register
|
|
and a constant is used twice in the same basic block. When this macro
|
|
is not defined, the address will be computed in a register and memory
|
|
references will be indirect through that register. On machines where
|
|
the cost of the addressing mode containing the sum is no higher than
|
|
that of a simple indirect reference, this will produce an additional
|
|
instruction and possibly require an additional register. Proper
|
|
specification of this macro eliminates this overhead for such machines.
|
|
</P><P>
|
|
|
|
Similar use of this macro is made in strength reduction of loops.
|
|
</P><P>
|
|
|
|
<VAR>address</VAR> need not be valid as an address. In such a case, the cost
|
|
is not relevant and can be any value; invalid addresses need not be
|
|
assigned a different cost.
|
|
</P><P>
|
|
|
|
On machines where an address involving more than one register is as
|
|
cheap as an address computation involving only one register, defining
|
|
<CODE>ADDRESS_COST</CODE> to reflect this can cause two registers to be live
|
|
over a region of code where only one would have been if
|
|
<CODE>ADDRESS_COST</CODE> were not defined in that manner. This effect should
|
|
be considered in the definition of this macro. Equivalent costs should
|
|
probably only be given to addresses with different numbers of registers
|
|
on machines with lots of registers.
|
|
</P><P>
|
|
|
|
This macro will normally either not be defined or be defined as a
|
|
constant.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1522"></A>
|
|
<DT><CODE>REGISTER_MOVE_COST (<VAR>from</VAR>, <VAR>to</VAR>)</CODE>
|
|
<DD>A C expression for the cost of moving data from a register in class
|
|
<VAR>from</VAR> to one in class <VAR>to</VAR>. The classes are expressed using
|
|
the enumeration values such as <CODE>GENERAL_REGS</CODE>. A value of 2 is the
|
|
default; other values are interpreted relative to that.
|
|
<P>
|
|
|
|
It is not required that the cost always equal 2 when <VAR>from</VAR> is the
|
|
same as <VAR>to</VAR>; on some machines it is expensive to move between
|
|
registers if they are not general registers.
|
|
</P><P>
|
|
|
|
If reload sees an insn consisting of a single <CODE>set</CODE> between two
|
|
hard registers, and if <CODE>REGISTER_MOVE_COST</CODE> applied to their
|
|
classes returns a value of 2, reload does not check to ensure that the
|
|
constraints of the insn are met. Setting a cost of other than 2 will
|
|
allow reload to verify that the constraints are met. You should do this
|
|
if the <SAMP>`mov<VAR>m</VAR>'</SAMP> pattern's constraints do not allow such copying.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1523"></A>
|
|
<DT><CODE>MEMORY_MOVE_COST (<VAR>mode</VAR>, <VAR>class</VAR>, <VAR>in</VAR>)</CODE>
|
|
<DD>A C expression for the cost of moving data of mode <VAR>mode</VAR> between a
|
|
register of class <VAR>class</VAR> and memory; <VAR>in</VAR> is zero if the value
|
|
is to be written to memory, non-zero if it is to be read in. This cost
|
|
is relative to those in <CODE>REGISTER_MOVE_COST</CODE>. If moving between
|
|
registers and memory is more expensive than between two registers, you
|
|
should define this macro to express the relative cost.
|
|
<P>
|
|
|
|
If you do not define this macro, GNU CC uses a default cost of 4 plus
|
|
the cost of copying via a secondary reload register, if one is
|
|
needed. If your machine requires a secondary reload register to copy
|
|
between memory and a register of <VAR>class</VAR> but the reload mechanism is
|
|
more complex than copying via an intermediate, define this macro to
|
|
reflect the actual cost of the move.
|
|
</P><P>
|
|
|
|
GNU CC defines the function <CODE>memory_move_secondary_cost</CODE> if
|
|
secondary reloads are needed. It computes the costs due to copying via
|
|
a secondary register. If your machine copies from memory using a
|
|
secondary register in the conventional way but the default base value of
|
|
4 is not correct for your machine, define this macro to add some other
|
|
value to the result of that function. The arguments to that function
|
|
are the same as to this macro.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1524"></A>
|
|
<DT><CODE>BRANCH_COST</CODE>
|
|
<DD>A C expression for the cost of a branch instruction. A value of 1 is
|
|
the default; other values are interpreted relative to that.
|
|
</DL>
|
|
<P>
|
|
|
|
Here are additional macros which do not specify precise relative costs,
|
|
but only that certain actions are more expensive than GNU CC would
|
|
ordinarily expect.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1525"></A>
|
|
<DT><CODE>SLOW_BYTE_ACCESS</CODE>
|
|
<DD>Define this macro as a C expression which is nonzero if accessing less
|
|
than a word of memory (i.e. a <CODE>char</CODE> or a <CODE>short</CODE>) is no
|
|
faster than accessing a word of memory, i.e., if such access
|
|
require more than one instruction or if there is no difference in cost
|
|
between byte and (aligned) word loads.
|
|
<P>
|
|
|
|
When this macro is not defined, the compiler will access a field by
|
|
finding the smallest containing object; when it is defined, a fullword
|
|
load will be used if alignment permits. Unless bytes accesses are
|
|
faster than word accesses, using word accesses is preferable since it
|
|
may eliminate subsequent memory access if subsequent accesses occur to
|
|
other fields in the same word of the structure, but to different bytes.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1526"></A>
|
|
<DT><CODE>SLOW_ZERO_EXTEND</CODE>
|
|
<DD>Define this macro if zero-extension (of a <CODE>char</CODE> or <CODE>short</CODE>
|
|
to an <CODE>int</CODE>) can be done faster if the destination is a register
|
|
that is known to be zero.
|
|
<P>
|
|
|
|
If you define this macro, you must have instruction patterns that
|
|
recognize RTL structures like this:
|
|
</P><P>
|
|
|
|
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(set (strict_low_part (subreg:QI (reg:SI <small>...</small>) 0)) <small>...</small>)
|
|
</FONT></pre></td></tr></table></P><P>
|
|
|
|
and likewise for <CODE>HImode</CODE>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1527"></A>
|
|
<DT><CODE>SLOW_UNALIGNED_ACCESS</CODE>
|
|
<DD>Define this macro to be the value 1 if unaligned accesses have a cost
|
|
many times greater than aligned accesses, for example if they are
|
|
emulated in a trap handler.
|
|
<P>
|
|
|
|
When this macro is non-zero, the compiler will act as if
|
|
<CODE>STRICT_ALIGNMENT</CODE> were non-zero when generating code for block
|
|
moves. This can cause significantly more instructions to be produced.
|
|
Therefore, do not set this macro non-zero if unaligned accesses only add a
|
|
cycle or two to the time for a memory access.
|
|
</P><P>
|
|
|
|
If the value of this macro is always zero, it need not be defined.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1528"></A>
|
|
<DT><CODE>DONT_REDUCE_ADDR</CODE>
|
|
<DD>Define this macro to inhibit strength reduction of memory addresses.
|
|
(On some machines, such strength reduction seems to do harm rather
|
|
than good.)
|
|
<P>
|
|
|
|
<A NAME="IDX1529"></A>
|
|
<DT><CODE>MOVE_RATIO</CODE>
|
|
<DD>The threshold of number of scalar memory-to-memory move insns, <EM>below</EM>
|
|
which a sequence of insns should be generated instead of a
|
|
string move insn or a library call. Increasing the value will always
|
|
make code faster, but eventually incurs high cost in increased code size.
|
|
<P>
|
|
|
|
Note that on machines with no memory-to-memory move insns, this macro denotes
|
|
the corresponding number of memory-to-memory <EM>sequences</EM>.
|
|
</P><P>
|
|
|
|
If you don't define this, a reasonable default is used.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1530"></A>
|
|
<DT><CODE>MOVE_BY_PIECES_P (<VAR>size</VAR>, <VAR>alignment</VAR>)</CODE>
|
|
<DD>A C expression used to determine whether <CODE>move_by_pieces</CODE> will be used to
|
|
copy a chunk of memory, or whether some other block move mechanism
|
|
will be used. Defaults to 1 if <CODE>move_by_pieces_ninsns</CODE> returns less
|
|
than <CODE>MOVE_RATIO</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX1531"></A>
|
|
<DT><CODE>MOVE_MAX_PIECES</CODE>
|
|
<DD>A C expression used by <CODE>move_by_pieces</CODE> to determine the largest unit
|
|
a load or store used to copy memory is. Defaults to <CODE>MOVE_MAX</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX1532"></A>
|
|
<DT><CODE>USE_LOAD_POST_INCREMENT (<VAR>mode</VAR>)</CODE>
|
|
<DD>A C expression used to determine whether a load postincrement is a good
|
|
thing to use for a given mode. Defaults to the value of
|
|
<CODE>HAVE_POST_INCREMENT</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX1533"></A>
|
|
<DT><CODE>USE_LOAD_POST_DECREMENT (<VAR>mode</VAR>)</CODE>
|
|
<DD>A C expression used to determine whether a load postdecrement is a good
|
|
thing to use for a given mode. Defaults to the value of
|
|
<CODE>HAVE_POST_DECREMENT</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX1534"></A>
|
|
<DT><CODE>USE_LOAD_PRE_INCREMENT (<VAR>mode</VAR>)</CODE>
|
|
<DD>A C expression used to determine whether a load preincrement is a good
|
|
thing to use for a given mode. Defaults to the value of
|
|
<CODE>HAVE_PRE_INCREMENT</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX1535"></A>
|
|
<DT><CODE>USE_LOAD_PRE_DECREMENT (<VAR>mode</VAR>)</CODE>
|
|
<DD>A C expression used to determine whether a load predecrement is a good
|
|
thing to use for a given mode. Defaults to the value of
|
|
<CODE>HAVE_PRE_DECREMENT</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX1536"></A>
|
|
<DT><CODE>USE_STORE_POST_INCREMENT (<VAR>mode</VAR>)</CODE>
|
|
<DD>A C expression used to determine whether a store postincrement is a good
|
|
thing to use for a given mode. Defaults to the value of
|
|
<CODE>HAVE_POST_INCREMENT</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX1537"></A>
|
|
<DT><CODE>USE_STORE_POST_DECREMENT (<VAR>mode</VAR>)</CODE>
|
|
<DD>A C expression used to determine whether a store postdeccrement is a good
|
|
thing to use for a given mode. Defaults to the value of
|
|
<CODE>HAVE_POST_DECREMENT</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX1538"></A>
|
|
<DT><CODE>USE_STORE_PRE_INCREMENT (<VAR>mode</VAR>)</CODE>
|
|
<DD>This macro is used to determine whether a store preincrement is a good
|
|
thing to use for a given mode. Defaults to the value of
|
|
<CODE>HAVE_PRE_INCREMENT</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX1539"></A>
|
|
<DT><CODE>USE_STORE_PRE_DECREMENT (<VAR>mode</VAR>)</CODE>
|
|
<DD>This macro is used to determine whether a store predecrement is a good
|
|
thing to use for a given mode. Defaults to the value of
|
|
<CODE>HAVE_PRE_DECREMENT</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX1540"></A>
|
|
<DT><CODE>NO_FUNCTION_CSE</CODE>
|
|
<DD>Define this macro if it is as good or better to call a constant
|
|
function address than to call an address kept in a register.
|
|
<P>
|
|
|
|
<A NAME="IDX1541"></A>
|
|
<DT><CODE>NO_RECURSIVE_FUNCTION_CSE</CODE>
|
|
<DD>Define this macro if it is as good or better for a function to call
|
|
itself with an explicit address than to call an address kept in a
|
|
register.
|
|
<P>
|
|
|
|
<A NAME="IDX1542"></A>
|
|
<DT><CODE>ADJUST_COST (<VAR>insn</VAR>, <VAR>link</VAR>, <VAR>dep_insn</VAR>, <VAR>cost</VAR>)</CODE>
|
|
<DD>A C statement (sans semicolon) to update the integer variable <VAR>cost</VAR>
|
|
based on the relationship between <VAR>insn</VAR> that is dependent on
|
|
<VAR>dep_insn</VAR> through the dependence <VAR>link</VAR>. The default is to
|
|
make no adjustment to <VAR>cost</VAR>. This can be used for example to
|
|
specify to the scheduler that an output- or anti-dependence does not
|
|
incur the same cost as a data-dependence.
|
|
<P>
|
|
|
|
<A NAME="IDX1543"></A>
|
|
<DT><CODE>ADJUST_PRIORITY (<VAR>insn</VAR>)</CODE>
|
|
<DD>A C statement (sans semicolon) to update the integer scheduling
|
|
priority <CODE>INSN_PRIORITY(<VAR>insn</VAR>)</CODE>. Reduce the priority
|
|
to execute the <VAR>insn</VAR> earlier, increase the priority to execute
|
|
<VAR>insn</VAR> later. Do not define this macro if you do not need to
|
|
adjust the scheduling priorities of insns.
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="Sections"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC230"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC229" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC229"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC231" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC231"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC201" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC201"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC199" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC199"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_18.html#SEC251" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_18.html#SEC251"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H2> 17.14 Dividing the Output into Sections (Texts, Data, <small>...</small>) </H2>
|
|
<!--docid::SEC230::-->
|
|
<P>
|
|
|
|
An object file is divided into sections containing different types of
|
|
data. In the most common case, there are three sections: the <EM>text
|
|
section</EM>, which holds instructions and read-only data; the <EM>data
|
|
section</EM>, which holds initialized writable data; and the <EM>bss
|
|
section</EM>, which holds uninitialized data. Some systems have other kinds
|
|
of sections.
|
|
</P><P>
|
|
|
|
The compiler must tell the assembler when to switch sections. These
|
|
macros control what commands to output to tell the assembler this. You
|
|
can also define additional sections.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1544"></A>
|
|
<DT><CODE>TEXT_SECTION_ASM_OP</CODE>
|
|
<DD>A C expression whose value is a string containing the assembler
|
|
operation that should precede instructions and read-only data. Normally
|
|
<CODE>".text"</CODE> is right.
|
|
<P>
|
|
|
|
<A NAME="IDX1545"></A>
|
|
<DT><CODE>DATA_SECTION_ASM_OP</CODE>
|
|
<DD>A C expression whose value is a string containing the assembler
|
|
operation to identify the following data as writable initialized data.
|
|
Normally <CODE>".data"</CODE> is right.
|
|
<P>
|
|
|
|
<A NAME="IDX1546"></A>
|
|
<DT><CODE>SHARED_SECTION_ASM_OP</CODE>
|
|
<DD>If defined, a C expression whose value is a string containing the
|
|
assembler operation to identify the following data as shared data. If
|
|
not defined, <CODE>DATA_SECTION_ASM_OP</CODE> will be used.
|
|
<P>
|
|
|
|
<A NAME="IDX1547"></A>
|
|
<DT><CODE>BSS_SECTION_ASM_OP</CODE>
|
|
<DD>If defined, a C expression whose value is a string containing the
|
|
assembler operation to identify the following data as uninitialized global
|
|
data. If not defined, and neither <CODE>ASM_OUTPUT_BSS</CODE> nor
|
|
<CODE>ASM_OUTPUT_ALIGNED_BSS</CODE> are defined, uninitialized global data will be
|
|
output in the data section if <SAMP>`-fno-common'</SAMP> is passed, otherwise
|
|
<CODE>ASM_OUTPUT_COMMON</CODE> will be used.
|
|
<P>
|
|
|
|
<A NAME="IDX1548"></A>
|
|
<DT><CODE>SHARED_BSS_SECTION_ASM_OP</CODE>
|
|
<DD>If defined, a C expression whose value is a string containing the
|
|
assembler operation to identify the following data as uninitialized global
|
|
shared data. If not defined, and <CODE>BSS_SECTION_ASM_OP</CODE> is, the latter
|
|
will be used.
|
|
<P>
|
|
|
|
<A NAME="IDX1549"></A>
|
|
<DT><CODE>INIT_SECTION_ASM_OP</CODE>
|
|
<DD>If defined, a C expression whose value is a string containing the
|
|
assembler operation to identify the following data as initialization
|
|
code. If not defined, GNU CC will assume such a section does not
|
|
exist.
|
|
<P>
|
|
|
|
<A NAME="IDX1550"></A>
|
|
<A NAME="IDX1551"></A>
|
|
<A NAME="IDX1552"></A>
|
|
<DT><CODE>EXTRA_SECTIONS</CODE>
|
|
<DD>A list of names for sections other than the standard two, which are
|
|
<CODE>in_text</CODE> and <CODE>in_data</CODE>. You need not define this macro
|
|
on a system with no other sections (that GCC needs to use).
|
|
<P>
|
|
|
|
<A NAME="IDX1553"></A>
|
|
<A NAME="IDX1554"></A>
|
|
<A NAME="IDX1555"></A>
|
|
<DT><CODE>EXTRA_SECTION_FUNCTIONS</CODE>
|
|
<DD>One or more functions to be defined in <TT>`varasm.c'</TT>. These
|
|
functions should do jobs analogous to those of <CODE>text_section</CODE> and
|
|
<CODE>data_section</CODE>, for your additional sections. Do not define this
|
|
macro if you do not define <CODE>EXTRA_SECTIONS</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX1556"></A>
|
|
<DT><CODE>READONLY_DATA_SECTION</CODE>
|
|
<DD>On most machines, read-only variables, constants, and jump tables are
|
|
placed in the text section. If this is not the case on your machine,
|
|
this macro should be defined to be the name of a function (either
|
|
<CODE>data_section</CODE> or a function defined in <CODE>EXTRA_SECTIONS</CODE>) that
|
|
switches to the section to be used for read-only items.
|
|
<P>
|
|
|
|
If these items should be placed in the text section, this macro should
|
|
not be defined.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1557"></A>
|
|
<DT><CODE>SELECT_SECTION (<VAR>exp</VAR>, <VAR>reloc</VAR>)</CODE>
|
|
<DD>A C statement or statements to switch to the appropriate section for
|
|
output of <VAR>exp</VAR>. You can assume that <VAR>exp</VAR> is either a
|
|
<CODE>VAR_DECL</CODE> node or a constant of some sort. <VAR>reloc</VAR>
|
|
indicates whether the initial value of <VAR>exp</VAR> requires link-time
|
|
relocations. Select the section by calling <CODE>text_section</CODE> or one
|
|
of the alternatives for other sections.
|
|
<P>
|
|
|
|
Do not define this macro if you put all read-only variables and
|
|
constants in the read-only data section (usually the text section).
|
|
</P><P>
|
|
|
|
<A NAME="IDX1558"></A>
|
|
<DT><CODE>SELECT_RTX_SECTION (<VAR>mode</VAR>, <VAR>rtx</VAR>)</CODE>
|
|
<DD>A C statement or statements to switch to the appropriate section for
|
|
output of <VAR>rtx</VAR> in mode <VAR>mode</VAR>. You can assume that <VAR>rtx</VAR>
|
|
is some kind of constant in RTL. The argument <VAR>mode</VAR> is redundant
|
|
except in the case of a <CODE>const_int</CODE> rtx. Select the section by
|
|
calling <CODE>text_section</CODE> or one of the alternatives for other
|
|
sections.
|
|
<P>
|
|
|
|
Do not define this macro if you put all constants in the read-only
|
|
data section.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1559"></A>
|
|
<DT><CODE>JUMP_TABLES_IN_TEXT_SECTION</CODE>
|
|
<DD>Define this macro to be an expression with a non-zero value if jump
|
|
tables (for <CODE>tablejump</CODE> insns) should be output in the text
|
|
section, along with the assembler instructions. Otherwise, the
|
|
readonly data section is used.
|
|
<P>
|
|
|
|
This macro is irrelevant if there is no separate readonly data section.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1560"></A>
|
|
<DT><CODE>ENCODE_SECTION_INFO (<VAR>decl</VAR>)</CODE>
|
|
<DD>Define this macro if references to a symbol must be treated differently
|
|
depending on something about the variable or function named by the
|
|
symbol (such as what section it is in).
|
|
<P>
|
|
|
|
The macro definition, if any, is executed immediately after the rtl for
|
|
<VAR>decl</VAR> has been created and stored in <CODE>DECL_RTL (<VAR>decl</VAR>)</CODE>.
|
|
The value of the rtl will be a <CODE>mem</CODE> whose address is a
|
|
<CODE>symbol_ref</CODE>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1561"></A>
|
|
The usual thing for this macro to do is to record a flag in the
|
|
<CODE>symbol_ref</CODE> (such as <CODE>SYMBOL_REF_FLAG</CODE>) or to store a
|
|
modified name string in the <CODE>symbol_ref</CODE> (if one bit is not enough
|
|
information).
|
|
</P><P>
|
|
|
|
<A NAME="IDX1562"></A>
|
|
<DT><CODE>STRIP_NAME_ENCODING (<VAR>var</VAR>, <VAR>sym_name</VAR>)</CODE>
|
|
<DD>Decode <VAR>sym_name</VAR> and store the real name part in <VAR>var</VAR>, sans
|
|
the characters that encode section info. Define this macro if
|
|
<CODE>ENCODE_SECTION_INFO</CODE> alters the symbol's name string.
|
|
<P>
|
|
|
|
<A NAME="IDX1563"></A>
|
|
<DT><CODE>UNIQUE_SECTION_P (<VAR>decl</VAR>)</CODE>
|
|
<DD>A C expression which evaluates to true if <VAR>decl</VAR> should be placed
|
|
into a unique section for some target-specific reason. If you do not
|
|
define this macro, the default is <SAMP>`0'</SAMP>. Note that the flag
|
|
<SAMP>`-ffunction-sections'</SAMP> will also cause functions to be placed into
|
|
unique sections.
|
|
<P>
|
|
|
|
<A NAME="IDX1564"></A>
|
|
<DT><CODE>UNIQUE_SECTION (<VAR>decl</VAR>, <VAR>reloc</VAR>)</CODE>
|
|
<DD>A C statement to build up a unique section name, expressed as a
|
|
STRING_CST node, and assign it to <SAMP>`DECL_SECTION_NAME (<VAR>decl</VAR>)'</SAMP>.
|
|
<VAR>reloc</VAR> indicates whether the initial value of <VAR>exp</VAR> requires
|
|
link-time relocations. If you do not define this macro, GNU CC will use
|
|
the symbol name prefixed by <SAMP>`.'</SAMP> as the section name.
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="PIC"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC231"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC230" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC230"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC232" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC232"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC201" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC201"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC199" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC199"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_18.html#SEC251" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_18.html#SEC251"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H2> 17.15 Position Independent Code </H2>
|
|
<!--docid::SEC231::-->
|
|
<P>
|
|
|
|
This section describes macros that help implement generation of position
|
|
independent code. Simply defining these macros is not enough to
|
|
generate valid PIC; you must also add support to the macros
|
|
<CODE>GO_IF_LEGITIMATE_ADDRESS</CODE> and <CODE>PRINT_OPERAND_ADDRESS</CODE>, as
|
|
well as <CODE>LEGITIMIZE_ADDRESS</CODE>. You must modify the definition of
|
|
<SAMP>`movsi'</SAMP> to do something appropriate when the source operand
|
|
contains a symbolic address. You may also need to alter the handling of
|
|
switch statements so that they use relative addresses.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1565"></A>
|
|
<DT><CODE>PIC_OFFSET_TABLE_REGNUM</CODE>
|
|
<DD>The register number of the register used to address a table of static
|
|
data addresses in memory. In some cases this register is defined by a
|
|
processor's "application binary interface" (ABI). When this macro
|
|
is defined, RTL is generated for this register once, as with the stack
|
|
pointer and frame pointer registers. If this macro is not defined, it
|
|
is up to the machine-dependent files to allocate such a register (if
|
|
necessary).
|
|
<P>
|
|
|
|
<A NAME="IDX1566"></A>
|
|
<DT><CODE>PIC_OFFSET_TABLE_REG_CALL_CLOBBERED</CODE>
|
|
<DD>Define this macro if the register defined by
|
|
<CODE>PIC_OFFSET_TABLE_REGNUM</CODE> is clobbered by calls. Do not define
|
|
this macro if <CODE>PIC_OFFSET_TABLE_REGNUM</CODE> is not defined.
|
|
<P>
|
|
|
|
<A NAME="IDX1567"></A>
|
|
<DT><CODE>FINALIZE_PIC</CODE>
|
|
<DD>By generating position-independent code, when two different programs (A
|
|
and B) share a common library (libC.a), the text of the library can be
|
|
shared whether or not the library is linked at the same address for both
|
|
programs. In some of these environments, position-independent code
|
|
requires not only the use of different addressing modes, but also
|
|
special code to enable the use of these addressing modes.
|
|
<P>
|
|
|
|
The <CODE>FINALIZE_PIC</CODE> macro serves as a hook to emit these special
|
|
codes once the function is being compiled into assembly code, but not
|
|
before. (It is not done before, because in the case of compiling an
|
|
inline function, it would lead to multiple PIC prologues being
|
|
included in functions which used inline functions and were compiled to
|
|
assembly language.)
|
|
</P><P>
|
|
|
|
<A NAME="IDX1568"></A>
|
|
<DT><CODE>LEGITIMATE_PIC_OPERAND_P (<VAR>x</VAR>)</CODE>
|
|
<DD>A C expression that is nonzero if <VAR>x</VAR> is a legitimate immediate
|
|
operand on the target machine when generating position independent code.
|
|
You can assume that <VAR>x</VAR> satisfies <CODE>CONSTANT_P</CODE>, so you need not
|
|
check this. You can also assume <VAR>flag_pic</VAR> is true, so you need not
|
|
check it either. You need not define this macro if all constants
|
|
(including <CODE>SYMBOL_REF</CODE>) can be immediate operands when generating
|
|
position independent code.
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="Assembler Format"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC232"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC231" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC231"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC233" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC233"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC201" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC201"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC199" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC199"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC243" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC243"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H2> 17.16 Defining the Output Assembler Language </H2>
|
|
<!--docid::SEC232::-->
|
|
<P>
|
|
|
|
This section describes macros whose principal purpose is to describe how
|
|
to write instructions in assembler language--rather than what the
|
|
instructions do.
|
|
</P><P>
|
|
|
|
<BLOCKQUOTE><TABLE BORDER=0 CELLSPACING=0>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC233" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC233">17.16.1 The Overall Framework of an Assembler File</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">Structural information for the assembler file.</TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC234" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC234">17.16.2 Output of Data</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">Output of constants (numbers, strings, addresses).</TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC235" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC235">17.16.3 Output of Uninitialized Variables</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">Output of uninitialized variables.</TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC236" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC236">17.16.4 Output and Generation of Labels</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">Output and generation of labels.</TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC237" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC237">17.16.5 How Initialization Functions Are Handled</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">General principles of initialization
|
|
and termination routines.</TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC238" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC238">17.16.6 Macros Controlling Initialization Routines</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">Specific macros that control the handling of
|
|
initialization and termination routines.</TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC239" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC239">17.16.7 Output of Assembler Instructions</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">Output of actual instructions.</TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC240" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC240">17.16.8 Output of Dispatch Tables</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">Output of jump tables.</TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC241" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC241">17.16.9 Assembler Commands for Exception Regions</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">Output of exception region code.</TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC242" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC242">17.16.10 Assembler Commands for Alignment</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">Pseudo ops for alignment and skipping data.</TD></TR>
|
|
</TABLE></BLOCKQUOTE>
|
|
<P>
|
|
|
|
<A NAME="File Framework"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC233"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC232" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC232"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC234" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC234"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC201" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC201"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC232" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC232"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC243" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC243"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H3> 17.16.1 The Overall Framework of an Assembler File </H3>
|
|
<!--docid::SEC233::-->
|
|
<P>
|
|
|
|
This describes the overall framework of an assembler file.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1569"></A>
|
|
<DT><CODE>ASM_FILE_START (<VAR>stream</VAR>)</CODE>
|
|
<DD>A C expression which outputs to the stdio stream <VAR>stream</VAR>
|
|
some appropriate text to go at the start of an assembler file.
|
|
<P>
|
|
|
|
Normally this macro is defined to output a line containing
|
|
<SAMP>`#NO_APP'</SAMP>, which is a comment that has no effect on most
|
|
assemblers but tells the GNU assembler that it can save time by not
|
|
checking for certain assembler constructs.
|
|
</P><P>
|
|
|
|
On systems that use SDB, it is necessary to output certain commands;
|
|
see <TT>`attasm.h'</TT>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1570"></A>
|
|
<DT><CODE>ASM_FILE_END (<VAR>stream</VAR>)</CODE>
|
|
<DD>A C expression which outputs to the stdio stream <VAR>stream</VAR>
|
|
some appropriate text to go at the end of an assembler file.
|
|
<P>
|
|
|
|
If this macro is not defined, the default is to output nothing
|
|
special at the end of the file. Most systems don't require any
|
|
definition.
|
|
</P><P>
|
|
|
|
On systems that use SDB, it is necessary to output certain commands;
|
|
see <TT>`attasm.h'</TT>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1571"></A>
|
|
<DT><CODE>ASM_IDENTIFY_GCC (<VAR>file</VAR>)</CODE>
|
|
<DD>A C statement to output assembler commands which will identify
|
|
the object file as having been compiled with GNU CC (or another
|
|
GNU compiler).
|
|
<P>
|
|
|
|
If you don't define this macro, the string <SAMP>`gcc_compiled.:'</SAMP>
|
|
is output. This string is calculated to define a symbol which,
|
|
on BSD systems, will never be defined for any other reason.
|
|
GDB checks for the presence of this symbol when reading the
|
|
symbol table of an executable.
|
|
</P><P>
|
|
|
|
On non-BSD systems, you must arrange communication with GDB in
|
|
some other fashion. If GDB is not used on your system, you can
|
|
define this macro with an empty body.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1572"></A>
|
|
<DT><CODE>ASM_COMMENT_START</CODE>
|
|
<DD>A C string constant describing how to begin a comment in the target
|
|
assembler language. The compiler assumes that the comment will end at
|
|
the end of the line.
|
|
<P>
|
|
|
|
<A NAME="IDX1573"></A>
|
|
<DT><CODE>ASM_APP_ON</CODE>
|
|
<DD>A C string constant for text to be output before each <CODE>asm</CODE>
|
|
statement or group of consecutive ones. Normally this is
|
|
<CODE>"#APP"</CODE>, which is a comment that has no effect on most
|
|
assemblers but tells the GNU assembler that it must check the lines
|
|
that follow for all valid assembler constructs.
|
|
<P>
|
|
|
|
<A NAME="IDX1574"></A>
|
|
<DT><CODE>ASM_APP_OFF</CODE>
|
|
<DD>A C string constant for text to be output after each <CODE>asm</CODE>
|
|
statement or group of consecutive ones. Normally this is
|
|
<CODE>"#NO_APP"</CODE>, which tells the GNU assembler to resume making the
|
|
time-saving assumptions that are valid for ordinary compiler output.
|
|
<P>
|
|
|
|
<A NAME="IDX1575"></A>
|
|
<DT><CODE>ASM_OUTPUT_SOURCE_FILENAME (<VAR>stream</VAR>, <VAR>name</VAR>)</CODE>
|
|
<DD>A C statement to output COFF information or DWARF debugging information
|
|
which indicates that filename <VAR>name</VAR> is the current source file to
|
|
the stdio stream <VAR>stream</VAR>.
|
|
<P>
|
|
|
|
This macro need not be defined if the standard form of output
|
|
for the file format in use is appropriate.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1576"></A>
|
|
<DT><CODE>OUTPUT_QUOTED_STRING (<VAR>stream</VAR>, <VAR>name</VAR>)</CODE>
|
|
<DD>A C statement to output the string <VAR>string</VAR> to the stdio stream
|
|
<VAR>stream</VAR>. If you do not call the function <CODE>output_quoted_string</CODE>
|
|
in your config files, GNU CC will only call it to output filenames to
|
|
the assembler source. So you can use it to canonicalize the format
|
|
of the filename using this macro.
|
|
<P>
|
|
|
|
<A NAME="IDX1577"></A>
|
|
<DT><CODE>ASM_OUTPUT_SOURCE_LINE (<VAR>stream</VAR>, <VAR>line</VAR>)</CODE>
|
|
<DD>A C statement to output DBX or SDB debugging information before code
|
|
for line number <VAR>line</VAR> of the current source file to the
|
|
stdio stream <VAR>stream</VAR>.
|
|
<P>
|
|
|
|
This macro need not be defined if the standard form of debugging
|
|
information for the debugger in use is appropriate.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1578"></A>
|
|
<DT><CODE>ASM_OUTPUT_IDENT (<VAR>stream</VAR>, <VAR>string</VAR>)</CODE>
|
|
<DD>A C statement to output something to the assembler file to handle a
|
|
<SAMP>`#ident'</SAMP> directive containing the text <VAR>string</VAR>. If this
|
|
macro is not defined, nothing is output for a <SAMP>`#ident'</SAMP> directive.
|
|
<P>
|
|
|
|
<A NAME="IDX1579"></A>
|
|
<DT><CODE>ASM_OUTPUT_SECTION_NAME (<VAR>stream</VAR>, <VAR>decl</VAR>, <VAR>name</VAR>, <VAR>reloc</VAR>)</CODE>
|
|
<DD>A C statement to output something to the assembler file to switch to section
|
|
<VAR>name</VAR> for object <VAR>decl</VAR> which is either a <CODE>FUNCTION_DECL</CODE>, a
|
|
<CODE>VAR_DECL</CODE> or <CODE>NULL_TREE</CODE>. <VAR>reloc</VAR>
|
|
indicates whether the initial value of <VAR>exp</VAR> requires link-time
|
|
relocations. Some target formats do not support
|
|
arbitrary sections. Do not define this macro in such cases.
|
|
<P>
|
|
|
|
At present this macro is only used to support section attributes.
|
|
When this macro is undefined, section attributes are disabled.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1580"></A>
|
|
<DT><CODE>OBJC_PROLOGUE</CODE>
|
|
<DD>A C statement to output any assembler statements which are required to
|
|
precede any Objective C object definitions or message sending. The
|
|
statement is executed only when compiling an Objective C program.
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="Data Output"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC234"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC233" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC233"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC235" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC235"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC235" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC235"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC232" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC232"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC243" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC243"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H3> 17.16.2 Output of Data </H3>
|
|
<!--docid::SEC234::-->
|
|
<P>
|
|
|
|
This describes data output.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1581"></A>
|
|
<A NAME="IDX1582"></A>
|
|
<A NAME="IDX1583"></A>
|
|
<DT><CODE>ASM_OUTPUT_LONG_DOUBLE (<VAR>stream</VAR>, <VAR>value</VAR>)</CODE>
|
|
<DD><DT><CODE>ASM_OUTPUT_DOUBLE (<VAR>stream</VAR>, <VAR>value</VAR>)</CODE>
|
|
<DD><DT><CODE>ASM_OUTPUT_FLOAT (<VAR>stream</VAR>, <VAR>value</VAR>)</CODE>
|
|
<DD><DT><CODE>ASM_OUTPUT_THREE_QUARTER_FLOAT (<VAR>stream</VAR>, <VAR>value</VAR>)</CODE>
|
|
<DD><DT><CODE>ASM_OUTPUT_SHORT_FLOAT (<VAR>stream</VAR>, <VAR>value</VAR>)</CODE>
|
|
<DD><DT><CODE>ASM_OUTPUT_BYTE_FLOAT (<VAR>stream</VAR>, <VAR>value</VAR>)</CODE>
|
|
<DD>A C statement to output to the stdio stream <VAR>stream</VAR> an assembler
|
|
instruction to assemble a floating-point constant of <CODE>TFmode</CODE>,
|
|
<CODE>DFmode</CODE>, <CODE>SFmode</CODE>, <CODE>TQFmode</CODE>, <CODE>HFmode</CODE>, or
|
|
<CODE>QFmode</CODE>, respectively, whose value is <VAR>value</VAR>. <VAR>value</VAR>
|
|
will be a C expression of type <CODE>REAL_VALUE_TYPE</CODE>. Macros such as
|
|
<CODE>REAL_VALUE_TO_TARGET_DOUBLE</CODE> are useful for writing these
|
|
definitions.
|
|
<P>
|
|
|
|
<A NAME="IDX1584"></A>
|
|
<A NAME="IDX1585"></A>
|
|
<A NAME="IDX1586"></A>
|
|
<A NAME="IDX1587"></A>
|
|
<A NAME="IDX1588"></A>
|
|
<A NAME="IDX1589"></A>
|
|
<DT><CODE>ASM_OUTPUT_QUADRUPLE_INT (<VAR>stream</VAR>, <VAR>exp</VAR>)</CODE>
|
|
<DD><DT><CODE>ASM_OUTPUT_DOUBLE_INT (<VAR>stream</VAR>, <VAR>exp</VAR>)</CODE>
|
|
<DD><DT><CODE>ASM_OUTPUT_INT (<VAR>stream</VAR>, <VAR>exp</VAR>)</CODE>
|
|
<DD><DT><CODE>ASM_OUTPUT_SHORT (<VAR>stream</VAR>, <VAR>exp</VAR>)</CODE>
|
|
<DD><DT><CODE>ASM_OUTPUT_CHAR (<VAR>stream</VAR>, <VAR>exp</VAR>)</CODE>
|
|
<DD>A C statement to output to the stdio stream <VAR>stream</VAR> an assembler
|
|
instruction to assemble an integer of 16, 8, 4, 2 or 1 bytes,
|
|
respectively, whose value is <VAR>value</VAR>. The argument <VAR>exp</VAR> will
|
|
be an RTL expression which represents a constant value. Use
|
|
<SAMP>`output_addr_const (<VAR>stream</VAR>, <VAR>exp</VAR>)'</SAMP> to output this value
|
|
as an assembler expression.<P>
|
|
|
|
For sizes larger than <CODE>UNITS_PER_WORD</CODE>, if the action of a macro
|
|
would be identical to repeatedly calling the macro corresponding to
|
|
a size of <CODE>UNITS_PER_WORD</CODE>, once for each word, you need not define
|
|
the macro.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1590"></A>
|
|
<DT><CODE>ASM_OUTPUT_BYTE (<VAR>stream</VAR>, <VAR>value</VAR>)</CODE>
|
|
<DD>A C statement to output to the stdio stream <VAR>stream</VAR> an assembler
|
|
instruction to assemble a single byte containing the number <VAR>value</VAR>.
|
|
<P>
|
|
|
|
<A NAME="IDX1591"></A>
|
|
<DT><CODE>ASM_BYTE_OP</CODE>
|
|
<DD>A C string constant giving the pseudo-op to use for a sequence of
|
|
single-byte constants. If this macro is not defined, the default is
|
|
<CODE>"byte"</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX1592"></A>
|
|
<DT><CODE>ASM_OUTPUT_ASCII (<VAR>stream</VAR>, <VAR>ptr</VAR>, <VAR>len</VAR>)</CODE>
|
|
<DD>A C statement to output to the stdio stream <VAR>stream</VAR> an assembler
|
|
instruction to assemble a string constant containing the <VAR>len</VAR>
|
|
bytes at <VAR>ptr</VAR>. <VAR>ptr</VAR> will be a C expression of type
|
|
<CODE>char *</CODE> and <VAR>len</VAR> a C expression of type <CODE>int</CODE>.
|
|
<P>
|
|
|
|
If the assembler has a <CODE>.ascii</CODE> pseudo-op as found in the
|
|
Berkeley Unix assembler, do not define the macro
|
|
<CODE>ASM_OUTPUT_ASCII</CODE>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1593"></A>
|
|
<DT><CODE>CONSTANT_POOL_BEFORE_FUNCTION</CODE>
|
|
<DD>You may define this macro as a C expression. You should define the
|
|
expression to have a non-zero value if GNU CC should output the constant
|
|
pool for a function before the code for the function, or a zero value if
|
|
GNU CC should output the constant pool after the function. If you do
|
|
not define this macro, the usual case, GNU CC will output the constant
|
|
pool before the function.
|
|
<P>
|
|
|
|
<A NAME="IDX1594"></A>
|
|
<DT><CODE>ASM_OUTPUT_POOL_PROLOGUE (<VAR>file</VAR> <VAR>funname</VAR> <VAR>fundecl</VAR> <VAR>size</VAR>)</CODE>
|
|
<DD>A C statement to output assembler commands to define the start of the
|
|
constant pool for a function. <VAR>funname</VAR> is a string giving
|
|
the name of the function. Should the return type of the function
|
|
be required, it can be obtained via <VAR>fundecl</VAR>. <VAR>size</VAR>
|
|
is the size, in bytes, of the constant pool that will be written
|
|
immediately after this call.
|
|
<P>
|
|
|
|
If no constant-pool prefix is required, the usual case, this macro need
|
|
not be defined.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1595"></A>
|
|
<DT><CODE>ASM_OUTPUT_SPECIAL_POOL_ENTRY (<VAR>file</VAR>, <VAR>x</VAR>, <VAR>mode</VAR>, <VAR>align</VAR>, <VAR>labelno</VAR>, <VAR>jumpto</VAR>)</CODE>
|
|
<DD>A C statement (with or without semicolon) to output a constant in the
|
|
constant pool, if it needs special treatment. (This macro need not do
|
|
anything for RTL expressions that can be output normally.)
|
|
<P>
|
|
|
|
The argument <VAR>file</VAR> is the standard I/O stream to output the
|
|
assembler code on. <VAR>x</VAR> is the RTL expression for the constant to
|
|
output, and <VAR>mode</VAR> is the machine mode (in case <VAR>x</VAR> is a
|
|
<SAMP>`const_int'</SAMP>). <VAR>align</VAR> is the required alignment for the value
|
|
<VAR>x</VAR>; you should output an assembler directive to force this much
|
|
alignment.
|
|
</P><P>
|
|
|
|
The argument <VAR>labelno</VAR> is a number to use in an internal label for
|
|
the address of this pool entry. The definition of this macro is
|
|
responsible for outputting the label definition at the proper place.
|
|
Here is how to do this:
|
|
</P><P>
|
|
|
|
<TABLE><tr><td> </td><td class=example><pre>ASM_OUTPUT_INTERNAL_LABEL (<VAR>file</VAR>, "LC", <VAR>labelno</VAR>);
|
|
</pre></td></tr></table></P><P>
|
|
|
|
When you output a pool entry specially, you should end with a
|
|
<CODE>goto</CODE> to the label <VAR>jumpto</VAR>. This will prevent the same pool
|
|
entry from being output a second time in the usual manner.
|
|
</P><P>
|
|
|
|
You need not define this macro if it would do nothing.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1596"></A>
|
|
<DT><CODE>CONSTANT_AFTER_FUNCTION_P (<VAR>exp</VAR>)</CODE>
|
|
<DD>Define this macro as a C expression which is nonzero if the constant
|
|
<VAR>exp</VAR>, of type <CODE>tree</CODE>, should be output after the code for a
|
|
function. The compiler will normally output all constants before the
|
|
function; you need not define this macro if this is OK.
|
|
<P>
|
|
|
|
<A NAME="IDX1597"></A>
|
|
<DT><CODE>ASM_OUTPUT_POOL_EPILOGUE (<VAR>file</VAR> <VAR>funname</VAR> <VAR>fundecl</VAR> <VAR>size</VAR>)</CODE>
|
|
<DD>A C statement to output assembler commands to at the end of the constant
|
|
pool for a function. <VAR>funname</VAR> is a string giving the name of the
|
|
function. Should the return type of the function be required, you can
|
|
obtain it via <VAR>fundecl</VAR>. <VAR>size</VAR> is the size, in bytes, of the
|
|
constant pool that GNU CC wrote immediately before this call.
|
|
<P>
|
|
|
|
If no constant-pool epilogue is required, the usual case, you need not
|
|
define this macro.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1598"></A>
|
|
<DT><CODE>IS_ASM_LOGICAL_LINE_SEPARATOR (<VAR>C</VAR>)</CODE>
|
|
<DD>Define this macro as a C expression which is nonzero if <VAR>C</VAR> is
|
|
used as a logical line separator by the assembler.
|
|
<P>
|
|
|
|
If you do not define this macro, the default is that only
|
|
the character <SAMP>`;'</SAMP> is treated as a logical line separator.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1599"></A>
|
|
<A NAME="IDX1600"></A>
|
|
<DT><CODE>ASM_OPEN_PAREN</CODE>
|
|
<DD><DT><CODE>ASM_CLOSE_PAREN</CODE>
|
|
<DD>These macros are defined as C string constant, describing the syntax
|
|
in the assembler for grouping arithmetic expressions. The following
|
|
definitions are correct for most assemblers:
|
|
<P>
|
|
|
|
<TABLE><tr><td> </td><td class=example><pre>#define ASM_OPEN_PAREN "("
|
|
#define ASM_CLOSE_PAREN ")"
|
|
</pre></td></tr></table></DL>
|
|
<P>
|
|
|
|
These macros are provided by <TT>`real.h'</TT> for writing the definitions
|
|
of <CODE>ASM_OUTPUT_DOUBLE</CODE> and the like:
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<DT><CODE>REAL_VALUE_TO_TARGET_SINGLE (<VAR>x</VAR>, <VAR>l</VAR>)</CODE>
|
|
<DD><DT><CODE>REAL_VALUE_TO_TARGET_DOUBLE (<VAR>x</VAR>, <VAR>l</VAR>)</CODE>
|
|
<DD><DT><CODE>REAL_VALUE_TO_TARGET_LONG_DOUBLE (<VAR>x</VAR>, <VAR>l</VAR>)</CODE>
|
|
<DD><A NAME="IDX1601"></A>
|
|
<A NAME="IDX1602"></A>
|
|
<A NAME="IDX1603"></A>
|
|
These translate <VAR>x</VAR>, of type <CODE>REAL_VALUE_TYPE</CODE>, to the target's
|
|
floating point representation, and store its bit pattern in the array of
|
|
<CODE>long int</CODE> whose address is <VAR>l</VAR>. The number of elements in the
|
|
output array is determined by the size of the desired target floating
|
|
point data type: 32 bits of it go in each <CODE>long int</CODE> array
|
|
element. Each array element holds 32 bits of the result, even if
|
|
<CODE>long int</CODE> is wider than 32 bits on the host machine.
|
|
<P>
|
|
|
|
The array element values are designed so that you can print them out
|
|
using <CODE>fprintf</CODE> in the order they should appear in the target
|
|
machine's memory.
|
|
</P><P>
|
|
|
|
<DT><CODE>REAL_VALUE_TO_DECIMAL (<VAR>x</VAR>, <VAR>format</VAR>, <VAR>string</VAR>)</CODE>
|
|
<DD><A NAME="IDX1604"></A>
|
|
This macro converts <VAR>x</VAR>, of type <CODE>REAL_VALUE_TYPE</CODE>, to a
|
|
decimal number and stores it as a string into <VAR>string</VAR>.
|
|
You must pass, as <VAR>string</VAR>, the address of a long enough block
|
|
of space to hold the result.
|
|
<P>
|
|
|
|
The argument <VAR>format</VAR> is a <CODE>printf</CODE>-specification that serves
|
|
as a suggestion for how to format the output string.
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="Uninitialized Data"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC235"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC234" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC234"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC236" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC236"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC236" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC236"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC232" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC232"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC243" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC243"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H3> 17.16.3 Output of Uninitialized Variables </H3>
|
|
<!--docid::SEC235::-->
|
|
<P>
|
|
|
|
Each of the macros in this section is used to do the whole job of
|
|
outputting a single uninitialized variable.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1605"></A>
|
|
<DT><CODE>ASM_OUTPUT_COMMON (<VAR>stream</VAR>, <VAR>name</VAR>, <VAR>size</VAR>, <VAR>rounded</VAR>)</CODE>
|
|
<DD>A C statement (sans semicolon) to output to the stdio stream
|
|
<VAR>stream</VAR> the assembler definition of a common-label named
|
|
<VAR>name</VAR> whose size is <VAR>size</VAR> bytes. The variable <VAR>rounded</VAR>
|
|
is the size rounded up to whatever alignment the caller wants.
|
|
<P>
|
|
|
|
Use the expression <CODE>assemble_name (<VAR>stream</VAR>, <VAR>name</VAR>)</CODE> to
|
|
output the name itself; before and after that, output the additional
|
|
assembler syntax for defining the name, and a newline.
|
|
</P><P>
|
|
|
|
This macro controls how the assembler definitions of uninitialized
|
|
common global variables are output.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1606"></A>
|
|
<DT><CODE>ASM_OUTPUT_ALIGNED_COMMON (<VAR>stream</VAR>, <VAR>name</VAR>, <VAR>size</VAR>, <VAR>alignment</VAR>)</CODE>
|
|
<DD>Like <CODE>ASM_OUTPUT_COMMON</CODE> except takes the required alignment as a
|
|
separate, explicit argument. If you define this macro, it is used in
|
|
place of <CODE>ASM_OUTPUT_COMMON</CODE>, and gives you more flexibility in
|
|
handling the required alignment of the variable. The alignment is specified
|
|
as the number of bits.
|
|
<P>
|
|
|
|
<A NAME="IDX1607"></A>
|
|
<DT><CODE>ASM_OUTPUT_ALIGNED_DECL_COMMON (<VAR>stream</VAR>, <VAR>decl</VAR>, <VAR>name</VAR>, <VAR>size</VAR>, <VAR>alignment</VAR>)</CODE>
|
|
<DD>Like <CODE>ASM_OUTPUT_ALIGNED_COMMON</CODE> except that <VAR>decl</VAR> of the
|
|
variable to be output, if there is one, or <CODE>NULL_TREE</CODE> if there
|
|
is not corresponding variable. If you define this macro, GNU CC wil use it
|
|
in place of both <CODE>ASM_OUTPUT_COMMON</CODE> and
|
|
<CODE>ASM_OUTPUT_ALIGNED_COMMON</CODE>. Define this macro when you need to see
|
|
the variable's decl in order to chose what to output.
|
|
<P>
|
|
|
|
<A NAME="IDX1608"></A>
|
|
<DT><CODE>ASM_OUTPUT_SHARED_COMMON (<VAR>stream</VAR>, <VAR>name</VAR>, <VAR>size</VAR>, <VAR>rounded</VAR>)</CODE>
|
|
<DD>If defined, it is similar to <CODE>ASM_OUTPUT_COMMON</CODE>, except that it
|
|
is used when <VAR>name</VAR> is shared. If not defined, <CODE>ASM_OUTPUT_COMMON</CODE>
|
|
will be used.
|
|
<P>
|
|
|
|
<A NAME="IDX1609"></A>
|
|
<DT><CODE>ASM_OUTPUT_BSS (<VAR>stream</VAR>, <VAR>decl</VAR>, <VAR>name</VAR>, <VAR>size</VAR>, <VAR>rounded</VAR>)</CODE>
|
|
<DD>A C statement (sans semicolon) to output to the stdio stream
|
|
<VAR>stream</VAR> the assembler definition of uninitialized global <VAR>decl</VAR> named
|
|
<VAR>name</VAR> whose size is <VAR>size</VAR> bytes. The variable <VAR>rounded</VAR>
|
|
is the size rounded up to whatever alignment the caller wants.
|
|
<P>
|
|
|
|
Try to use function <CODE>asm_output_bss</CODE> defined in <TT>`varasm.c'</TT> when
|
|
defining this macro. If unable, use the expression
|
|
<CODE>assemble_name (<VAR>stream</VAR>, <VAR>name</VAR>)</CODE> to output the name itself;
|
|
before and after that, output the additional assembler syntax for defining
|
|
the name, and a newline.
|
|
</P><P>
|
|
|
|
This macro controls how the assembler definitions of uninitialized global
|
|
variables are output. This macro exists to properly support languages like
|
|
<CODE>c++</CODE> which do not have <CODE>common</CODE> data. However, this macro currently
|
|
is not defined for all targets. If this macro and
|
|
<CODE>ASM_OUTPUT_ALIGNED_BSS</CODE> are not defined then <CODE>ASM_OUTPUT_COMMON</CODE>
|
|
or <CODE>ASM_OUTPUT_ALIGNED_COMMON</CODE> or
|
|
<CODE>ASM_OUTPUT_ALIGNED_DECL_COMMON</CODE> is used.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1610"></A>
|
|
<DT><CODE>ASM_OUTPUT_ALIGNED_BSS (<VAR>stream</VAR>, <VAR>decl</VAR>, <VAR>name</VAR>, <VAR>size</VAR>, <VAR>alignment</VAR>)</CODE>
|
|
<DD>Like <CODE>ASM_OUTPUT_BSS</CODE> except takes the required alignment as a
|
|
separate, explicit argument. If you define this macro, it is used in
|
|
place of <CODE>ASM_OUTPUT_BSS</CODE>, and gives you more flexibility in
|
|
handling the required alignment of the variable. The alignment is specified
|
|
as the number of bits.
|
|
<P>
|
|
|
|
Try to use function <CODE>asm_output_aligned_bss</CODE> defined in file
|
|
<TT>`varasm.c'</TT> when defining this macro.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1611"></A>
|
|
<DT><CODE>ASM_OUTPUT_SHARED_BSS (<VAR>stream</VAR>, <VAR>decl</VAR>, <VAR>name</VAR>, <VAR>size</VAR>, <VAR>rounded</VAR>)</CODE>
|
|
<DD>If defined, it is similar to <CODE>ASM_OUTPUT_BSS</CODE>, except that it
|
|
is used when <VAR>name</VAR> is shared. If not defined, <CODE>ASM_OUTPUT_BSS</CODE>
|
|
will be used.
|
|
<P>
|
|
|
|
<A NAME="IDX1612"></A>
|
|
<DT><CODE>ASM_OUTPUT_LOCAL (<VAR>stream</VAR>, <VAR>name</VAR>, <VAR>size</VAR>, <VAR>rounded</VAR>)</CODE>
|
|
<DD>A C statement (sans semicolon) to output to the stdio stream
|
|
<VAR>stream</VAR> the assembler definition of a local-common-label named
|
|
<VAR>name</VAR> whose size is <VAR>size</VAR> bytes. The variable <VAR>rounded</VAR>
|
|
is the size rounded up to whatever alignment the caller wants.
|
|
<P>
|
|
|
|
Use the expression <CODE>assemble_name (<VAR>stream</VAR>, <VAR>name</VAR>)</CODE> to
|
|
output the name itself; before and after that, output the additional
|
|
assembler syntax for defining the name, and a newline.
|
|
</P><P>
|
|
|
|
This macro controls how the assembler definitions of uninitialized
|
|
static variables are output.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1613"></A>
|
|
<DT><CODE>ASM_OUTPUT_ALIGNED_LOCAL (<VAR>stream</VAR>, <VAR>name</VAR>, <VAR>size</VAR>, <VAR>alignment</VAR>)</CODE>
|
|
<DD>Like <CODE>ASM_OUTPUT_LOCAL</CODE> except takes the required alignment as a
|
|
separate, explicit argument. If you define this macro, it is used in
|
|
place of <CODE>ASM_OUTPUT_LOCAL</CODE>, and gives you more flexibility in
|
|
handling the required alignment of the variable. The alignment is specified
|
|
as the number of bits.
|
|
<P>
|
|
|
|
<A NAME="IDX1614"></A>
|
|
<DT><CODE>ASM_OUTPUT_ALIGNED_DECL_LOCAL (<VAR>stream</VAR>, <VAR>decl</VAR>, <VAR>name</VAR>, <VAR>size</VAR>, <VAR>alignment</VAR>)</CODE>
|
|
<DD>Like <CODE>ASM_OUTPUT_ALIGNED_DECL</CODE> except that <VAR>decl</VAR> of the
|
|
variable to be output, if there is one, or <CODE>NULL_TREE</CODE> if there
|
|
is not corresponding variable. If you define this macro, GNU CC wil use it
|
|
in place of both <CODE>ASM_OUTPUT_DECL</CODE> and
|
|
<CODE>ASM_OUTPUT_ALIGNED_DECL</CODE>. Define this macro when you need to see
|
|
the variable's decl in order to chose what to output.
|
|
<P>
|
|
|
|
<A NAME="IDX1615"></A>
|
|
<DT><CODE>ASM_OUTPUT_SHARED_LOCAL (<VAR>stream</VAR>, <VAR>name</VAR>, <VAR>size</VAR>, <VAR>rounded</VAR>)</CODE>
|
|
<DD>If defined, it is similar to <CODE>ASM_OUTPUT_LOCAL</CODE>, except that it
|
|
is used when <VAR>name</VAR> is shared. If not defined, <CODE>ASM_OUTPUT_LOCAL</CODE>
|
|
will be used.
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="Label Output"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC236"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC235" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC235"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC237" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC237"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC237" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC237"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC232" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC232"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC243" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC243"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H3> 17.16.4 Output and Generation of Labels </H3>
|
|
<!--docid::SEC236::-->
|
|
<P>
|
|
|
|
This is about outputting labels.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1616"></A>
|
|
<A NAME="IDX1617"></A>
|
|
<DT><CODE>ASM_OUTPUT_LABEL (<VAR>stream</VAR>, <VAR>name</VAR>)</CODE>
|
|
<DD>A C statement (sans semicolon) to output to the stdio stream
|
|
<VAR>stream</VAR> the assembler definition of a label named <VAR>name</VAR>.
|
|
Use the expression <CODE>assemble_name (<VAR>stream</VAR>, <VAR>name</VAR>)</CODE> to
|
|
output the name itself; before and after that, output the additional
|
|
assembler syntax for defining the name, and a newline.
|
|
<P>
|
|
|
|
<A NAME="IDX1618"></A>
|
|
<DT><CODE>ASM_DECLARE_FUNCTION_NAME (<VAR>stream</VAR>, <VAR>name</VAR>, <VAR>decl</VAR>)</CODE>
|
|
<DD>A C statement (sans semicolon) to output to the stdio stream
|
|
<VAR>stream</VAR> any text necessary for declaring the name <VAR>name</VAR> of a
|
|
function which is being defined. This macro is responsible for
|
|
outputting the label definition (perhaps using
|
|
<CODE>ASM_OUTPUT_LABEL</CODE>). The argument <VAR>decl</VAR> is the
|
|
<CODE>FUNCTION_DECL</CODE> tree node representing the function.
|
|
<P>
|
|
|
|
If this macro is not defined, then the function name is defined in the
|
|
usual manner as a label (by means of <CODE>ASM_OUTPUT_LABEL</CODE>).
|
|
</P><P>
|
|
|
|
<A NAME="IDX1619"></A>
|
|
<DT><CODE>ASM_DECLARE_FUNCTION_SIZE (<VAR>stream</VAR>, <VAR>name</VAR>, <VAR>decl</VAR>)</CODE>
|
|
<DD>A C statement (sans semicolon) to output to the stdio stream
|
|
<VAR>stream</VAR> any text necessary for declaring the size of a function
|
|
which is being defined. The argument <VAR>name</VAR> is the name of the
|
|
function. The argument <VAR>decl</VAR> is the <CODE>FUNCTION_DECL</CODE> tree node
|
|
representing the function.
|
|
<P>
|
|
|
|
If this macro is not defined, then the function size is not defined.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1620"></A>
|
|
<DT><CODE>ASM_DECLARE_OBJECT_NAME (<VAR>stream</VAR>, <VAR>name</VAR>, <VAR>decl</VAR>)</CODE>
|
|
<DD>A C statement (sans semicolon) to output to the stdio stream
|
|
<VAR>stream</VAR> any text necessary for declaring the name <VAR>name</VAR> of an
|
|
initialized variable which is being defined. This macro must output the
|
|
label definition (perhaps using <CODE>ASM_OUTPUT_LABEL</CODE>). The argument
|
|
<VAR>decl</VAR> is the <CODE>VAR_DECL</CODE> tree node representing the variable.
|
|
<P>
|
|
|
|
If this macro is not defined, then the variable name is defined in the
|
|
usual manner as a label (by means of <CODE>ASM_OUTPUT_LABEL</CODE>).
|
|
</P><P>
|
|
|
|
<A NAME="IDX1621"></A>
|
|
<DT><CODE>ASM_FINISH_DECLARE_OBJECT (<VAR>stream</VAR>, <VAR>decl</VAR>, <VAR>toplevel</VAR>, <VAR>atend</VAR>)</CODE>
|
|
<DD>A C statement (sans semicolon) to finish up declaring a variable name
|
|
once the compiler has processed its initializer fully and thus has had a
|
|
chance to determine the size of an array when controlled by an
|
|
initializer. This is used on systems where it's necessary to declare
|
|
something about the size of the object.
|
|
<P>
|
|
|
|
If you don't define this macro, that is equivalent to defining it to do
|
|
nothing.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1622"></A>
|
|
<DT><CODE>ASM_GLOBALIZE_LABEL (<VAR>stream</VAR>, <VAR>name</VAR>)</CODE>
|
|
<DD>A C statement (sans semicolon) to output to the stdio stream
|
|
<VAR>stream</VAR> some commands that will make the label <VAR>name</VAR> global;
|
|
that is, available for reference from other files. Use the expression
|
|
<CODE>assemble_name (<VAR>stream</VAR>, <VAR>name</VAR>)</CODE> to output the name
|
|
itself; before and after that, output the additional assembler syntax
|
|
for making that name global, and a newline.
|
|
<P>
|
|
|
|
<A NAME="IDX1623"></A>
|
|
<DT><CODE>ASM_WEAKEN_LABEL</CODE>
|
|
<DD>A C statement (sans semicolon) to output to the stdio stream
|
|
<VAR>stream</VAR> some commands that will make the label <VAR>name</VAR> weak;
|
|
that is, available for reference from other files but only used if
|
|
no other definition is available. Use the expression
|
|
<CODE>assemble_name (<VAR>stream</VAR>, <VAR>name</VAR>)</CODE> to output the name
|
|
itself; before and after that, output the additional assembler syntax
|
|
for making that name weak, and a newline.
|
|
<P>
|
|
|
|
If you don't define this macro, GNU CC will not support weak
|
|
symbols and you should not define the <CODE>SUPPORTS_WEAK</CODE> macro.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1624"></A>
|
|
<DT><CODE>SUPPORTS_WEAK</CODE>
|
|
<DD>A C expression which evaluates to true if the target supports weak symbols.
|
|
<P>
|
|
|
|
If you don't define this macro, <TT>`defaults.h'</TT> provides a default
|
|
definition. If <CODE>ASM_WEAKEN_LABEL</CODE> is defined, the default
|
|
definition is <SAMP>`1'</SAMP>; otherwise, it is <SAMP>`0'</SAMP>. Define this macro if
|
|
you want to control weak symbol support with a compiler flag such as
|
|
<SAMP>`-melf'</SAMP>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1625"></A>
|
|
<DT><CODE>MAKE_DECL_ONE_ONLY</CODE>
|
|
<DD>A C statement (sans semicolon) to mark <VAR>decl</VAR> to be emitted as a
|
|
public symbol such that extra copies in multiple translation units will
|
|
be discarded by the linker. Define this macro if your object file
|
|
format provides support for this concept, such as the <SAMP>`COMDAT'</SAMP>
|
|
section flags in the Microsoft Windows PE/COFF format, and this support
|
|
requires changes to <VAR>decl</VAR>, such as putting it in a separate section.
|
|
<P>
|
|
|
|
<A NAME="IDX1626"></A>
|
|
<DT><CODE>SUPPORTS_ONE_ONLY</CODE>
|
|
<DD>A C expression which evaluates to true if the target supports one-only
|
|
semantics.
|
|
<P>
|
|
|
|
If you don't define this macro, <TT>`varasm.c'</TT> provides a default
|
|
definition. If <CODE>MAKE_DECL_ONE_ONLY</CODE> is defined, the default
|
|
definition is <SAMP>`1'</SAMP>; otherwise, it is <SAMP>`0'</SAMP>. Define this macro if
|
|
you want to control one-only symbol support with a compiler flag, or if
|
|
setting the <CODE>DECL_ONE_ONLY</CODE> flag is enough to mark a declaration to
|
|
be emitted as one-only.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1627"></A>
|
|
<DT><CODE>ASM_OUTPUT_EXTERNAL (<VAR>stream</VAR>, <VAR>decl</VAR>, <VAR>name</VAR>)</CODE>
|
|
<DD>A C statement (sans semicolon) to output to the stdio stream
|
|
<VAR>stream</VAR> any text necessary for declaring the name of an external
|
|
symbol named <VAR>name</VAR> which is referenced in this compilation but
|
|
not defined. The value of <VAR>decl</VAR> is the tree node for the
|
|
declaration.
|
|
<P>
|
|
|
|
This macro need not be defined if it does not need to output anything.
|
|
The GNU assembler and most Unix assemblers don't require anything.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1628"></A>
|
|
<DT><CODE>ASM_OUTPUT_EXTERNAL_LIBCALL (<VAR>stream</VAR>, <VAR>symref</VAR>)</CODE>
|
|
<DD>A C statement (sans semicolon) to output on <VAR>stream</VAR> an assembler
|
|
pseudo-op to declare a library function name external. The name of the
|
|
library function is given by <VAR>symref</VAR>, which has type <CODE>rtx</CODE> and
|
|
is a <CODE>symbol_ref</CODE>.
|
|
<P>
|
|
|
|
This macro need not be defined if it does not need to output anything.
|
|
The GNU assembler and most Unix assemblers don't require anything.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1629"></A>
|
|
<DT><CODE>ASM_OUTPUT_LABELREF (<VAR>stream</VAR>, <VAR>name</VAR>)</CODE>
|
|
<DD>A C statement (sans semicolon) to output to the stdio stream
|
|
<VAR>stream</VAR> a reference in assembler syntax to a label named
|
|
<VAR>name</VAR>. This should add <SAMP>`_'</SAMP> to the front of the name, if that
|
|
is customary on your operating system, as it is in most Berkeley Unix
|
|
systems. This macro is used in <CODE>assemble_name</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX1630"></A>
|
|
<DT><CODE>ASM_OUTPUT_INTERNAL_LABEL (<VAR>stream</VAR>, <VAR>prefix</VAR>, <VAR>num</VAR>)</CODE>
|
|
<DD>A C statement to output to the stdio stream <VAR>stream</VAR> a label whose
|
|
name is made from the string <VAR>prefix</VAR> and the number <VAR>num</VAR>.
|
|
<P>
|
|
|
|
It is absolutely essential that these labels be distinct from the labels
|
|
used for user-level functions and variables. Otherwise, certain programs
|
|
will have name conflicts with internal labels.
|
|
</P><P>
|
|
|
|
It is desirable to exclude internal labels from the symbol table of the
|
|
object file. Most assemblers have a naming convention for labels that
|
|
should be excluded; on many systems, the letter <SAMP>`L'</SAMP> at the
|
|
beginning of a label has this effect. You should find out what
|
|
convention your system uses, and follow it.
|
|
</P><P>
|
|
|
|
The usual definition of this macro is as follows:
|
|
</P><P>
|
|
|
|
<TABLE><tr><td> </td><td class=example><pre>fprintf (<VAR>stream</VAR>, "L%s%d:\n", <VAR>prefix</VAR>, <VAR>num</VAR>)
|
|
</pre></td></tr></table></P><P>
|
|
|
|
<A NAME="IDX1631"></A>
|
|
<DT><CODE>ASM_GENERATE_INTERNAL_LABEL (<VAR>string</VAR>, <VAR>prefix</VAR>, <VAR>num</VAR>)</CODE>
|
|
<DD>A C statement to store into the string <VAR>string</VAR> a label whose name
|
|
is made from the string <VAR>prefix</VAR> and the number <VAR>num</VAR>.
|
|
<P>
|
|
|
|
This string, when output subsequently by <CODE>assemble_name</CODE>, should
|
|
produce the output that <CODE>ASM_OUTPUT_INTERNAL_LABEL</CODE> would produce
|
|
with the same <VAR>prefix</VAR> and <VAR>num</VAR>.
|
|
</P><P>
|
|
|
|
If the string begins with <SAMP>`*'</SAMP>, then <CODE>assemble_name</CODE> will
|
|
output the rest of the string unchanged. It is often convenient for
|
|
<CODE>ASM_GENERATE_INTERNAL_LABEL</CODE> to use <SAMP>`*'</SAMP> in this way. If the
|
|
string doesn't start with <SAMP>`*'</SAMP>, then <CODE>ASM_OUTPUT_LABELREF</CODE> gets
|
|
to output the string, and may change it. (Of course,
|
|
<CODE>ASM_OUTPUT_LABELREF</CODE> is also part of your machine description, so
|
|
you should know what it does on your machine.)
|
|
</P><P>
|
|
|
|
<A NAME="IDX1632"></A>
|
|
<DT><CODE>ASM_FORMAT_PRIVATE_NAME (<VAR>outvar</VAR>, <VAR>name</VAR>, <VAR>number</VAR>)</CODE>
|
|
<DD>A C expression to assign to <VAR>outvar</VAR> (which is a variable of type
|
|
<CODE>char *</CODE>) a newly allocated string made from the string
|
|
<VAR>name</VAR> and the number <VAR>number</VAR>, with some suitable punctuation
|
|
added. Use <CODE>alloca</CODE> to get space for the string.
|
|
<P>
|
|
|
|
The string will be used as an argument to <CODE>ASM_OUTPUT_LABELREF</CODE> to
|
|
produce an assembler label for an internal static variable whose name is
|
|
<VAR>name</VAR>. Therefore, the string must be such as to result in valid
|
|
assembler code. The argument <VAR>number</VAR> is different each time this
|
|
macro is executed; it prevents conflicts between similarly-named
|
|
internal static variables in different scopes.
|
|
</P><P>
|
|
|
|
Ideally this string should not be a valid C identifier, to prevent any
|
|
conflict with the user's own symbols. Most assemblers allow periods
|
|
or percent signs in assembler symbols; putting at least one of these
|
|
between the name and the number will suffice.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1633"></A>
|
|
<DT><CODE>ASM_OUTPUT_DEF (<VAR>stream</VAR>, <VAR>name</VAR>, <VAR>value</VAR>)</CODE>
|
|
<DD>A C statement to output to the stdio stream <VAR>stream</VAR> assembler code
|
|
which defines (equates) the symbol <VAR>name</VAR> to have the value <VAR>value</VAR>.
|
|
<P>
|
|
|
|
If SET_ASM_OP is defined, a default definition is provided which is
|
|
correct for most systems.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1634"></A>
|
|
<DT><CODE>ASM_OUTPUT_DEFINE_LABEL_DIFFERENCE_SYMBOL (<VAR>stream</VAR>, <VAR>symbol</VAR>, <VAR>high</VAR>, <VAR>low</VAR>)</CODE>
|
|
<DD>A C statement to output to the stdio stream <VAR>stream</VAR> assembler code
|
|
which defines (equates) the symbol <VAR>symbol</VAR> to have a value equal to
|
|
the difference of the two symbols <VAR>high</VAR> and <VAR>low</VAR>, i.e.
|
|
<VAR>high</VAR> minus <VAR>low</VAR>. GNU CC guarantees that the symbols <VAR>high</VAR>
|
|
and <VAR>low</VAR> are already known by the assembler so that the difference
|
|
resolves into a constant.
|
|
<P>
|
|
|
|
If SET_ASM_OP is defined, a default definition is provided which is
|
|
correct for most systems.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1635"></A>
|
|
<DT><CODE>ASM_OUTPUT_WEAK_ALIAS (<VAR>stream</VAR>, <VAR>name</VAR>, <VAR>value</VAR>)</CODE>
|
|
<DD>A C statement to output to the stdio stream <VAR>stream</VAR> assembler code
|
|
which defines (equates) the weak symbol <VAR>name</VAR> to have the value
|
|
<VAR>value</VAR>.
|
|
<P>
|
|
|
|
Define this macro if the target only supports weak aliases; define
|
|
ASM_OUTPUT_DEF instead if possible.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1636"></A>
|
|
<DT><CODE>OBJC_GEN_METHOD_LABEL (<VAR>buf</VAR>, <VAR>is_inst</VAR>, <VAR>class_name</VAR>, <VAR>cat_name</VAR>, <VAR>sel_name</VAR>)</CODE>
|
|
<DD>Define this macro to override the default assembler names used for
|
|
Objective C methods.
|
|
<P>
|
|
|
|
The default name is a unique method number followed by the name of the
|
|
class (e.g. <SAMP>`_1_Foo'</SAMP>). For methods in categories, the name of
|
|
the category is also included in the assembler name (e.g.
|
|
<SAMP>`_1_Foo_Bar'</SAMP>).
|
|
</P><P>
|
|
|
|
These names are safe on most systems, but make debugging difficult since
|
|
the method's selector is not present in the name. Therefore, particular
|
|
systems define other ways of computing names.
|
|
</P><P>
|
|
|
|
<VAR>buf</VAR> is an expression of type <CODE>char *</CODE> which gives you a
|
|
buffer in which to store the name; its length is as long as
|
|
<VAR>class_name</VAR>, <VAR>cat_name</VAR> and <VAR>sel_name</VAR> put together, plus
|
|
50 characters extra.
|
|
</P><P>
|
|
|
|
The argument <VAR>is_inst</VAR> specifies whether the method is an instance
|
|
method or a class method; <VAR>class_name</VAR> is the name of the class;
|
|
<VAR>cat_name</VAR> is the name of the category (or NULL if the method is not
|
|
in a category); and <VAR>sel_name</VAR> is the name of the selector.
|
|
</P><P>
|
|
|
|
On systems where the assembler can handle quoted names, you can use this
|
|
macro to provide more human-readable names.
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="Initialization"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC237"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC236" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC236"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC238" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC238"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC238" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC238"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC232" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC232"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC243" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC243"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H3> 17.16.5 How Initialization Functions Are Handled </H3>
|
|
<!--docid::SEC237::-->
|
|
<P>
|
|
|
|
The compiled code for certain languages includes <EM>constructors</EM>
|
|
(also called <EM>initialization routines</EM>)---functions to initialize
|
|
data in the program when the program is started. These functions need
|
|
to be called before the program is "started"---that is to say, before
|
|
<CODE>main</CODE> is called.
|
|
</P><P>
|
|
|
|
Compiling some languages generates <EM>destructors</EM> (also called
|
|
<EM>termination routines</EM>) that should be called when the program
|
|
terminates.
|
|
</P><P>
|
|
|
|
To make the initialization and termination functions work, the compiler
|
|
must output something in the assembler code to cause those functions to
|
|
be called at the appropriate time. When you port the compiler to a new
|
|
system, you need to specify how to do this.
|
|
</P><P>
|
|
|
|
There are two major ways that GCC currently supports the execution of
|
|
initialization and termination functions. Each way has two variants.
|
|
Much of the structure is common to all four variations.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1637"></A>
|
|
<A NAME="IDX1638"></A>
|
|
The linker must build two lists of these functions--a list of
|
|
initialization functions, called <CODE>__CTOR_LIST__</CODE>, and a list of
|
|
termination functions, called <CODE>__DTOR_LIST__</CODE>.
|
|
</P><P>
|
|
|
|
Each list always begins with an ignored function pointer (which may hold
|
|
0, -1, or a count of the function pointers after it, depending on
|
|
the environment). This is followed by a series of zero or more function
|
|
pointers to constructors (or destructors), followed by a function
|
|
pointer containing zero.
|
|
</P><P>
|
|
|
|
Depending on the operating system and its executable file format, either
|
|
<TT>`crtstuff.c'</TT> or <TT>`libgcc2.c'</TT> traverses these lists at startup
|
|
time and exit time. Constructors are called in reverse order of the
|
|
list; destructors in forward order.
|
|
</P><P>
|
|
|
|
The best way to handle static constructors works only for object file
|
|
formats which provide arbitrarily-named sections. A section is set
|
|
aside for a list of constructors, and another for a list of destructors.
|
|
Traditionally these are called <SAMP>`.ctors'</SAMP> and <SAMP>`.dtors'</SAMP>. Each
|
|
object file that defines an initialization function also puts a word in
|
|
the constructor section to point to that function. The linker
|
|
accumulates all these words into one contiguous <SAMP>`.ctors'</SAMP> section.
|
|
Termination functions are handled similarly.
|
|
</P><P>
|
|
|
|
To use this method, you need appropriate definitions of the macros
|
|
<CODE>ASM_OUTPUT_CONSTRUCTOR</CODE> and <CODE>ASM_OUTPUT_DESTRUCTOR</CODE>. Usually
|
|
you can get them by including <TT>`svr4.h'</TT>.
|
|
</P><P>
|
|
|
|
When arbitrary sections are available, there are two variants, depending
|
|
upon how the code in <TT>`crtstuff.c'</TT> is called. On systems that
|
|
support an <EM>init</EM> section which is executed at program startup,
|
|
parts of <TT>`crtstuff.c'</TT> are compiled into that section. The
|
|
program is linked by the <CODE>gcc</CODE> driver like this:
|
|
</P><P>
|
|
|
|
<TABLE><tr><td> </td><td class=example><pre>ld -o <VAR>output_file</VAR> crtbegin.o <small>...</small> crtend.o -lgcc
|
|
</pre></td></tr></table></P><P>
|
|
|
|
The head of a function (<CODE>__do_global_ctors</CODE>) appears in the init
|
|
section of <TT>`crtbegin.o'</TT>; the remainder of the function appears in
|
|
the init section of <TT>`crtend.o'</TT>. The linker will pull these two
|
|
parts of the section together, making a whole function. If any of the
|
|
user's object files linked into the middle of it contribute code, then that
|
|
code will be executed as part of the body of <CODE>__do_global_ctors</CODE>.
|
|
</P><P>
|
|
|
|
To use this variant, you must define the <CODE>INIT_SECTION_ASM_OP</CODE>
|
|
macro properly.
|
|
</P><P>
|
|
|
|
If no init section is available, do not define
|
|
<CODE>INIT_SECTION_ASM_OP</CODE>. Then <CODE>__do_global_ctors</CODE> is built into
|
|
the text section like all other functions, and resides in
|
|
<TT>`libgcc.a'</TT>. When GCC compiles any function called <CODE>main</CODE>, it
|
|
inserts a procedure call to <CODE>__main</CODE> as the first executable code
|
|
after the function prologue. The <CODE>__main</CODE> function, also defined
|
|
in <TT>`libgcc2.c'</TT>, simply calls <TT>`__do_global_ctors'</TT>.
|
|
</P><P>
|
|
|
|
In file formats that don't support arbitrary sections, there are again
|
|
two variants. In the simplest variant, the GNU linker (GNU <CODE>ld</CODE>)
|
|
and an `a.out' format must be used. In this case,
|
|
<CODE>ASM_OUTPUT_CONSTRUCTOR</CODE> is defined to produce a <CODE>.stabs</CODE>
|
|
entry of type <SAMP>`N_SETT'</SAMP>, referencing the name <CODE>__CTOR_LIST__</CODE>,
|
|
and with the address of the void function containing the initialization
|
|
code as its value. The GNU linker recognizes this as a request to add
|
|
the value to a "set"; the values are accumulated, and are eventually
|
|
placed in the executable as a vector in the format described above, with
|
|
a leading (ignored) count and a trailing zero element.
|
|
<CODE>ASM_OUTPUT_DESTRUCTOR</CODE> is handled similarly. Since no init
|
|
section is available, the absence of <CODE>INIT_SECTION_ASM_OP</CODE> causes
|
|
the compilation of <CODE>main</CODE> to call <CODE>__main</CODE> as above, starting
|
|
the initialization process.
|
|
</P><P>
|
|
|
|
The last variant uses neither arbitrary sections nor the GNU linker.
|
|
This is preferable when you want to do dynamic linking and when using
|
|
file formats which the GNU linker does not support, such as `ECOFF'. In
|
|
this case, <CODE>ASM_OUTPUT_CONSTRUCTOR</CODE> does not produce an
|
|
<CODE>N_SETT</CODE> symbol; initialization and termination functions are
|
|
recognized simply by their names. This requires an extra program in the
|
|
linkage step, called <CODE>collect2</CODE>. This program pretends to be the
|
|
linker, for use with GNU CC; it does its job by running the ordinary
|
|
linker, but also arranges to include the vectors of initialization and
|
|
termination functions. These functions are called via <CODE>__main</CODE> as
|
|
described above.
|
|
</P><P>
|
|
|
|
Choosing among these configuration options has been simplified by a set
|
|
of operating-system-dependent files in the <TT>`config'</TT> subdirectory.
|
|
These files define all of the relevant parameters. Usually it is
|
|
sufficient to include one into your specific machine-dependent
|
|
configuration file. These files are:
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<DT><TT>`aoutos.h'</TT>
|
|
<DD>For operating systems using the `a.out' format.
|
|
<P>
|
|
|
|
<DT><TT>`next.h'</TT>
|
|
<DD>For operating systems using the `MachO' format.
|
|
<P>
|
|
|
|
<DT><TT>`svr3.h'</TT>
|
|
<DD>For System V Release 3 and similar systems using `COFF' format.
|
|
<P>
|
|
|
|
<DT><TT>`svr4.h'</TT>
|
|
<DD>For System V Release 4 and similar systems using `ELF' format.
|
|
<P>
|
|
|
|
<DT><TT>`vms.h'</TT>
|
|
<DD>For the VMS operating system.
|
|
</DL>
|
|
<P>
|
|
|
|
The following section describes the specific macros that control and
|
|
customize the handling of initialization and termination functions.
|
|
</P><P>
|
|
|
|
<A NAME="Macros for Initialization"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC238"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC237" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC237"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC239" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC239"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC239" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC239"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC232" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC232"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC243" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC243"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H3> 17.16.6 Macros Controlling Initialization Routines </H3>
|
|
<!--docid::SEC238::-->
|
|
<P>
|
|
|
|
Here are the macros that control how the compiler handles initialization
|
|
and termination functions:
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1639"></A>
|
|
<DT><CODE>INIT_SECTION_ASM_OP</CODE>
|
|
<DD>If defined, a C string constant for the assembler operation to identify
|
|
the following data as initialization code. If not defined, GNU CC will
|
|
assume such a section does not exist. When you are using special
|
|
sections for initialization and termination functions, this macro also
|
|
controls how <TT>`crtstuff.c'</TT> and <TT>`libgcc2.c'</TT> arrange to run the
|
|
initialization functions.
|
|
<P>
|
|
|
|
<DT><CODE>HAS_INIT_SECTION</CODE>
|
|
<DD><A NAME="IDX1640"></A>
|
|
If defined, <CODE>main</CODE> will not call <CODE>__main</CODE> as described above.
|
|
This macro should be defined for systems that control the contents of the
|
|
init section on a symbol-by-symbol basis, such as OSF/1, and should not
|
|
be defined explicitly for systems that support
|
|
<CODE>INIT_SECTION_ASM_OP</CODE>.
|
|
<P>
|
|
|
|
<DT><CODE>LD_INIT_SWITCH</CODE>
|
|
<DD><A NAME="IDX1641"></A>
|
|
If defined, a C string constant for a switch that tells the linker that
|
|
the following symbol is an initialization routine.
|
|
<P>
|
|
|
|
<DT><CODE>LD_FINI_SWITCH</CODE>
|
|
<DD><A NAME="IDX1642"></A>
|
|
If defined, a C string constant for a switch that tells the linker that
|
|
the following symbol is a finalization routine.
|
|
<P>
|
|
|
|
<DT><CODE>INVOKE__main</CODE>
|
|
<DD><A NAME="IDX1643"></A>
|
|
If defined, <CODE>main</CODE> will call <CODE>__main</CODE> despite the presence of
|
|
<CODE>INIT_SECTION_ASM_OP</CODE>. This macro should be defined for systems
|
|
where the init section is not actually run automatically, but is still
|
|
useful for collecting the lists of constructors and destructors.
|
|
<P>
|
|
|
|
<DT><CODE>ASM_OUTPUT_CONSTRUCTOR (<VAR>stream</VAR>, <VAR>name</VAR>)</CODE>
|
|
<DD><A NAME="IDX1644"></A>
|
|
Define this macro as a C statement to output on the stream <VAR>stream</VAR>
|
|
the assembler code to arrange to call the function named <VAR>name</VAR> at
|
|
initialization time.
|
|
<P>
|
|
|
|
Assume that <VAR>name</VAR> is the name of a C function generated
|
|
automatically by the compiler. This function takes no arguments. Use
|
|
the function <CODE>assemble_name</CODE> to output the name <VAR>name</VAR>; this
|
|
performs any system-specific syntactic transformations such as adding an
|
|
underscore.
|
|
</P><P>
|
|
|
|
If you don't define this macro, nothing special is output to arrange to
|
|
call the function. This is correct when the function will be called in
|
|
some other manner--for example, by means of the <CODE>collect2</CODE> program,
|
|
which looks through the symbol table to find these functions by their
|
|
names.
|
|
</P><P>
|
|
|
|
<DT><CODE>ASM_OUTPUT_DESTRUCTOR (<VAR>stream</VAR>, <VAR>name</VAR>)</CODE>
|
|
<DD><A NAME="IDX1645"></A>
|
|
This is like <CODE>ASM_OUTPUT_CONSTRUCTOR</CODE> but used for termination
|
|
functions rather than initialization functions.
|
|
<P>
|
|
|
|
When <CODE>ASM_OUTPUT_CONSTRUCTOR</CODE> and <CODE>ASM_OUTPUT_DESTRUCTOR</CODE> are
|
|
defined, the initializaiton routine generated for the generated object
|
|
file will have static linkage.
|
|
</DL>
|
|
<P>
|
|
|
|
If your system uses <CODE>collect2</CODE> as the means of processing
|
|
constructors, then that program normally uses <CODE>nm</CODE> to scan an
|
|
object file for constructor functions to be called. On such systems you
|
|
must not define <CODE>ASM_OUTPUT_CONSTRUCTOR</CODE> and <CODE>ASM_OUTPUT_DESTRUCTOR</CODE>
|
|
as the object file's initialization routine must have global scope.
|
|
</P><P>
|
|
|
|
On certain kinds of systems, you can define these macros to make
|
|
<CODE>collect2</CODE> work faster (and, in some cases, make it work at all):
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1646"></A>
|
|
<DT><CODE>OBJECT_FORMAT_COFF</CODE>
|
|
<DD>Define this macro if the system uses COFF (Common Object File Format)
|
|
object files, so that <CODE>collect2</CODE> can assume this format and scan
|
|
object files directly for dynamic constructor/destructor functions.
|
|
<P>
|
|
|
|
<A NAME="IDX1647"></A>
|
|
<DT><CODE>OBJECT_FORMAT_ROSE</CODE>
|
|
<DD>Define this macro if the system uses ROSE format object files, so that
|
|
<CODE>collect2</CODE> can assume this format and scan object files directly
|
|
for dynamic constructor/destructor functions.
|
|
<P>
|
|
|
|
These macros are effective only in a native compiler; <CODE>collect2</CODE> as
|
|
part of a cross compiler always uses <CODE>nm</CODE> for the target machine.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1648"></A>
|
|
<DT><CODE>REAL_NM_FILE_NAME</CODE>
|
|
<DD>Define this macro as a C string constant containing the file name to use
|
|
to execute <CODE>nm</CODE>. The default is to search the path normally for
|
|
<CODE>nm</CODE>.
|
|
<P>
|
|
|
|
If your system supports shared libraries and has a program to list the
|
|
dynamic dependencies of a given library or executable, you can define
|
|
these macros to enable support for running initialization and
|
|
termination functions in shared libraries:
|
|
</P><P>
|
|
|
|
<A NAME="IDX1649"></A>
|
|
<DT><CODE>LDD_SUFFIX</CODE>
|
|
<DD>Define this macro to a C string constant containing the name of the
|
|
program which lists dynamic dependencies, like <CODE>"ldd"</CODE> under SunOS 4.
|
|
<P>
|
|
|
|
<A NAME="IDX1650"></A>
|
|
<DT><CODE>PARSE_LDD_OUTPUT (<VAR>PTR</VAR>)</CODE>
|
|
<DD>Define this macro to be C code that extracts filenames from the output
|
|
of the program denoted by <CODE>LDD_SUFFIX</CODE>. <VAR>PTR</VAR> is a variable
|
|
of type <CODE>char *</CODE> that points to the beginning of a line of output
|
|
from <CODE>LDD_SUFFIX</CODE>. If the line lists a dynamic dependency, the
|
|
code must advance <VAR>PTR</VAR> to the beginning of the filename on that
|
|
line. Otherwise, it must set <VAR>PTR</VAR> to <CODE>NULL</CODE>.
|
|
<P>
|
|
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="Instruction Output"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC239"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC238" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC238"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC240" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC240"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC240" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC240"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC232" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC232"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC243" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC243"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H3> 17.16.7 Output of Assembler Instructions </H3>
|
|
<!--docid::SEC239::-->
|
|
<P>
|
|
|
|
This describes assembler instruction output.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1651"></A>
|
|
<DT><CODE>REGISTER_NAMES</CODE>
|
|
<DD>A C initializer containing the assembler's names for the machine
|
|
registers, each one as a C string constant. This is what translates
|
|
register numbers in the compiler into assembler language.
|
|
<P>
|
|
|
|
<A NAME="IDX1652"></A>
|
|
<DT><CODE>ADDITIONAL_REGISTER_NAMES</CODE>
|
|
<DD>If defined, a C initializer for an array of structures containing a name
|
|
and a register number. This macro defines additional names for hard
|
|
registers, thus allowing the <CODE>asm</CODE> option in declarations to refer
|
|
to registers using alternate names.
|
|
<P>
|
|
|
|
<A NAME="IDX1653"></A>
|
|
<DT><CODE>ASM_OUTPUT_OPCODE (<VAR>stream</VAR>, <VAR>ptr</VAR>)</CODE>
|
|
<DD>Define this macro if you are using an unusual assembler that
|
|
requires different names for the machine instructions.
|
|
<P>
|
|
|
|
The definition is a C statement or statements which output an
|
|
assembler instruction opcode to the stdio stream <VAR>stream</VAR>. The
|
|
macro-operand <VAR>ptr</VAR> is a variable of type <CODE>char *</CODE> which
|
|
points to the opcode name in its "internal" form--the form that is
|
|
written in the machine description. The definition should output the
|
|
opcode name to <VAR>stream</VAR>, performing any translation you desire, and
|
|
increment the variable <VAR>ptr</VAR> to point at the end of the opcode
|
|
so that it will not be output twice.
|
|
</P><P>
|
|
|
|
In fact, your macro definition may process less than the entire opcode
|
|
name, or more than the opcode name; but if you want to process text
|
|
that includes <SAMP>`%'</SAMP>-sequences to substitute operands, you must take
|
|
care of the substitution yourself. Just be sure to increment
|
|
<VAR>ptr</VAR> over whatever text should not be output normally.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1654"></A>
|
|
If you need to look at the operand values, they can be found as the
|
|
elements of <CODE>recog_operand</CODE>.
|
|
</P><P>
|
|
|
|
If the macro definition does nothing, the instruction is output
|
|
in the usual way.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1655"></A>
|
|
<DT><CODE>FINAL_PRESCAN_INSN (<VAR>insn</VAR>, <VAR>opvec</VAR>, <VAR>noperands</VAR>)</CODE>
|
|
<DD>If defined, a C statement to be executed just prior to the output of
|
|
assembler code for <VAR>insn</VAR>, to modify the extracted operands so
|
|
they will be output differently.
|
|
<P>
|
|
|
|
Here the argument <VAR>opvec</VAR> is the vector containing the operands
|
|
extracted from <VAR>insn</VAR>, and <VAR>noperands</VAR> is the number of
|
|
elements of the vector which contain meaningful data for this insn.
|
|
The contents of this vector are what will be used to convert the insn
|
|
template into assembler code, so you can change the assembler output
|
|
by changing the contents of the vector.
|
|
</P><P>
|
|
|
|
This macro is useful when various assembler syntaxes share a single
|
|
file of instruction patterns; by defining this macro differently, you
|
|
can cause a large class of instructions to be output differently (such
|
|
as with rearranged operands). Naturally, variations in assembler
|
|
syntax affecting individual insn patterns ought to be handled by
|
|
writing conditional output routines in those patterns.
|
|
</P><P>
|
|
|
|
If this macro is not defined, it is equivalent to a null statement.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1656"></A>
|
|
<DT><CODE>FINAL_PRESCAN_LABEL</CODE>
|
|
<DD>If defined, <CODE>FINAL_PRESCAN_INSN</CODE> will be called on each
|
|
<CODE>CODE_LABEL</CODE>. In that case, <VAR>opvec</VAR> will be a null pointer and
|
|
<VAR>noperands</VAR> will be zero.
|
|
<P>
|
|
|
|
<A NAME="IDX1657"></A>
|
|
<DT><CODE>PRINT_OPERAND (<VAR>stream</VAR>, <VAR>x</VAR>, <VAR>code</VAR>)</CODE>
|
|
<DD>A C compound statement to output to stdio stream <VAR>stream</VAR> the
|
|
assembler syntax for an instruction operand <VAR>x</VAR>. <VAR>x</VAR> is an
|
|
RTL expression.
|
|
<P>
|
|
|
|
<VAR>code</VAR> is a value that can be used to specify one of several ways
|
|
of printing the operand. It is used when identical operands must be
|
|
printed differently depending on the context. <VAR>code</VAR> comes from
|
|
the <SAMP>`%'</SAMP> specification that was used to request printing of the
|
|
operand. If the specification was just <SAMP>`%<VAR>digit</VAR>'</SAMP> then
|
|
<VAR>code</VAR> is 0; if the specification was <SAMP>`%<VAR>ltr</VAR>
|
|
<VAR>digit</VAR>'</SAMP> then <VAR>code</VAR> is the ASCII code for <VAR>ltr</VAR>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1658"></A>
|
|
If <VAR>x</VAR> is a register, this macro should print the register's name.
|
|
The names can be found in an array <CODE>reg_names</CODE> whose type is
|
|
<CODE>char *[]</CODE>. <CODE>reg_names</CODE> is initialized from
|
|
<CODE>REGISTER_NAMES</CODE>.
|
|
</P><P>
|
|
|
|
When the machine description has a specification <SAMP>`%<VAR>punct</VAR>'</SAMP>
|
|
(a <SAMP>`%'</SAMP> followed by a punctuation character), this macro is called
|
|
with a null pointer for <VAR>x</VAR> and the punctuation character for
|
|
<VAR>code</VAR>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1659"></A>
|
|
<DT><CODE>PRINT_OPERAND_PUNCT_VALID_P (<VAR>code</VAR>)</CODE>
|
|
<DD>A C expression which evaluates to true if <VAR>code</VAR> is a valid
|
|
punctuation character for use in the <CODE>PRINT_OPERAND</CODE> macro. If
|
|
<CODE>PRINT_OPERAND_PUNCT_VALID_P</CODE> is not defined, it means that no
|
|
punctuation characters (except for the standard one, <SAMP>`%'</SAMP>) are used
|
|
in this way.
|
|
<P>
|
|
|
|
<A NAME="IDX1660"></A>
|
|
<DT><CODE>PRINT_OPERAND_ADDRESS (<VAR>stream</VAR>, <VAR>x</VAR>)</CODE>
|
|
<DD>A C compound statement to output to stdio stream <VAR>stream</VAR> the
|
|
assembler syntax for an instruction operand that is a memory reference
|
|
whose address is <VAR>x</VAR>. <VAR>x</VAR> is an RTL expression.
|
|
<P>
|
|
|
|
<A NAME="IDX1661"></A>
|
|
On some machines, the syntax for a symbolic address depends on the
|
|
section that the address refers to. On these machines, define the macro
|
|
<CODE>ENCODE_SECTION_INFO</CODE> to store the information into the
|
|
<CODE>symbol_ref</CODE>, and then check for it here. See section <A HREF="gcc_17.html#SEC232" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC232">17.16 Defining the Output Assembler Language</A>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1662"></A>
|
|
<A NAME="IDX1663"></A>
|
|
<DT><CODE>DBR_OUTPUT_SEQEND(<VAR>file</VAR>)</CODE>
|
|
<DD>A C statement, to be executed after all slot-filler instructions have
|
|
been output. If necessary, call <CODE>dbr_sequence_length</CODE> to
|
|
determine the number of slots filled in a sequence (zero if not
|
|
currently outputting a sequence), to decide how many no-ops to output,
|
|
or whatever.
|
|
<P>
|
|
|
|
Don't define this macro if it has nothing to do, but it is helpful in
|
|
reading assembly output if the extent of the delay sequence is made
|
|
explicit (e.g. with white space).
|
|
</P><P>
|
|
|
|
<A NAME="IDX1664"></A>
|
|
Note that output routines for instructions with delay slots must be
|
|
prepared to deal with not being output as part of a sequence (i.e.
|
|
when the scheduling pass is not run, or when no slot fillers could be
|
|
found.) The variable <CODE>final_sequence</CODE> is null when not
|
|
processing a sequence, otherwise it contains the <CODE>sequence</CODE> rtx
|
|
being output.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1665"></A>
|
|
<A NAME="IDX1666"></A>
|
|
<A NAME="IDX1667"></A>
|
|
<A NAME="IDX1668"></A>
|
|
<A NAME="IDX1669"></A>
|
|
<DT><CODE>REGISTER_PREFIX</CODE>
|
|
<DD><DT><CODE>LOCAL_LABEL_PREFIX</CODE>
|
|
<DD><DT><CODE>USER_LABEL_PREFIX</CODE>
|
|
<DD><DT><CODE>IMMEDIATE_PREFIX</CODE>
|
|
<DD>If defined, C string expressions to be used for the <SAMP>`%R'</SAMP>, <SAMP>`%L'</SAMP>,
|
|
<SAMP>`%U'</SAMP>, and <SAMP>`%I'</SAMP> options of <CODE>asm_fprintf</CODE> (see
|
|
<TT>`final.c'</TT>). These are useful when a single <TT>`md'</TT> file must
|
|
support multiple assembler formats. In that case, the various <TT>`tm.h'</TT>
|
|
files can define these macros differently.
|
|
<P>
|
|
|
|
<A NAME="IDX1670"></A>
|
|
<DT><CODE>ASSEMBLER_DIALECT</CODE>
|
|
<DD>If your target supports multiple dialects of assembler language (such as
|
|
different opcodes), define this macro as a C expression that gives the
|
|
numeric index of the assembler language dialect to use, with zero as the
|
|
first variant.
|
|
<P>
|
|
|
|
If this macro is defined, you may use constructs of the form
|
|
<SAMP>`{option0|option1|option2<small>...</small>}'</SAMP> in the output
|
|
templates of patterns (see section <A HREF="gcc_16.html#SEC173" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_16.html#SEC173">16.4 Output Templates and Operand Substitution</A>) or in the first argument
|
|
of <CODE>asm_fprintf</CODE>. This construct outputs <SAMP>`option0'</SAMP>,
|
|
<SAMP>`option1'</SAMP> or <SAMP>`option2'</SAMP>, etc., if the value of
|
|
<CODE>ASSEMBLER_DIALECT</CODE> is zero, one or two, etc. Any special
|
|
characters within these strings retain their usual meaning.
|
|
</P><P>
|
|
|
|
If you do not define this macro, the characters <SAMP>`{'</SAMP>, <SAMP>`|'</SAMP> and
|
|
<SAMP>`}'</SAMP> do not have any special meaning when used in templates or
|
|
operands to <CODE>asm_fprintf</CODE>.
|
|
</P><P>
|
|
|
|
Define the macros <CODE>REGISTER_PREFIX</CODE>, <CODE>LOCAL_LABEL_PREFIX</CODE>,
|
|
<CODE>USER_LABEL_PREFIX</CODE> and <CODE>IMMEDIATE_PREFIX</CODE> if you can express
|
|
the variations in assembler language syntax with that mechanism. Define
|
|
<CODE>ASSEMBLER_DIALECT</CODE> and use the <SAMP>`{option0|option1}'</SAMP> syntax
|
|
if the syntax variant are larger and involve such things as different
|
|
opcodes or operand order.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1671"></A>
|
|
<DT><CODE>ASM_OUTPUT_REG_PUSH (<VAR>stream</VAR>, <VAR>regno</VAR>)</CODE>
|
|
<DD>A C expression to output to <VAR>stream</VAR> some assembler code
|
|
which will push hard register number <VAR>regno</VAR> onto the stack.
|
|
The code need not be optimal, since this macro is used only when
|
|
profiling.
|
|
<P>
|
|
|
|
<A NAME="IDX1672"></A>
|
|
<DT><CODE>ASM_OUTPUT_REG_POP (<VAR>stream</VAR>, <VAR>regno</VAR>)</CODE>
|
|
<DD>A C expression to output to <VAR>stream</VAR> some assembler code
|
|
which will pop hard register number <VAR>regno</VAR> off of the stack.
|
|
The code need not be optimal, since this macro is used only when
|
|
profiling.
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="Dispatch Tables"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC240"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC239" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC239"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC241" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC241"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC241" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC241"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC232" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC232"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC243" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC243"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H3> 17.16.8 Output of Dispatch Tables </H3>
|
|
<!--docid::SEC240::-->
|
|
<P>
|
|
|
|
This concerns dispatch tables.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1673"></A>
|
|
<A NAME="IDX1674"></A>
|
|
<DT><CODE>ASM_OUTPUT_ADDR_DIFF_ELT (<VAR>stream</VAR>, <VAR>body</VAR>, <VAR>value</VAR>, <VAR>rel</VAR>)</CODE>
|
|
<DD>A C statement to output to the stdio stream <VAR>stream</VAR> an assembler
|
|
pseudo-instruction to generate a difference between two labels.
|
|
<VAR>value</VAR> and <VAR>rel</VAR> are the numbers of two internal labels. The
|
|
definitions of these labels are output using
|
|
<CODE>ASM_OUTPUT_INTERNAL_LABEL</CODE>, and they must be printed in the same
|
|
way here. For example,
|
|
<P>
|
|
|
|
<TABLE><tr><td> </td><td class=example><pre>fprintf (<VAR>stream</VAR>, "\t.word L%d-L%d\n",
|
|
<VAR>value</VAR>, <VAR>rel</VAR>)
|
|
</pre></td></tr></table></P><P>
|
|
|
|
You must provide this macro on machines where the addresses in a
|
|
dispatch table are relative to the table's own address. If defined, GNU
|
|
CC will also use this macro on all machines when producing PIC.
|
|
<VAR>body</VAR> is the body of the ADDR_DIFF_VEC; it is provided so that the
|
|
mode and flags can be read.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1675"></A>
|
|
<DT><CODE>ASM_OUTPUT_ADDR_VEC_ELT (<VAR>stream</VAR>, <VAR>value</VAR>)</CODE>
|
|
<DD>This macro should be provided on machines where the addresses
|
|
in a dispatch table are absolute.
|
|
<P>
|
|
|
|
The definition should be a C statement to output to the stdio stream
|
|
<VAR>stream</VAR> an assembler pseudo-instruction to generate a reference to
|
|
a label. <VAR>value</VAR> is the number of an internal label whose
|
|
definition is output using <CODE>ASM_OUTPUT_INTERNAL_LABEL</CODE>.
|
|
For example,
|
|
</P><P>
|
|
|
|
<TABLE><tr><td> </td><td class=example><pre>fprintf (<VAR>stream</VAR>, "\t.word L%d\n", <VAR>value</VAR>)
|
|
</pre></td></tr></table></P><P>
|
|
|
|
<A NAME="IDX1676"></A>
|
|
<DT><CODE>ASM_OUTPUT_CASE_LABEL (<VAR>stream</VAR>, <VAR>prefix</VAR>, <VAR>num</VAR>, <VAR>table</VAR>)</CODE>
|
|
<DD>Define this if the label before a jump-table needs to be output
|
|
specially. The first three arguments are the same as for
|
|
<CODE>ASM_OUTPUT_INTERNAL_LABEL</CODE>; the fourth argument is the
|
|
jump-table which follows (a <CODE>jump_insn</CODE> containing an
|
|
<CODE>addr_vec</CODE> or <CODE>addr_diff_vec</CODE>).
|
|
<P>
|
|
|
|
This feature is used on system V to output a <CODE>swbeg</CODE> statement
|
|
for the table.
|
|
</P><P>
|
|
|
|
If this macro is not defined, these labels are output with
|
|
<CODE>ASM_OUTPUT_INTERNAL_LABEL</CODE>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1677"></A>
|
|
<DT><CODE>ASM_OUTPUT_CASE_END (<VAR>stream</VAR>, <VAR>num</VAR>, <VAR>table</VAR>)</CODE>
|
|
<DD>Define this if something special must be output at the end of a
|
|
jump-table. The definition should be a C statement to be executed
|
|
after the assembler code for the table is written. It should write
|
|
the appropriate code to stdio stream <VAR>stream</VAR>. The argument
|
|
<VAR>table</VAR> is the jump-table insn, and <VAR>num</VAR> is the label-number
|
|
of the preceding label.
|
|
<P>
|
|
|
|
If this macro is not defined, nothing special is output at the end of
|
|
the jump-table.
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="Exception Region Output"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC241"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC240" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC240"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC242" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC242"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC201" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC201"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC232" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC232"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC243" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC243"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H3> 17.16.9 Assembler Commands for Exception Regions </H3>
|
|
<!--docid::SEC241::-->
|
|
<P>
|
|
|
|
This describes commands marking the start and the end of an exception
|
|
region.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1678"></A>
|
|
<DT><CODE>ASM_OUTPUT_EH_REGION_BEG ()</CODE>
|
|
<DD>A C expression to output text to mark the start of an exception region.
|
|
<P>
|
|
|
|
This macro need not be defined on most platforms.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1679"></A>
|
|
<DT><CODE>ASM_OUTPUT_EH_REGION_END ()</CODE>
|
|
<DD>A C expression to output text to mark the end of an exception region.
|
|
<P>
|
|
|
|
This macro need not be defined on most platforms.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1680"></A>
|
|
<DT><CODE>EXCEPTION_SECTION ()</CODE>
|
|
<DD>A C expression to switch to the section in which the main
|
|
exception table is to be placed (see section <A HREF="gcc_17.html#SEC230" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC230">17.14 Dividing the Output into Sections (Texts, Data, <small>...</small>)</A>). The default is a
|
|
section named <CODE>.gcc_except_table</CODE> on machines that support named
|
|
sections via <CODE>ASM_OUTPUT_SECTION_NAME</CODE>, otherwise if <SAMP>`-fpic'</SAMP>
|
|
or <SAMP>`-fPIC'</SAMP> is in effect, the <CODE>data_section</CODE>, otherwise the
|
|
<CODE>readonly_data_section</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX1681"></A>
|
|
<DT><CODE>EH_FRAME_SECTION_ASM_OP</CODE>
|
|
<DD>If defined, a C string constant for the assembler operation to switch to
|
|
the section for exception handling frame unwind information. If not
|
|
defined, GNU CC will provide a default definition if the target supports
|
|
named sections. <TT>`crtstuff.c'</TT> uses this macro to switch to the
|
|
appropriate section.
|
|
<P>
|
|
|
|
You should define this symbol if your target supports DWARF 2 frame
|
|
unwind information and the default definition does not work.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1682"></A>
|
|
<DT><CODE>OMIT_EH_TABLE ()</CODE>
|
|
<DD>A C expression that is nonzero if the normal exception table output
|
|
should be omitted.
|
|
<P>
|
|
|
|
This macro need not be defined on most platforms.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1683"></A>
|
|
<DT><CODE>EH_TABLE_LOOKUP ()</CODE>
|
|
<DD>Alternate runtime support for looking up an exception at runtime and
|
|
finding the associated handler, if the default method won't work.
|
|
<P>
|
|
|
|
This macro need not be defined on most platforms.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1684"></A>
|
|
<DT><CODE>DOESNT_NEED_UNWINDER</CODE>
|
|
<DD>A C expression that decides whether or not the current function needs to
|
|
have a function unwinder generated for it. See the file <CODE>except.c</CODE>
|
|
for details on when to define this, and how.
|
|
<P>
|
|
|
|
<A NAME="IDX1685"></A>
|
|
<DT><CODE>MASK_RETURN_ADDR</CODE>
|
|
<DD>An rtx used to mask the return address found via RETURN_ADDR_RTX, so
|
|
that it does not contain any extraneous set bits in it.
|
|
<P>
|
|
|
|
<A NAME="IDX1686"></A>
|
|
<DT><CODE>DWARF2_UNWIND_INFO</CODE>
|
|
<DD>Define this macro to 0 if your target supports DWARF 2 frame unwind
|
|
information, but it does not yet work with exception handling.
|
|
Otherwise, if your target supports this information (if it defines
|
|
<SAMP>`INCOMING_RETURN_ADDR_RTX'</SAMP> and either <SAMP>`UNALIGNED_INT_ASM_OP'</SAMP>
|
|
or <SAMP>`OBJECT_FORMAT_ELF'</SAMP>), GCC will provide a default definition of
|
|
1.
|
|
<P>
|
|
|
|
If this macro is defined to 1, the DWARF 2 unwinder will be the default
|
|
exception handling mechanism; otherwise, setjmp/longjmp will be used by
|
|
default.
|
|
</P><P>
|
|
|
|
If this macro is defined to anything, the DWARF 2 unwinder will be used
|
|
instead of inline unwinders and __unwind_function in the non-setjmp case.
|
|
</P><P>
|
|
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="Alignment Output"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC242"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC241" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC241"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC243" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC243"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC234" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC234"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC232" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC232"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC243" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC243"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H3> 17.16.10 Assembler Commands for Alignment </H3>
|
|
<!--docid::SEC242::-->
|
|
<P>
|
|
|
|
This describes commands for alignment.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1687"></A>
|
|
<DT><CODE>LABEL_ALIGN_AFTER_BARRIER (<VAR>label</VAR>)</CODE>
|
|
<DD>The alignment (log base 2) to put in front of <VAR>label</VAR>, which follows
|
|
a BARRIER.
|
|
<P>
|
|
|
|
This macro need not be defined if you don't want any special alignment
|
|
to be done at such a time. Most machine descriptions do not currently
|
|
define the macro.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1688"></A>
|
|
<DT><CODE>LOOP_ALIGN (<VAR>label</VAR>)</CODE>
|
|
<DD>The alignment (log base 2) to put in front of <VAR>label</VAR>, which follows
|
|
a NOTE_INSN_LOOP_BEG note.
|
|
<P>
|
|
|
|
This macro need not be defined if you don't want any special alignment
|
|
to be done at such a time. Most machine descriptions do not currently
|
|
define the macro.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1689"></A>
|
|
<DT><CODE>LABEL_ALIGN (<VAR>label</VAR>)</CODE>
|
|
<DD>The alignment (log base 2) to put in front of <VAR>label</VAR>.
|
|
If LABEL_ALIGN_AFTER_BARRIER / LOOP_ALIGN specify a different alignment,
|
|
the maximum of the specified values is used.
|
|
<P>
|
|
|
|
<A NAME="IDX1690"></A>
|
|
<DT><CODE>ASM_OUTPUT_SKIP (<VAR>stream</VAR>, <VAR>nbytes</VAR>)</CODE>
|
|
<DD>A C statement to output to the stdio stream <VAR>stream</VAR> an assembler
|
|
instruction to advance the location counter by <VAR>nbytes</VAR> bytes.
|
|
Those bytes should be zero when loaded. <VAR>nbytes</VAR> will be a C
|
|
expression of type <CODE>int</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX1691"></A>
|
|
<DT><CODE>ASM_NO_SKIP_IN_TEXT</CODE>
|
|
<DD>Define this macro if <CODE>ASM_OUTPUT_SKIP</CODE> should not be used in the
|
|
text section because it fails to put zeros in the bytes that are skipped.
|
|
This is true on many Unix systems, where the pseudo--op to skip bytes
|
|
produces no-op instructions rather than zeros when used in the text
|
|
section.
|
|
<P>
|
|
|
|
<A NAME="IDX1692"></A>
|
|
<DT><CODE>ASM_OUTPUT_ALIGN (<VAR>stream</VAR>, <VAR>power</VAR>)</CODE>
|
|
<DD>A C statement to output to the stdio stream <VAR>stream</VAR> an assembler
|
|
command to advance the location counter to a multiple of 2 to the
|
|
<VAR>power</VAR> bytes. <VAR>power</VAR> will be a C expression of type <CODE>int</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX1693"></A>
|
|
<DT><CODE>ASM_OUTPUT_MAX_SKIP_ALIGN (<VAR>stream</VAR>, <VAR>power</VAR>, <VAR>max_skip</VAR>)</CODE>
|
|
<DD>A C statement to output to the stdio stream <VAR>stream</VAR> an assembler
|
|
command to advance the location counter to a multiple of 2 to the
|
|
<VAR>power</VAR> bytes, but only if <VAR>max_skip</VAR> or fewer bytes are needed to
|
|
satisfy the alignment request. <VAR>power</VAR> and <VAR>max_skip</VAR> will be
|
|
a C expression of type <CODE>int</CODE>.
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="Debugging Info"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC243"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC242" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC242"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC244" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC244"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC201" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC201"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC199" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC199"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC249" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC249"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H2> 17.17 Controlling Debugging Information Format </H2>
|
|
<!--docid::SEC243::-->
|
|
<P>
|
|
|
|
This describes how to specify debugging information.
|
|
</P><P>
|
|
|
|
<BLOCKQUOTE><TABLE BORDER=0 CELLSPACING=0>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC244" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC244">17.17.1 Macros Affecting All Debugging Formats</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">Macros that affect all debugging formats uniformly.</TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC245" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC245">17.17.2 Specific Options for DBX Output</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">Macros enabling specific options in DBX format.</TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC246" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC246">17.17.3 Open-Ended Hooks for DBX Format</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">Hook macros for varying DBX format.</TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC247" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC247">17.17.4 File Names in DBX Format</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">Macros controlling output of file names in DBX format.</TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gcc_17.html#SEC248" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC248">17.17.5 Macros for SDB and DWARF Output</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">Macros for SDB (COFF) and DWARF formats.</TD></TR>
|
|
</TABLE></BLOCKQUOTE>
|
|
<P>
|
|
|
|
<A NAME="All Debuggers"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC244"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC243" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC243"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC245" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC245"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC201" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC201"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC243" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC243"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC249" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC249"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H3> 17.17.1 Macros Affecting All Debugging Formats </H3>
|
|
<!--docid::SEC244::-->
|
|
<P>
|
|
|
|
These macros affect all debugging formats.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1694"></A>
|
|
<DT><CODE>DBX_REGISTER_NUMBER (<VAR>regno</VAR>)</CODE>
|
|
<DD>A C expression that returns the DBX register number for the compiler
|
|
register number <VAR>regno</VAR>. In simple cases, the value of this
|
|
expression may be <VAR>regno</VAR> itself. But sometimes there are some
|
|
registers that the compiler knows about and DBX does not, or vice
|
|
versa. In such cases, some register may need to have one number in
|
|
the compiler and another for DBX.
|
|
<P>
|
|
|
|
If two registers have consecutive numbers inside GNU CC, and they can be
|
|
used as a pair to hold a multiword value, then they <EM>must</EM> have
|
|
consecutive numbers after renumbering with <CODE>DBX_REGISTER_NUMBER</CODE>.
|
|
Otherwise, debuggers will be unable to access such a pair, because they
|
|
expect register pairs to be consecutive in their own numbering scheme.
|
|
</P><P>
|
|
|
|
If you find yourself defining <CODE>DBX_REGISTER_NUMBER</CODE> in way that
|
|
does not preserve register pairs, then what you must do instead is
|
|
redefine the actual register numbering scheme.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1695"></A>
|
|
<DT><CODE>DEBUGGER_AUTO_OFFSET (<VAR>x</VAR>)</CODE>
|
|
<DD>A C expression that returns the integer offset value for an automatic
|
|
variable having address <VAR>x</VAR> (an RTL expression). The default
|
|
computation assumes that <VAR>x</VAR> is based on the frame-pointer and
|
|
gives the offset from the frame-pointer. This is required for targets
|
|
that produce debugging output for DBX or COFF-style debugging output
|
|
for SDB and allow the frame-pointer to be eliminated when the
|
|
<SAMP>`-g'</SAMP> options is used.
|
|
<P>
|
|
|
|
<A NAME="IDX1696"></A>
|
|
<DT><CODE>DEBUGGER_ARG_OFFSET (<VAR>offset</VAR>, <VAR>x</VAR>)</CODE>
|
|
<DD>A C expression that returns the integer offset value for an argument
|
|
having address <VAR>x</VAR> (an RTL expression). The nominal offset is
|
|
<VAR>offset</VAR>.
|
|
<P>
|
|
|
|
<A NAME="IDX1697"></A>
|
|
<DT><CODE>PREFERRED_DEBUGGING_TYPE</CODE>
|
|
<DD>A C expression that returns the type of debugging output GNU CC should
|
|
produce when the user specifies just <SAMP>`-g'</SAMP>. Define
|
|
this if you have arranged for GNU CC to support more than one format of
|
|
debugging output. Currently, the allowable values are <CODE>DBX_DEBUG</CODE>,
|
|
<CODE>SDB_DEBUG</CODE>, <CODE>DWARF_DEBUG</CODE>, <CODE>DWARF2_DEBUG</CODE>, and
|
|
<CODE>XCOFF_DEBUG</CODE>.
|
|
<P>
|
|
|
|
When the user specifies <SAMP>`-ggdb'</SAMP>, GNU CC normally also uses the
|
|
value of this macro to select the debugging output format, but with two
|
|
exceptions. If <CODE>DWARF2_DEBUGGING_INFO</CODE> is defined and
|
|
<CODE>LINKER_DOES_NOT_WORK_WITH_DWARF2</CODE> is not defined, GNU CC uses the
|
|
value <CODE>DWARF2_DEBUG</CODE>. Otherwise, if <CODE>DBX_DEBUGGING_INFO</CODE> is
|
|
defined, GNU CC uses <CODE>DBX_DEBUG</CODE>.
|
|
</P><P>
|
|
|
|
The value of this macro only affects the default debugging output; the
|
|
user can always get a specific type of output by using <SAMP>`-gstabs'</SAMP>,
|
|
<SAMP>`-gcoff'</SAMP>, <SAMP>`-gdwarf-1'</SAMP>, <SAMP>`-gdwarf-2'</SAMP>, or <SAMP>`-gxcoff'</SAMP>.
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="DBX Options"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC245"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC244" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC244"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC246" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC246"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC246" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC246"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC243" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC243"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC249" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC249"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H3> 17.17.2 Specific Options for DBX Output </H3>
|
|
<!--docid::SEC245::-->
|
|
<P>
|
|
|
|
These are specific options for DBX output.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1698"></A>
|
|
<DT><CODE>DBX_DEBUGGING_INFO</CODE>
|
|
<DD>Define this macro if GNU CC should produce debugging output for DBX
|
|
in response to the <SAMP>`-g'</SAMP> option.
|
|
<P>
|
|
|
|
<A NAME="IDX1699"></A>
|
|
<DT><CODE>XCOFF_DEBUGGING_INFO</CODE>
|
|
<DD>Define this macro if GNU CC should produce XCOFF format debugging output
|
|
in response to the <SAMP>`-g'</SAMP> option. This is a variant of DBX format.
|
|
<P>
|
|
|
|
<A NAME="IDX1700"></A>
|
|
<DT><CODE>DEFAULT_GDB_EXTENSIONS</CODE>
|
|
<DD>Define this macro to control whether GNU CC should by default generate
|
|
GDB's extended version of DBX debugging information (assuming DBX-format
|
|
debugging information is enabled at all). If you don't define the
|
|
macro, the default is 1: always generate the extended information
|
|
if there is any occasion to.
|
|
<P>
|
|
|
|
<A NAME="IDX1701"></A>
|
|
<DT><CODE>DEBUG_SYMS_TEXT</CODE>
|
|
<DD>Define this macro if all <CODE>.stabs</CODE> commands should be output while
|
|
in the text section.
|
|
<P>
|
|
|
|
<A NAME="IDX1702"></A>
|
|
<DT><CODE>ASM_STABS_OP</CODE>
|
|
<DD>A C string constant naming the assembler pseudo op to use instead of
|
|
<CODE>.stabs</CODE> to define an ordinary debugging symbol. If you don't
|
|
define this macro, <CODE>.stabs</CODE> is used. This macro applies only to
|
|
DBX debugging information format.
|
|
<P>
|
|
|
|
<A NAME="IDX1703"></A>
|
|
<DT><CODE>ASM_STABD_OP</CODE>
|
|
<DD>A C string constant naming the assembler pseudo op to use instead of
|
|
<CODE>.stabd</CODE> to define a debugging symbol whose value is the current
|
|
location. If you don't define this macro, <CODE>.stabd</CODE> is used.
|
|
This macro applies only to DBX debugging information format.
|
|
<P>
|
|
|
|
<A NAME="IDX1704"></A>
|
|
<DT><CODE>ASM_STABN_OP</CODE>
|
|
<DD>A C string constant naming the assembler pseudo op to use instead of
|
|
<CODE>.stabn</CODE> to define a debugging symbol with no name. If you don't
|
|
define this macro, <CODE>.stabn</CODE> is used. This macro applies only to
|
|
DBX debugging information format.
|
|
<P>
|
|
|
|
<A NAME="IDX1705"></A>
|
|
<DT><CODE>DBX_NO_XREFS</CODE>
|
|
<DD>Define this macro if DBX on your system does not support the construct
|
|
<SAMP>`xs<VAR>tagname</VAR>'</SAMP>. On some systems, this construct is used to
|
|
describe a forward reference to a structure named <VAR>tagname</VAR>.
|
|
On other systems, this construct is not supported at all.
|
|
<P>
|
|
|
|
<A NAME="IDX1706"></A>
|
|
<DT><CODE>DBX_CONTIN_LENGTH</CODE>
|
|
<DD>A symbol name in DBX-format debugging information is normally
|
|
continued (split into two separate <CODE>.stabs</CODE> directives) when it
|
|
exceeds a certain length (by default, 80 characters). On some
|
|
operating systems, DBX requires this splitting; on others, splitting
|
|
must not be done. You can inhibit splitting by defining this macro
|
|
with the value zero. You can override the default splitting-length by
|
|
defining this macro as an expression for the length you desire.
|
|
<P>
|
|
|
|
<A NAME="IDX1707"></A>
|
|
<DT><CODE>DBX_CONTIN_CHAR</CODE>
|
|
<DD>Normally continuation is indicated by adding a <SAMP>`\'</SAMP> character to
|
|
the end of a <CODE>.stabs</CODE> string when a continuation follows. To use
|
|
a different character instead, define this macro as a character
|
|
constant for the character you want to use. Do not define this macro
|
|
if backslash is correct for your system.
|
|
<P>
|
|
|
|
<A NAME="IDX1708"></A>
|
|
<DT><CODE>DBX_STATIC_STAB_DATA_SECTION</CODE>
|
|
<DD>Define this macro if it is necessary to go to the data section before
|
|
outputting the <SAMP>`.stabs'</SAMP> pseudo-op for a non-global static
|
|
variable.
|
|
<P>
|
|
|
|
<A NAME="IDX1709"></A>
|
|
<DT><CODE>DBX_TYPE_DECL_STABS_CODE</CODE>
|
|
<DD>The value to use in the "code" field of the <CODE>.stabs</CODE> directive
|
|
for a typedef. The default is <CODE>N_LSYM</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX1710"></A>
|
|
<DT><CODE>DBX_STATIC_CONST_VAR_CODE</CODE>
|
|
<DD>The value to use in the "code" field of the <CODE>.stabs</CODE> directive
|
|
for a static variable located in the text section. DBX format does not
|
|
provide any "right" way to do this. The default is <CODE>N_FUN</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX1711"></A>
|
|
<DT><CODE>DBX_REGPARM_STABS_CODE</CODE>
|
|
<DD>The value to use in the "code" field of the <CODE>.stabs</CODE> directive
|
|
for a parameter passed in registers. DBX format does not provide any
|
|
"right" way to do this. The default is <CODE>N_RSYM</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX1712"></A>
|
|
<DT><CODE>DBX_REGPARM_STABS_LETTER</CODE>
|
|
<DD>The letter to use in DBX symbol data to identify a symbol as a parameter
|
|
passed in registers. DBX format does not customarily provide any way to
|
|
do this. The default is <CODE>'P'</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX1713"></A>
|
|
<DT><CODE>DBX_MEMPARM_STABS_LETTER</CODE>
|
|
<DD>The letter to use in DBX symbol data to identify a symbol as a stack
|
|
parameter. The default is <CODE>'p'</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX1714"></A>
|
|
<DT><CODE>DBX_FUNCTION_FIRST</CODE>
|
|
<DD>Define this macro if the DBX information for a function and its
|
|
arguments should precede the assembler code for the function. Normally,
|
|
in DBX format, the debugging information entirely follows the assembler
|
|
code.
|
|
<P>
|
|
|
|
<A NAME="IDX1715"></A>
|
|
<DT><CODE>DBX_LBRAC_FIRST</CODE>
|
|
<DD>Define this macro if the <CODE>N_LBRAC</CODE> symbol for a block should
|
|
precede the debugging information for variables and functions defined in
|
|
that block. Normally, in DBX format, the <CODE>N_LBRAC</CODE> symbol comes
|
|
first.
|
|
<P>
|
|
|
|
<A NAME="IDX1716"></A>
|
|
<DT><CODE>DBX_BLOCKS_FUNCTION_RELATIVE</CODE>
|
|
<DD>Define this macro if the value of a symbol describing the scope of a
|
|
block (<CODE>N_LBRAC</CODE> or <CODE>N_RBRAC</CODE>) should be relative to the start
|
|
of the enclosing function. Normally, GNU C uses an absolute address.
|
|
<P>
|
|
|
|
<A NAME="IDX1717"></A>
|
|
<DT><CODE>DBX_USE_BINCL</CODE>
|
|
<DD>Define this macro if GNU C should generate <CODE>N_BINCL</CODE> and
|
|
<CODE>N_EINCL</CODE> stabs for included header files, as on Sun systems. This
|
|
macro also directs GNU C to output a type number as a pair of a file
|
|
number and a type number within the file. Normally, GNU C does not
|
|
generate <CODE>N_BINCL</CODE> or <CODE>N_EINCL</CODE> stabs, and it outputs a single
|
|
number for a type number.
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="DBX Hooks"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC246"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC245" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC245"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC247" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC247"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC247" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC247"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC243" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC243"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC249" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC249"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H3> 17.17.3 Open-Ended Hooks for DBX Format </H3>
|
|
<!--docid::SEC246::-->
|
|
<P>
|
|
|
|
These are hooks for DBX format.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1718"></A>
|
|
<DT><CODE>DBX_OUTPUT_LBRAC (<VAR>stream</VAR>, <VAR>name</VAR>)</CODE>
|
|
<DD>Define this macro to say how to output to <VAR>stream</VAR> the debugging
|
|
information for the start of a scope level for variable names. The
|
|
argument <VAR>name</VAR> is the name of an assembler symbol (for use with
|
|
<CODE>assemble_name</CODE>) whose value is the address where the scope begins.
|
|
<P>
|
|
|
|
<A NAME="IDX1719"></A>
|
|
<DT><CODE>DBX_OUTPUT_RBRAC (<VAR>stream</VAR>, <VAR>name</VAR>)</CODE>
|
|
<DD>Like <CODE>DBX_OUTPUT_LBRAC</CODE>, but for the end of a scope level.
|
|
<P>
|
|
|
|
<A NAME="IDX1720"></A>
|
|
<DT><CODE>DBX_OUTPUT_ENUM (<VAR>stream</VAR>, <VAR>type</VAR>)</CODE>
|
|
<DD>Define this macro if the target machine requires special handling to
|
|
output an enumeration type. The definition should be a C statement
|
|
(sans semicolon) to output the appropriate information to <VAR>stream</VAR>
|
|
for the type <VAR>type</VAR>.
|
|
<P>
|
|
|
|
<A NAME="IDX1721"></A>
|
|
<DT><CODE>DBX_OUTPUT_FUNCTION_END (<VAR>stream</VAR>, <VAR>function</VAR>)</CODE>
|
|
<DD>Define this macro if the target machine requires special output at the
|
|
end of the debugging information for a function. The definition should
|
|
be a C statement (sans semicolon) to output the appropriate information
|
|
to <VAR>stream</VAR>. <VAR>function</VAR> is the <CODE>FUNCTION_DECL</CODE> node for
|
|
the function.
|
|
<P>
|
|
|
|
<A NAME="IDX1722"></A>
|
|
<DT><CODE>DBX_OUTPUT_STANDARD_TYPES (<VAR>syms</VAR>)</CODE>
|
|
<DD>Define this macro if you need to control the order of output of the
|
|
standard data types at the beginning of compilation. The argument
|
|
<VAR>syms</VAR> is a <CODE>tree</CODE> which is a chain of all the predefined
|
|
global symbols, including names of data types.
|
|
<P>
|
|
|
|
Normally, DBX output starts with definitions of the types for integers
|
|
and characters, followed by all the other predefined types of the
|
|
particular language in no particular order.
|
|
</P><P>
|
|
|
|
On some machines, it is necessary to output different particular types
|
|
first. To do this, define <CODE>DBX_OUTPUT_STANDARD_TYPES</CODE> to output
|
|
those symbols in the necessary order. Any predefined types that you
|
|
don't explicitly output will be output afterward in no particular order.
|
|
</P><P>
|
|
|
|
Be careful not to define this macro so that it works only for C. There
|
|
are no global variables to access most of the built-in types, because
|
|
another language may have another set of types. The way to output a
|
|
particular type is to look through <VAR>syms</VAR> to see if you can find it.
|
|
Here is an example:
|
|
</P><P>
|
|
|
|
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>{
|
|
tree decl;
|
|
for (decl = syms; decl; decl = TREE_CHAIN (decl))
|
|
if (!strcmp (IDENTIFIER_POINTER (DECL_NAME (decl)),
|
|
"long int"))
|
|
dbxout_symbol (decl);
|
|
<small>...</small>
|
|
}
|
|
</FONT></pre></td></tr></table></P><P>
|
|
|
|
This does nothing if the expected type does not exist.
|
|
</P><P>
|
|
|
|
See the function <CODE>init_decl_processing</CODE> in <TT>`c-decl.c'</TT> to find
|
|
the names to use for all the built-in C types.
|
|
</P><P>
|
|
|
|
Here is another way of finding a particular type:
|
|
</P><P>
|
|
|
|
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>{
|
|
tree decl;
|
|
for (decl = syms; decl; decl = TREE_CHAIN (decl))
|
|
if (TREE_CODE (decl) == TYPE_DECL
|
|
&& (TREE_CODE (TREE_TYPE (decl))
|
|
== INTEGER_CST)
|
|
&& TYPE_PRECISION (TREE_TYPE (decl)) == 16
|
|
&& TYPE_UNSIGNED (TREE_TYPE (decl)))
|
|
/* This must be <CODE>unsigned short</CODE>. */
|
|
dbxout_symbol (decl);
|
|
<small>...</small>
|
|
}
|
|
</FONT></pre></td></tr></table></P><P>
|
|
|
|
<A NAME="IDX1723"></A>
|
|
<DT><CODE>NO_DBX_FUNCTION_END</CODE>
|
|
<DD>Some stabs encapsulation formats (in particular ECOFF), cannot handle the
|
|
<CODE>.stabs "",N_FUN,,0,0,Lscope-function-1</CODE> gdb dbx extention construct.
|
|
On those machines, define this macro to turn this feature off without
|
|
disturbing the rest of the gdb extensions.
|
|
<P>
|
|
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="File Names and DBX"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC247"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC246" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC246"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC248" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC248"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC248" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC248"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC243" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC243"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC249" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC249"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H3> 17.17.4 File Names in DBX Format </H3>
|
|
<!--docid::SEC247::-->
|
|
<P>
|
|
|
|
This describes file names in DBX format.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1724"></A>
|
|
<DT><CODE>DBX_WORKING_DIRECTORY</CODE>
|
|
<DD>Define this if DBX wants to have the current directory recorded in each
|
|
object file.
|
|
<P>
|
|
|
|
Note that the working directory is always recorded if GDB extensions are
|
|
enabled.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1725"></A>
|
|
<DT><CODE>DBX_OUTPUT_MAIN_SOURCE_FILENAME (<VAR>stream</VAR>, <VAR>name</VAR>)</CODE>
|
|
<DD>A C statement to output DBX debugging information to the stdio stream
|
|
<VAR>stream</VAR> which indicates that file <VAR>name</VAR> is the main source
|
|
file--the file specified as the input file for compilation.
|
|
This macro is called only once, at the beginning of compilation.
|
|
<P>
|
|
|
|
This macro need not be defined if the standard form of output
|
|
for DBX debugging information is appropriate.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1726"></A>
|
|
<DT><CODE>DBX_OUTPUT_MAIN_SOURCE_DIRECTORY (<VAR>stream</VAR>, <VAR>name</VAR>)</CODE>
|
|
<DD>A C statement to output DBX debugging information to the stdio stream
|
|
<VAR>stream</VAR> which indicates that the current directory during
|
|
compilation is named <VAR>name</VAR>.
|
|
<P>
|
|
|
|
This macro need not be defined if the standard form of output
|
|
for DBX debugging information is appropriate.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1727"></A>
|
|
<DT><CODE>DBX_OUTPUT_MAIN_SOURCE_FILE_END (<VAR>stream</VAR>, <VAR>name</VAR>)</CODE>
|
|
<DD>A C statement to output DBX debugging information at the end of
|
|
compilation of the main source file <VAR>name</VAR>.
|
|
<P>
|
|
|
|
If you don't define this macro, nothing special is output at the end
|
|
of compilation, which is correct for most machines.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1728"></A>
|
|
<DT><CODE>DBX_OUTPUT_SOURCE_FILENAME (<VAR>stream</VAR>, <VAR>name</VAR>)</CODE>
|
|
<DD>A C statement to output DBX debugging information to the stdio stream
|
|
<VAR>stream</VAR> which indicates that file <VAR>name</VAR> is the current source
|
|
file. This output is generated each time input shifts to a different
|
|
source file as a result of <SAMP>`#include'</SAMP>, the end of an included file,
|
|
or a <SAMP>`#line'</SAMP> command.
|
|
<P>
|
|
|
|
This macro need not be defined if the standard form of output
|
|
for DBX debugging information is appropriate.
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="SDB and DWARF"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC248"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC247" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC247"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC249" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC249"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC201" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC201"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC243" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC243"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC249" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC249"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H3> 17.17.5 Macros for SDB and DWARF Output </H3>
|
|
<!--docid::SEC248::-->
|
|
<P>
|
|
|
|
Here are macros for SDB and DWARF output.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1729"></A>
|
|
<DT><CODE>SDB_DEBUGGING_INFO</CODE>
|
|
<DD>Define this macro if GNU CC should produce COFF-style debugging output
|
|
for SDB in response to the <SAMP>`-g'</SAMP> option.
|
|
<P>
|
|
|
|
<A NAME="IDX1730"></A>
|
|
<DT><CODE>DWARF_DEBUGGING_INFO</CODE>
|
|
<DD>Define this macro if GNU CC should produce dwarf format debugging output
|
|
in response to the <SAMP>`-g'</SAMP> option.
|
|
<P>
|
|
|
|
<A NAME="IDX1731"></A>
|
|
<DT><CODE>DWARF2_DEBUGGING_INFO</CODE>
|
|
<DD>Define this macro if GNU CC should produce dwarf version 2 format
|
|
debugging output in response to the <SAMP>`-g'</SAMP> option.
|
|
<P>
|
|
|
|
To support optional call frame debugging information, you must also
|
|
define <CODE>INCOMING_RETURN_ADDR_RTX</CODE> and either set
|
|
<CODE>RTX_FRAME_RELATED_P</CODE> on the prologue insns if you use RTL for the
|
|
prologue, or call <CODE>dwarf2out_def_cfa</CODE> and <CODE>dwarf2out_reg_save</CODE>
|
|
as appropriate from <CODE>FUNCTION_PROLOGUE</CODE> if you don't.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1732"></A>
|
|
<DT><CODE>DWARF2_FRAME_INFO</CODE>
|
|
<DD>Define this macro to a nonzero value if GNU CC should always output
|
|
Dwarf 2 frame information. If <CODE>DWARF2_UNWIND_INFO</CODE>
|
|
(see section <A HREF="gcc_17.html#SEC241" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC241">17.16.9 Assembler Commands for Exception Regions</A> is nonzero, GNU CC will output this
|
|
information not matter how you define <CODE>DWARF2_FRAME_INFO</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX1733"></A>
|
|
<DT><CODE>LINKER_DOES_NOT_WORK_WITH_DWARF2</CODE>
|
|
<DD>Define this macro if the linker does not work with Dwarf version 2.
|
|
Normally, if the user specifies only <SAMP>`-ggdb'</SAMP> GNU CC will use Dwarf
|
|
version 2 if available; this macro disables this. See the description
|
|
of the <CODE>PREFERRED_DEBUGGING_TYPE</CODE> macro for more details.
|
|
<P>
|
|
|
|
<A NAME="IDX1734"></A>
|
|
<DT><CODE>PUT_SDB_<small>...</small></CODE>
|
|
<DD>Define these macros to override the assembler syntax for the special
|
|
SDB assembler directives. See <TT>`sdbout.c'</TT> for a list of these
|
|
macros and their arguments. If the standard syntax is used, you need
|
|
not define them yourself.
|
|
<P>
|
|
|
|
<A NAME="IDX1735"></A>
|
|
<DT><CODE>SDB_DELIM</CODE>
|
|
<DD>Some assemblers do not support a semicolon as a delimiter, even between
|
|
SDB assembler directives. In that case, define this macro to be the
|
|
delimiter to use (usually <SAMP>`\n'</SAMP>). It is not necessary to define
|
|
a new set of <CODE>PUT_SDB_<VAR>op</VAR></CODE> macros if this is the only change
|
|
required.
|
|
<P>
|
|
|
|
<A NAME="IDX1736"></A>
|
|
<DT><CODE>SDB_GENERATE_FAKE</CODE>
|
|
<DD>Define this macro to override the usual method of constructing a dummy
|
|
name for anonymous structure and union types. See <TT>`sdbout.c'</TT> for
|
|
more information.
|
|
<P>
|
|
|
|
<A NAME="IDX1737"></A>
|
|
<DT><CODE>SDB_ALLOW_UNKNOWN_REFERENCES</CODE>
|
|
<DD>Define this macro to allow references to unknown structure,
|
|
union, or enumeration tags to be emitted. Standard COFF does not
|
|
allow handling of unknown references, MIPS ECOFF has support for
|
|
it.
|
|
<P>
|
|
|
|
<A NAME="IDX1738"></A>
|
|
<DT><CODE>SDB_ALLOW_FORWARD_REFERENCES</CODE>
|
|
<DD>Define this macro to allow references to structure, union, or
|
|
enumeration tags that have not yet been seen to be handled. Some
|
|
assemblers choke if forward tags are used, while some require it.
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="Cross-compilation"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC249"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC248" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC248"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC250" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC250"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC201" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC201"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC199" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC199"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_18.html#SEC251" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_18.html#SEC251"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H2> 17.18 Cross Compilation and Floating Point </H2>
|
|
<!--docid::SEC249::-->
|
|
<P>
|
|
|
|
While all modern machines use 2's complement representation for integers,
|
|
there are a variety of representations for floating point numbers. This
|
|
means that in a cross-compiler the representation of floating point numbers
|
|
in the compiled program may be different from that used in the machine
|
|
doing the compilation.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1739"></A>
|
|
Because different representation systems may offer different amounts of
|
|
range and precision, the cross compiler cannot safely use the host
|
|
machine's floating point arithmetic. Therefore, floating point constants
|
|
must be represented in the target machine's format. This means that the
|
|
cross compiler cannot use <CODE>atof</CODE> to parse a floating point constant;
|
|
it must have its own special routine to use instead. Also, constant
|
|
folding must emulate the target machine's arithmetic (or must not be done
|
|
at all).
|
|
</P><P>
|
|
|
|
The macros in the following table should be defined only if you are cross
|
|
compiling between different floating point formats.
|
|
</P><P>
|
|
|
|
Otherwise, don't define them. Then default definitions will be set up which
|
|
use <CODE>double</CODE> as the data type, <CODE>==</CODE> to test for equality, etc.
|
|
</P><P>
|
|
|
|
You don't need to worry about how many times you use an operand of any
|
|
of these macros. The compiler never uses operands which have side effects.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1740"></A>
|
|
<DT><CODE>REAL_VALUE_TYPE</CODE>
|
|
<DD>A macro for the C data type to be used to hold a floating point value
|
|
in the target machine's format. Typically this would be a
|
|
<CODE>struct</CODE> containing an array of <CODE>int</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX1741"></A>
|
|
<DT><CODE>REAL_VALUES_EQUAL (<VAR>x</VAR>, <VAR>y</VAR>)</CODE>
|
|
<DD>A macro for a C expression which compares for equality the two values,
|
|
<VAR>x</VAR> and <VAR>y</VAR>, both of type <CODE>REAL_VALUE_TYPE</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX1742"></A>
|
|
<DT><CODE>REAL_VALUES_LESS (<VAR>x</VAR>, <VAR>y</VAR>)</CODE>
|
|
<DD>A macro for a C expression which tests whether <VAR>x</VAR> is less than
|
|
<VAR>y</VAR>, both values being of type <CODE>REAL_VALUE_TYPE</CODE> and
|
|
interpreted as floating point numbers in the target machine's
|
|
representation.
|
|
<P>
|
|
|
|
<A NAME="IDX1743"></A>
|
|
<A NAME="IDX1744"></A>
|
|
<DT><CODE>REAL_VALUE_LDEXP (<VAR>x</VAR>, <VAR>scale</VAR>)</CODE>
|
|
<DD>A macro for a C expression which performs the standard library
|
|
function <CODE>ldexp</CODE>, but using the target machine's floating point
|
|
representation. Both <VAR>x</VAR> and the value of the expression have
|
|
type <CODE>REAL_VALUE_TYPE</CODE>. The second argument, <VAR>scale</VAR>, is an
|
|
integer.
|
|
<P>
|
|
|
|
<A NAME="IDX1745"></A>
|
|
<DT><CODE>REAL_VALUE_FIX (<VAR>x</VAR>)</CODE>
|
|
<DD>A macro whose definition is a C expression to convert the target-machine
|
|
floating point value <VAR>x</VAR> to a signed integer. <VAR>x</VAR> has type
|
|
<CODE>REAL_VALUE_TYPE</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX1746"></A>
|
|
<DT><CODE>REAL_VALUE_UNSIGNED_FIX (<VAR>x</VAR>)</CODE>
|
|
<DD>A macro whose definition is a C expression to convert the target-machine
|
|
floating point value <VAR>x</VAR> to an unsigned integer. <VAR>x</VAR> has type
|
|
<CODE>REAL_VALUE_TYPE</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX1747"></A>
|
|
<DT><CODE>REAL_VALUE_RNDZINT (<VAR>x</VAR>)</CODE>
|
|
<DD>A macro whose definition is a C expression to round the target-machine
|
|
floating point value <VAR>x</VAR> towards zero to an integer value (but still
|
|
as a floating point number). <VAR>x</VAR> has type <CODE>REAL_VALUE_TYPE</CODE>,
|
|
and so does the value.
|
|
<P>
|
|
|
|
<A NAME="IDX1748"></A>
|
|
<DT><CODE>REAL_VALUE_UNSIGNED_RNDZINT (<VAR>x</VAR>)</CODE>
|
|
<DD>A macro whose definition is a C expression to round the target-machine
|
|
floating point value <VAR>x</VAR> towards zero to an unsigned integer value
|
|
(but still represented as a floating point number). <VAR>x</VAR> has type
|
|
<CODE>REAL_VALUE_TYPE</CODE>, and so does the value.
|
|
<P>
|
|
|
|
<A NAME="IDX1749"></A>
|
|
<DT><CODE>REAL_VALUE_ATOF (<VAR>string</VAR>, <VAR>mode</VAR>)</CODE>
|
|
<DD>A macro for a C expression which converts <VAR>string</VAR>, an expression of
|
|
type <CODE>char *</CODE>, into a floating point number in the target machine's
|
|
representation for mode <VAR>mode</VAR>. The value has type
|
|
<CODE>REAL_VALUE_TYPE</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX1750"></A>
|
|
<DT><CODE>REAL_INFINITY</CODE>
|
|
<DD>Define this macro if infinity is a possible floating point value, and
|
|
therefore division by 0 is legitimate.
|
|
<P>
|
|
|
|
<A NAME="IDX1751"></A>
|
|
<A NAME="IDX1752"></A>
|
|
<DT><CODE>REAL_VALUE_ISINF (<VAR>x</VAR>)</CODE>
|
|
<DD>A macro for a C expression which determines whether <VAR>x</VAR>, a floating
|
|
point value, is infinity. The value has type <CODE>int</CODE>.
|
|
By default, this is defined to call <CODE>isinf</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX1753"></A>
|
|
<A NAME="IDX1754"></A>
|
|
<DT><CODE>REAL_VALUE_ISNAN (<VAR>x</VAR>)</CODE>
|
|
<DD>A macro for a C expression which determines whether <VAR>x</VAR>, a floating
|
|
point value, is a "nan" (not-a-number). The value has type
|
|
<CODE>int</CODE>. By default, this is defined to call <CODE>isnan</CODE>.
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="IDX1755"></A>
|
|
Define the following additional macros if you want to make floating
|
|
point constant folding work while cross compiling. If you don't
|
|
define them, cross compilation is still possible, but constant folding
|
|
will not happen for floating point values.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX1756"></A>
|
|
<DT><CODE>REAL_ARITHMETIC (<VAR>output</VAR>, <VAR>code</VAR>, <VAR>x</VAR>, <VAR>y</VAR>)</CODE>
|
|
<DD>A macro for a C statement which calculates an arithmetic operation of
|
|
the two floating point values <VAR>x</VAR> and <VAR>y</VAR>, both of type
|
|
<CODE>REAL_VALUE_TYPE</CODE> in the target machine's representation, to
|
|
produce a result of the same type and representation which is stored
|
|
in <VAR>output</VAR> (which will be a variable).
|
|
<P>
|
|
|
|
The operation to be performed is specified by <VAR>code</VAR>, a tree code
|
|
which will always be one of the following: <CODE>PLUS_EXPR</CODE>,
|
|
<CODE>MINUS_EXPR</CODE>, <CODE>MULT_EXPR</CODE>, <CODE>RDIV_EXPR</CODE>,
|
|
<CODE>MAX_EXPR</CODE>, <CODE>MIN_EXPR</CODE>.</P><P>
|
|
|
|
<A NAME="IDX1757"></A>
|
|
The expansion of this macro is responsible for checking for overflow.
|
|
If overflow happens, the macro expansion should execute the statement
|
|
<CODE>return 0;</CODE>, which indicates the inability to perform the
|
|
arithmetic operation requested.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1758"></A>
|
|
<DT><CODE>REAL_VALUE_NEGATE (<VAR>x</VAR>)</CODE>
|
|
<DD>A macro for a C expression which returns the negative of the floating
|
|
point value <VAR>x</VAR>. Both <VAR>x</VAR> and the value of the expression
|
|
have type <CODE>REAL_VALUE_TYPE</CODE> and are in the target machine's
|
|
floating point representation.
|
|
<P>
|
|
|
|
There is no way for this macro to report overflow, since overflow
|
|
can't happen in the negation operation.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1759"></A>
|
|
<DT><CODE>REAL_VALUE_TRUNCATE (<VAR>mode</VAR>, <VAR>x</VAR>)</CODE>
|
|
<DD>A macro for a C expression which converts the floating point value
|
|
<VAR>x</VAR> to mode <VAR>mode</VAR>.
|
|
<P>
|
|
|
|
Both <VAR>x</VAR> and the value of the expression are in the target machine's
|
|
floating point representation and have type <CODE>REAL_VALUE_TYPE</CODE>.
|
|
However, the value should have an appropriate bit pattern to be output
|
|
properly as a floating constant whose precision accords with mode
|
|
<VAR>mode</VAR>.
|
|
</P><P>
|
|
|
|
There is no way for this macro to report overflow.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1760"></A>
|
|
<DT><CODE>REAL_VALUE_TO_INT (<VAR>low</VAR>, <VAR>high</VAR>, <VAR>x</VAR>)</CODE>
|
|
<DD>A macro for a C expression which converts a floating point value
|
|
<VAR>x</VAR> into a double-precision integer which is then stored into
|
|
<VAR>low</VAR> and <VAR>high</VAR>, two variables of type <VAR>int</VAR>.
|
|
<P>
|
|
|
|
<DT><CODE>REAL_VALUE_FROM_INT (<VAR>x</VAR>, <VAR>low</VAR>, <VAR>high</VAR>, <VAR>mode</VAR>)</CODE>
|
|
<DD><A NAME="IDX1761"></A>
|
|
A macro for a C expression which converts a double-precision integer
|
|
found in <VAR>low</VAR> and <VAR>high</VAR>, two variables of type <VAR>int</VAR>,
|
|
into a floating point value which is then stored into <VAR>x</VAR>.
|
|
The value is in the target machine's representation for mode <VAR>mode</VAR>
|
|
and has the type <CODE>REAL_VALUE_TYPE</CODE>.
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="Misc"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC250"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC249" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC249"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_18.html#SEC251" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_18.html#SEC251"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC201" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC201"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC199" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC199"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_18.html#SEC251" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_18.html#SEC251"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H2> 17.19 Miscellaneous Parameters </H2>
|
|
<!--docid::SEC250::-->
|
|
<P>
|
|
|
|
Here are several miscellaneous parameters.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<DT><CODE>PREDICATE_CODES</CODE>
|
|
<DD><A NAME="IDX1762"></A>
|
|
Define this if you have defined special-purpose predicates in the file
|
|
<TT>`<VAR>machine</VAR>.c'</TT>. This macro is called within an initializer of an
|
|
array of structures. The first field in the structure is the name of a
|
|
predicate and the second field is an array of rtl codes. For each
|
|
predicate, list all rtl codes that can be in expressions matched by the
|
|
predicate. The list should have a trailing comma. Here is an example
|
|
of two entries in the list for a typical RISC machine:
|
|
<P>
|
|
|
|
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>#define PREDICATE_CODES \
|
|
{"gen_reg_rtx_operand", {SUBREG, REG}}, \
|
|
{"reg_or_short_cint_operand", {SUBREG, REG, CONST_INT}},
|
|
</FONT></pre></td></tr></table></P><P>
|
|
|
|
Defining this macro does not affect the generated code (however,
|
|
incorrect definitions that omit an rtl code that may be matched by the
|
|
predicate can cause the compiler to malfunction). Instead, it allows
|
|
the table built by <TT>`genrecog'</TT> to be more compact and efficient,
|
|
thus speeding up the compiler. The most important predicates to include
|
|
in the list specified by this macro are those used in the most insn
|
|
patterns.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1763"></A>
|
|
<DT><CODE>CASE_VECTOR_MODE</CODE>
|
|
<DD>An alias for a machine mode name. This is the machine mode that
|
|
elements of a jump-table should have.
|
|
<P>
|
|
|
|
<A NAME="IDX1764"></A>
|
|
<DT><CODE>CASE_VECTOR_SHORTEN_MODE (<VAR>min_offset</VAR>, <VAR>max_offset</VAR>, <VAR>body</VAR>)</CODE>
|
|
<DD>Optional: return the preferred mode for an <CODE>addr_diff_vec</CODE>
|
|
when the minimum and maximum offset are known. If you define this,
|
|
it enables extra code in branch shortening to deal with <CODE>addr_diff_vec</CODE>.
|
|
To make this work, you also have to define INSN_ALIGN and
|
|
make the alignment for <CODE>addr_diff_vec</CODE> explicit.
|
|
The <VAR>body</VAR> argument is provided so that the offset_unsigned and scale
|
|
flags can be updated.
|
|
<P>
|
|
|
|
<A NAME="IDX1765"></A>
|
|
<DT><CODE>CASE_VECTOR_PC_RELATIVE</CODE>
|
|
<DD>Define this macro to be a C expression to indicate when jump-tables
|
|
should contain relative addresses. If jump-tables never contain
|
|
relative addresses, then you need not define this macro.
|
|
<P>
|
|
|
|
<A NAME="IDX1766"></A>
|
|
<DT><CODE>CASE_DROPS_THROUGH</CODE>
|
|
<DD>Define this if control falls through a <CODE>case</CODE> insn when the index
|
|
value is out of range. This means the specified default-label is
|
|
actually ignored by the <CODE>case</CODE> insn proper.
|
|
<P>
|
|
|
|
<A NAME="IDX1767"></A>
|
|
<DT><CODE>CASE_VALUES_THRESHOLD</CODE>
|
|
<DD>Define this to be the smallest number of different values for which it
|
|
is best to use a jump-table instead of a tree of conditional branches.
|
|
The default is four for machines with a <CODE>casesi</CODE> instruction and
|
|
five otherwise. This is best for most machines.
|
|
<P>
|
|
|
|
<A NAME="IDX1768"></A>
|
|
<DT><CODE>WORD_REGISTER_OPERATIONS</CODE>
|
|
<DD>Define this macro if operations between registers with integral mode
|
|
smaller than a word are always performed on the entire register.
|
|
Most RISC machines have this property and most CISC machines do not.
|
|
<P>
|
|
|
|
<A NAME="IDX1769"></A>
|
|
<DT><CODE>LOAD_EXTEND_OP (<VAR>mode</VAR>)</CODE>
|
|
<DD>Define this macro to be a C expression indicating when insns that read
|
|
memory in <VAR>mode</VAR>, an integral mode narrower than a word, set the
|
|
bits outside of <VAR>mode</VAR> to be either the sign-extension or the
|
|
zero-extension of the data read. Return <CODE>SIGN_EXTEND</CODE> for values
|
|
of <VAR>mode</VAR> for which the
|
|
insn sign-extends, <CODE>ZERO_EXTEND</CODE> for which it zero-extends, and
|
|
<CODE>NIL</CODE> for other modes.
|
|
<P>
|
|
|
|
This macro is not called with <VAR>mode</VAR> non-integral or with a width
|
|
greater than or equal to <CODE>BITS_PER_WORD</CODE>, so you may return any
|
|
value in this case. Do not define this macro if it would always return
|
|
<CODE>NIL</CODE>. On machines where this macro is defined, you will normally
|
|
define it as the constant <CODE>SIGN_EXTEND</CODE> or <CODE>ZERO_EXTEND</CODE>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1770"></A>
|
|
<DT><CODE>SHORT_IMMEDIATES_SIGN_EXTEND</CODE>
|
|
<DD>Define this macro if loading short immediate values into registers sign
|
|
extends.
|
|
<P>
|
|
|
|
<A NAME="IDX1771"></A>
|
|
<DT><CODE>IMPLICIT_FIX_EXPR</CODE>
|
|
<DD>An alias for a tree code that should be used by default for conversion
|
|
of floating point values to fixed point. Normally,
|
|
<CODE>FIX_ROUND_EXPR</CODE> is used.<P>
|
|
|
|
<A NAME="IDX1772"></A>
|
|
<DT><CODE>FIXUNS_TRUNC_LIKE_FIX_TRUNC</CODE>
|
|
<DD>Define this macro if the same instructions that convert a floating
|
|
point number to a signed fixed point number also convert validly to an
|
|
unsigned one.
|
|
<P>
|
|
|
|
<A NAME="IDX1773"></A>
|
|
<DT><CODE>EASY_DIV_EXPR</CODE>
|
|
<DD>An alias for a tree code that is the easiest kind of division to
|
|
compile code for in the general case. It may be
|
|
<CODE>TRUNC_DIV_EXPR</CODE>, <CODE>FLOOR_DIV_EXPR</CODE>, <CODE>CEIL_DIV_EXPR</CODE> or
|
|
<CODE>ROUND_DIV_EXPR</CODE>. These four division operators differ in how
|
|
they round the result to an integer. <CODE>EASY_DIV_EXPR</CODE> is used
|
|
when it is permissible to use any of those kinds of division and the
|
|
choice should be made on the basis of efficiency.<P>
|
|
|
|
<A NAME="IDX1774"></A>
|
|
<DT><CODE>MOVE_MAX</CODE>
|
|
<DD>The maximum number of bytes that a single instruction can move quickly
|
|
between memory and registers or between two memory locations.
|
|
<P>
|
|
|
|
<A NAME="IDX1775"></A>
|
|
<DT><CODE>MAX_MOVE_MAX</CODE>
|
|
<DD>The maximum number of bytes that a single instruction can move quickly
|
|
between memory and registers or between two memory locations. If this
|
|
is undefined, the default is <CODE>MOVE_MAX</CODE>. Otherwise, it is the
|
|
constant value that is the largest value that <CODE>MOVE_MAX</CODE> can have
|
|
at run-time.
|
|
<P>
|
|
|
|
<A NAME="IDX1776"></A>
|
|
<DT><CODE>SHIFT_COUNT_TRUNCATED</CODE>
|
|
<DD>A C expression that is nonzero if on this machine the number of bits
|
|
actually used for the count of a shift operation is equal to the number
|
|
of bits needed to represent the size of the object being shifted. When
|
|
this macro is non-zero, the compiler will assume that it is safe to omit
|
|
a sign-extend, zero-extend, and certain bitwise `and' instructions that
|
|
truncates the count of a shift operation. On machines that have
|
|
instructions that act on bitfields at variable positions, which may
|
|
include `bit test' instructions, a nonzero <CODE>SHIFT_COUNT_TRUNCATED</CODE>
|
|
also enables deletion of truncations of the values that serve as
|
|
arguments to bitfield instructions.
|
|
<P>
|
|
|
|
If both types of instructions truncate the count (for shifts) and
|
|
position (for bitfield operations), or if no variable-position bitfield
|
|
instructions exist, you should define this macro.
|
|
</P><P>
|
|
|
|
However, on some machines, such as the 80386 and the 680x0, truncation
|
|
only applies to shift operations and not the (real or pretended)
|
|
bitfield operations. Define <CODE>SHIFT_COUNT_TRUNCATED</CODE> to be zero on
|
|
such machines. Instead, add patterns to the <TT>`md'</TT> file that include
|
|
the implied truncation of the shift instructions.
|
|
</P><P>
|
|
|
|
You need not define this macro if it would always have the value of zero.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1777"></A>
|
|
<DT><CODE>TRULY_NOOP_TRUNCATION (<VAR>outprec</VAR>, <VAR>inprec</VAR>)</CODE>
|
|
<DD>A C expression which is nonzero if on this machine it is safe to
|
|
"convert" an integer of <VAR>inprec</VAR> bits to one of <VAR>outprec</VAR>
|
|
bits (where <VAR>outprec</VAR> is smaller than <VAR>inprec</VAR>) by merely
|
|
operating on it as if it had only <VAR>outprec</VAR> bits.
|
|
<P>
|
|
|
|
On many machines, this expression can be 1.
|
|
</P><P>
|
|
|
|
When <CODE>TRULY_NOOP_TRUNCATION</CODE> returns 1 for a pair of sizes for
|
|
modes for which <CODE>MODES_TIEABLE_P</CODE> is 0, suboptimal code can result.
|
|
If this is the case, making <CODE>TRULY_NOOP_TRUNCATION</CODE> return 0 in
|
|
such cases may improve things.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1778"></A>
|
|
<DT><CODE>STORE_FLAG_VALUE</CODE>
|
|
<DD>A C expression describing the value returned by a comparison operator
|
|
with an integral mode and stored by a store-flag instruction
|
|
(<SAMP>`s<VAR>cond</VAR>'</SAMP>) when the condition is true. This description must
|
|
apply to <EM>all</EM> the <SAMP>`s<VAR>cond</VAR>'</SAMP> patterns and all the
|
|
comparison operators whose results have a <CODE>MODE_INT</CODE> mode.
|
|
<P>
|
|
|
|
A value of 1 or -1 means that the instruction implementing the
|
|
comparison operator returns exactly 1 or -1 when the comparison is true
|
|
and 0 when the comparison is false. Otherwise, the value indicates
|
|
which bits of the result are guaranteed to be 1 when the comparison is
|
|
true. This value is interpreted in the mode of the comparison
|
|
operation, which is given by the mode of the first operand in the
|
|
<SAMP>`s<VAR>cond</VAR>'</SAMP> pattern. Either the low bit or the sign bit of
|
|
<CODE>STORE_FLAG_VALUE</CODE> be on. Presently, only those bits are used by
|
|
the compiler.
|
|
</P><P>
|
|
|
|
If <CODE>STORE_FLAG_VALUE</CODE> is neither 1 or -1, the compiler will
|
|
generate code that depends only on the specified bits. It can also
|
|
replace comparison operators with equivalent operations if they cause
|
|
the required bits to be set, even if the remaining bits are undefined.
|
|
For example, on a machine whose comparison operators return an
|
|
<CODE>SImode</CODE> value and where <CODE>STORE_FLAG_VALUE</CODE> is defined as
|
|
<SAMP>`0x80000000'</SAMP>, saying that just the sign bit is relevant, the
|
|
expression
|
|
</P><P>
|
|
|
|
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(ne:SI (and:SI <VAR>x</VAR> (const_int <VAR>power-of-2</VAR>)) (const_int 0))
|
|
</FONT></pre></td></tr></table></P><P>
|
|
|
|
can be converted to
|
|
</P><P>
|
|
|
|
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(ashift:SI <VAR>x</VAR> (const_int <VAR>n</VAR>))
|
|
</FONT></pre></td></tr></table></P><P>
|
|
|
|
where <VAR>n</VAR> is the appropriate shift count to move the bit being
|
|
tested into the sign bit.
|
|
</P><P>
|
|
|
|
There is no way to describe a machine that always sets the low-order bit
|
|
for a true value, but does not guarantee the value of any other bits,
|
|
but we do not know of any machine that has such an instruction. If you
|
|
are trying to port GNU CC to such a machine, include an instruction to
|
|
perform a logical-and of the result with 1 in the pattern for the
|
|
comparison operators and let us know
|
|
(see section <A HREF="gcc_8.html#SEC138" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_8.html#SEC138">How to Report Bugs</A>).
|
|
</P><P>
|
|
|
|
Often, a machine will have multiple instructions that obtain a value
|
|
from a comparison (or the condition codes). Here are rules to guide the
|
|
choice of value for <CODE>STORE_FLAG_VALUE</CODE>, and hence the instructions
|
|
to be used:
|
|
</P><P>
|
|
|
|
<UL>
|
|
<LI>
|
|
Use the shortest sequence that yields a valid definition for
|
|
<CODE>STORE_FLAG_VALUE</CODE>. It is more efficient for the compiler to
|
|
"normalize" the value (convert it to, e.g., 1 or 0) than for the
|
|
comparison operators to do so because there may be opportunities to
|
|
combine the normalization with other operations.
|
|
<P>
|
|
|
|
<LI>
|
|
For equal-length sequences, use a value of 1 or -1, with -1 being
|
|
slightly preferred on machines with expensive jumps and 1 preferred on
|
|
other machines.
|
|
<P>
|
|
|
|
<LI>
|
|
As a second choice, choose a value of <SAMP>`0x80000001'</SAMP> if instructions
|
|
exist that set both the sign and low-order bits but do not define the
|
|
others.
|
|
<P>
|
|
|
|
<LI>
|
|
Otherwise, use a value of <SAMP>`0x80000000'</SAMP>.
|
|
</UL>
|
|
<P>
|
|
|
|
Many machines can produce both the value chosen for
|
|
<CODE>STORE_FLAG_VALUE</CODE> and its negation in the same number of
|
|
instructions. On those machines, you should also define a pattern for
|
|
those cases, e.g., one matching
|
|
</P><P>
|
|
|
|
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(set <VAR>A</VAR> (neg:<VAR>m</VAR> (ne:<VAR>m</VAR> <VAR>B</VAR> <VAR>C</VAR>)))
|
|
</FONT></pre></td></tr></table></P><P>
|
|
|
|
Some machines can also perform <CODE>and</CODE> or <CODE>plus</CODE> operations on
|
|
condition code values with less instructions than the corresponding
|
|
<SAMP>`s<VAR>cond</VAR>'</SAMP> insn followed by <CODE>and</CODE> or <CODE>plus</CODE>. On those
|
|
machines, define the appropriate patterns. Use the names <CODE>incscc</CODE>
|
|
and <CODE>decscc</CODE>, respectively, for the patterns which perform
|
|
<CODE>plus</CODE> or <CODE>minus</CODE> operations on condition code values. See
|
|
<TT>`rs6000.md'</TT> for some examples. The GNU Superoptizer can be used to
|
|
find such instruction sequences on other machines.
|
|
</P><P>
|
|
|
|
You need not define <CODE>STORE_FLAG_VALUE</CODE> if the machine has no store-flag
|
|
instructions.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1779"></A>
|
|
<DT><CODE>FLOAT_STORE_FLAG_VALUE</CODE>
|
|
<DD>A C expression that gives a non-zero floating point value that is
|
|
returned when comparison operators with floating-point results are true.
|
|
Define this macro on machine that have comparison operations that return
|
|
floating-point values. If there are no such operations, do not define
|
|
this macro.
|
|
<P>
|
|
|
|
<A NAME="IDX1780"></A>
|
|
<DT><CODE>Pmode</CODE>
|
|
<DD>An alias for the machine mode for pointers. On most machines, define
|
|
this to be the integer mode corresponding to the width of a hardware
|
|
pointer; <CODE>SImode</CODE> on 32-bit machine or <CODE>DImode</CODE> on 64-bit machines.
|
|
On some machines you must define this to be one of the partial integer
|
|
modes, such as <CODE>PSImode</CODE>.
|
|
<P>
|
|
|
|
The width of <CODE>Pmode</CODE> must be at least as large as the value of
|
|
<CODE>POINTER_SIZE</CODE>. If it is not equal, you must define the macro
|
|
<CODE>POINTERS_EXTEND_UNSIGNED</CODE> to specify how pointers are extended
|
|
to <CODE>Pmode</CODE>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1781"></A>
|
|
<DT><CODE>FUNCTION_MODE</CODE>
|
|
<DD>An alias for the machine mode used for memory references to functions
|
|
being called, in <CODE>call</CODE> RTL expressions. On most machines this
|
|
should be <CODE>QImode</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX1782"></A>
|
|
<DT><CODE>INTEGRATE_THRESHOLD (<VAR>decl</VAR>)</CODE>
|
|
<DD>A C expression for the maximum number of instructions above which the
|
|
function <VAR>decl</VAR> should not be inlined. <VAR>decl</VAR> is a
|
|
<CODE>FUNCTION_DECL</CODE> node.
|
|
<P>
|
|
|
|
The default definition of this macro is 64 plus 8 times the number of
|
|
arguments that the function accepts. Some people think a larger
|
|
threshold should be used on RISC machines.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1783"></A>
|
|
<DT><CODE>SCCS_DIRECTIVE</CODE>
|
|
<DD>Define this if the preprocessor should ignore <CODE>#sccs</CODE> directives
|
|
and print no error message.
|
|
<P>
|
|
|
|
<A NAME="IDX1784"></A>
|
|
<DT><CODE>NO_IMPLICIT_EXTERN_C</CODE>
|
|
<DD>Define this macro if the system header files support C++ as well as C.
|
|
This macro inhibits the usual method of using system header files in
|
|
C++, which is to pretend that the file's contents are enclosed in
|
|
<SAMP>`extern "C" {<small>...</small>}'</SAMP>.
|
|
<P>
|
|
|
|
<A NAME="IDX1785"></A>
|
|
<A NAME="IDX1786"></A>
|
|
<A NAME="IDX1787"></A>
|
|
<DT><CODE>HANDLE_PRAGMA (<VAR>getc</VAR>, <VAR>ungetc</VAR>, <VAR>name</VAR>)</CODE>
|
|
<DD>Define this macro if you want to implement any pragmas. If defined, it
|
|
is a C expression whose value is 1 if the pragma was handled by the
|
|
macro, zero otherwise. The argument <VAR>getc</VAR> is a function of type
|
|
<SAMP>`int (*)(void)'</SAMP> which will return the next character in the input
|
|
stream, or EOF if no characters are left. The argument <VAR>ungetc</VAR> is
|
|
a function of type <SAMP>`void (*)(int)'</SAMP> which will push a character back
|
|
into the input stream. The argument <VAR>name</VAR> is the word following
|
|
#pragma in the input stream. The input stream pointer will be pointing
|
|
just beyond the end of this word. The input stream should be left
|
|
undistrubed if the expression returns zero, otherwise it should be
|
|
pointing at the next character after the end of the pragma. Any
|
|
characters remaining on the line will be ignored.
|
|
<P>
|
|
|
|
It is generally a bad idea to implement new uses of <CODE>#pragma</CODE>. The
|
|
only reason to define this macro is for compatibility with other
|
|
compilers that do support <CODE>#pragma</CODE> for the sake of any user
|
|
programs which already use it.
|
|
</P><P>
|
|
|
|
If the pragma can be implemented by atttributes then the macro
|
|
<SAMP>`INSERT_ATTRIBUTES'</SAMP> might be a useful one to define as well.
|
|
</P><P>
|
|
|
|
Note: older versions of this macro only had two arguments: <VAR>stream</VAR>
|
|
and <VAR>token</VAR>. The macro was changed in order to allow it to work
|
|
when gcc is built both with and without a cpp library.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1788"></A>
|
|
<A NAME="IDX1789"></A>
|
|
<A NAME="IDX1790"></A>
|
|
<DT><CODE>HANDLE_SYSV_PRAGMA</CODE>
|
|
<DD>Define this macro (to a value of 1) if you want the System V style
|
|
pragmas <SAMP>`#pragma pack(<n>)'</SAMP> and <SAMP>`#pragma weak <name>
|
|
[=<value>]'</SAMP> to be supported by gcc.
|
|
<P>
|
|
|
|
The pack pragma specifies the maximum alignment (in bytes) of fields
|
|
within a structure, in much the same way as the <SAMP>`__aligned__'</SAMP> and
|
|
<SAMP>`__packed__'</SAMP> <CODE>__attribute__</CODE>s do. A pack value of zero resets
|
|
the behaviour to the default.
|
|
</P><P>
|
|
|
|
The weak pragma only works if <CODE>SUPPORTS_WEAK</CODE> and
|
|
<CODE>ASM_WEAKEN_LABEL</CODE> are defined. If enabled it allows the creation
|
|
of specifically named weak labels, optionally with a value.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1791"></A>
|
|
<A NAME="IDX1792"></A>
|
|
<A NAME="IDX1793"></A>
|
|
<DT><CODE>HANDLE_PRAGMA_PACK_PUSH_POP</CODE>
|
|
<DD>Define this macro (to a value of 1) if you want to support the Win32
|
|
style pragmas <SAMP>`#pragma pack(push,<n>)'</SAMP> and <SAMP>`#pragma
|
|
pack(pop)'</SAMP>. The pack(push,<n>) pragma specifies the maximum alignment
|
|
(in bytes) of fields within a structure, in much the same way as the
|
|
<SAMP>`__aligned__'</SAMP> and <SAMP>`__packed__'</SAMP> <CODE>__attribute__</CODE>s do. A
|
|
pack value of zero resets the behaviour to the default. Successive
|
|
invocations of this pragma cause the previous values to be stacked, so
|
|
that invocations of <SAMP>`#pragma pack(pop)'</SAMP> will return to the previous
|
|
value.
|
|
<P>
|
|
|
|
<A NAME="IDX1794"></A>
|
|
<DT><CODE>VALID_MACHINE_DECL_ATTRIBUTE (<VAR>decl</VAR>, <VAR>attributes</VAR>, <VAR>identifier</VAR>, <VAR>args</VAR>)</CODE>
|
|
<DD>If defined, a C expression whose value is nonzero if <VAR>identifier</VAR> with
|
|
arguments <VAR>args</VAR> is a valid machine specific attribute for <VAR>decl</VAR>.
|
|
The attributes in <VAR>attributes</VAR> have previously been assigned to <VAR>decl</VAR>.
|
|
<P>
|
|
|
|
<A NAME="IDX1795"></A>
|
|
<DT><CODE>VALID_MACHINE_TYPE_ATTRIBUTE (<VAR>type</VAR>, <VAR>attributes</VAR>, <VAR>identifier</VAR>, <VAR>args</VAR>)</CODE>
|
|
<DD>If defined, a C expression whose value is nonzero if <VAR>identifier</VAR> with
|
|
arguments <VAR>args</VAR> is a valid machine specific attribute for <VAR>type</VAR>.
|
|
The attributes in <VAR>attributes</VAR> have previously been assigned to <VAR>type</VAR>.
|
|
<P>
|
|
|
|
<A NAME="IDX1796"></A>
|
|
<DT><CODE>COMP_TYPE_ATTRIBUTES (<VAR>type1</VAR>, <VAR>type2</VAR>)</CODE>
|
|
<DD>If defined, a C expression whose value is zero if the attributes on
|
|
<VAR>type1</VAR> and <VAR>type2</VAR> are incompatible, one if they are compatible,
|
|
and two if they are nearly compatible (which causes a warning to be
|
|
generated).
|
|
<P>
|
|
|
|
<A NAME="IDX1797"></A>
|
|
<DT><CODE>SET_DEFAULT_TYPE_ATTRIBUTES (<VAR>type</VAR>)</CODE>
|
|
<DD>If defined, a C statement that assigns default attributes to
|
|
newly defined <VAR>type</VAR>.
|
|
<P>
|
|
|
|
<A NAME="IDX1798"></A>
|
|
<DT><CODE>MERGE_MACHINE_TYPE_ATTRIBUTES (<VAR>type1</VAR>, <VAR>type2</VAR>)</CODE>
|
|
<DD>Define this macro if the merging of type attributes needs special handling.
|
|
If defined, the result is a list of the combined TYPE_ATTRIBUTES of
|
|
<VAR>type1</VAR> and <VAR>type2</VAR>. It is assumed that comptypes has already been
|
|
called and returned 1.
|
|
<P>
|
|
|
|
<A NAME="IDX1799"></A>
|
|
<DT><CODE>MERGE_MACHINE_DECL_ATTRIBUTES (<VAR>olddecl</VAR>, <VAR>newdecl</VAR>)</CODE>
|
|
<DD>Define this macro if the merging of decl attributes needs special handling.
|
|
If defined, the result is a list of the combined DECL_MACHINE_ATTRIBUTES of
|
|
<VAR>olddecl</VAR> and <VAR>newdecl</VAR>. <VAR>newdecl</VAR> is a duplicate declaration
|
|
of <VAR>olddecl</VAR>. Examples of when this is needed are when one attribute
|
|
overrides another, or when an attribute is nullified by a subsequent
|
|
definition.
|
|
<P>
|
|
|
|
<A NAME="IDX1800"></A>
|
|
<DT><CODE>INSERT_ATTRIBUTES (<VAR>node</VAR>, <VAR>attr_ptr</VAR>, <VAR>prefix_ptr</VAR>)</CODE>
|
|
<DD>Define this macro if you want to be able to add attributes to a decl
|
|
when it is being created. This is normally useful for backends which
|
|
wish to implement a pragma by using the attributes which correspond to
|
|
the pragma's effect. The <VAR>node</VAR> argument is the decl which is being
|
|
created. The <VAR>attr_ptr</VAR> argument is a pointer to the attribute list
|
|
for this decl. The <VAR>prefix_ptr</VAR> is a pointer to the list of
|
|
attributes that have appeared after the specifiers and modifiers of the
|
|
declaration, but before the declaration proper.
|
|
<P>
|
|
|
|
<A NAME="IDX1801"></A>
|
|
<DT><CODE>SET_DEFAULT_DECL_ATTRIBUTES (<VAR>decl</VAR>, <VAR>attributes</VAR>)</CODE>
|
|
<DD>If defined, a C statement that assigns default attributes to
|
|
newly defined <VAR>decl</VAR>.
|
|
<P>
|
|
|
|
<A NAME="IDX1802"></A>
|
|
<DT><CODE>DOLLARS_IN_IDENTIFIERS</CODE>
|
|
<DD>Define this macro to control use of the character <SAMP>`$'</SAMP> in identifier
|
|
names. 0 means <SAMP>`$'</SAMP> is not allowed by default; 1 means it is allowed.
|
|
1 is the default; there is no need to define this macro in that case.
|
|
This macro controls the compiler proper; it does not affect the preprocessor.
|
|
<P>
|
|
|
|
<A NAME="IDX1803"></A>
|
|
<DT><CODE>NO_DOLLAR_IN_LABEL</CODE>
|
|
<DD>Define this macro if the assembler does not accept the character
|
|
<SAMP>`$'</SAMP> in label names. By default constructors and destructors in
|
|
G++ have <SAMP>`$'</SAMP> in the identifiers. If this macro is defined,
|
|
<SAMP>`.'</SAMP> is used instead.
|
|
<P>
|
|
|
|
<A NAME="IDX1804"></A>
|
|
<DT><CODE>NO_DOT_IN_LABEL</CODE>
|
|
<DD>Define this macro if the assembler does not accept the character
|
|
<SAMP>`.'</SAMP> in label names. By default constructors and destructors in G++
|
|
have names that use <SAMP>`.'</SAMP>. If this macro is defined, these names
|
|
are rewritten to avoid <SAMP>`.'</SAMP>.
|
|
<P>
|
|
|
|
<A NAME="IDX1805"></A>
|
|
<DT><CODE>DEFAULT_MAIN_RETURN</CODE>
|
|
<DD>Define this macro if the target system expects every program's <CODE>main</CODE>
|
|
function to return a standard "success" value by default (if no other
|
|
value is explicitly returned).
|
|
<P>
|
|
|
|
The definition should be a C statement (sans semicolon) to generate the
|
|
appropriate rtl instructions. It is used only when compiling the end of
|
|
<CODE>main</CODE>.
|
|
</P><P>
|
|
|
|
<DT><CODE>HAVE_ATEXIT</CODE>
|
|
<DD><A NAME="IDX1806"></A>
|
|
Define this if the target system supports the function
|
|
<CODE>atexit</CODE> from the ANSI C standard. If this is not defined,
|
|
and <CODE>INIT_SECTION_ASM_OP</CODE> is not defined, a default
|
|
<CODE>exit</CODE> function will be provided to support C++.
|
|
<P>
|
|
|
|
<DT><CODE>EXIT_BODY</CODE>
|
|
<DD><A NAME="IDX1807"></A>
|
|
Define this if your <CODE>exit</CODE> function needs to do something
|
|
besides calling an external function <CODE>_cleanup</CODE> before
|
|
terminating with <CODE>_exit</CODE>. The <CODE>EXIT_BODY</CODE> macro is
|
|
only needed if neither <CODE>HAVE_ATEXIT</CODE> nor
|
|
<CODE>INIT_SECTION_ASM_OP</CODE> are defined.
|
|
<P>
|
|
|
|
<A NAME="IDX1808"></A>
|
|
<DT><CODE>INSN_SETS_ARE_DELAYED (<VAR>insn</VAR>)</CODE>
|
|
<DD>Define this macro as a C expression that is nonzero if it is safe for the
|
|
delay slot scheduler to place instructions in the delay slot of <VAR>insn</VAR>,
|
|
even if they appear to use a resource set or clobbered in <VAR>insn</VAR>.
|
|
<VAR>insn</VAR> is always a <CODE>jump_insn</CODE> or an <CODE>insn</CODE>; GNU CC knows that
|
|
every <CODE>call_insn</CODE> has this behavior. On machines where some <CODE>insn</CODE>
|
|
or <CODE>jump_insn</CODE> is really a function call and hence has this behavior,
|
|
you should define this macro.
|
|
<P>
|
|
|
|
You need not define this macro if it would always return zero.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1809"></A>
|
|
<DT><CODE>INSN_REFERENCES_ARE_DELAYED (<VAR>insn</VAR>)</CODE>
|
|
<DD>Define this macro as a C expression that is nonzero if it is safe for the
|
|
delay slot scheduler to place instructions in the delay slot of <VAR>insn</VAR>,
|
|
even if they appear to set or clobber a resource referenced in <VAR>insn</VAR>.
|
|
<VAR>insn</VAR> is always a <CODE>jump_insn</CODE> or an <CODE>insn</CODE>. On machines where
|
|
some <CODE>insn</CODE> or <CODE>jump_insn</CODE> is really a function call and its operands
|
|
are registers whose use is actually in the subroutine it calls, you should
|
|
define this macro. Doing so allows the delay slot scheduler to move
|
|
instructions which copy arguments into the argument registers into the delay
|
|
slot of <VAR>insn</VAR>.
|
|
<P>
|
|
|
|
You need not define this macro if it would always return zero.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1810"></A>
|
|
<DT><CODE>MACHINE_DEPENDENT_REORG (<VAR>insn</VAR>)</CODE>
|
|
<DD>In rare cases, correct code generation requires extra machine
|
|
dependent processing between the second jump optimization pass and
|
|
delayed branch scheduling. On those machines, define this macro as a C
|
|
statement to act on the code starting at <VAR>insn</VAR>.
|
|
<P>
|
|
|
|
<A NAME="IDX1811"></A>
|
|
<DT><CODE>MULTIPLE_SYMBOL_SPACES</CODE>
|
|
<DD>Define this macro if in some cases global symbols from one translation
|
|
unit may not be bound to undefined symbols in another translation unit
|
|
without user intervention. For instance, under Microsoft Windows
|
|
symbols must be explicitly imported from shared libraries (DLLs).
|
|
<P>
|
|
|
|
<A NAME="IDX1812"></A>
|
|
<DT><CODE>ISSUE_RATE</CODE>
|
|
<DD>A C expression that returns how many instructions can be issued at the
|
|
same time if the machine is a superscalar machine. This is only used by
|
|
the <SAMP>`Haifa'</SAMP> scheduler, and not the traditional scheduler.
|
|
<P>
|
|
|
|
<A NAME="IDX1813"></A>
|
|
<DT><CODE>MD_SCHED_INIT (<VAR>file</VAR>, <VAR>verbose</VAR>)</CODE>
|
|
<DD>A C statement which is executed by the <SAMP>`Haifa'</SAMP> scheduler at the
|
|
beginning of each block of instructions that are to be scheduled.
|
|
<VAR>file</VAR> is either a null pointer, or a stdio stream to write any
|
|
debug output to. <VAR>verbose</VAR> is the verbose level provided by
|
|
<SAMP>`-fsched-verbose-'</SAMP><VAR>n</VAR>.
|
|
<P>
|
|
|
|
<A NAME="IDX1814"></A>
|
|
<DT><CODE>MD_SCHED_REORDER (<VAR>file</VAR>, <VAR>verbose</VAR>, <VAR>ready</VAR>, <VAR>n_ready</VAR>)</CODE>
|
|
<DD>A C statement which is executed by the <SAMP>`Haifa'</SAMP> scheduler after it
|
|
has scheduled the ready list to allow the machine description to reorder
|
|
it (for example to combine two small instructions together on
|
|
<SAMP>`VLIW'</SAMP> machines). <VAR>file</VAR> is either a null pointer, or a stdio
|
|
stream to write any debug output to. <VAR>verbose</VAR> is the verbose level
|
|
provided by <SAMP>`-fsched-verbose-'</SAMP><VAR>n</VAR>. <VAR>ready</VAR> is a pointer to
|
|
the ready list of instructions that are ready to be scheduled.
|
|
<VAR>n_ready</VAR> is the number of elements in the ready list. The
|
|
scheduler reads the ready list in reverse order, starting with
|
|
<VAR>ready</VAR>[<VAR>n_ready</VAR>-1] and going to <VAR>ready</VAR>[0].
|
|
<P>
|
|
|
|
<A NAME="IDX1815"></A>
|
|
<DT><CODE>MD_SCHED_VARIABLE_ISSUE (<VAR>file</VAR>, <VAR>verbose</VAR>, <VAR>insn</VAR>, <VAR>more</VAR>)</CODE>
|
|
<DD>A C statement which is executed by the <SAMP>`Haifa'</SAMP> scheduler after it
|
|
has scheduled an insn from the ready list. <VAR>file</VAR> is either a null
|
|
pointer, or a stdio stream to write any debug output to. <VAR>verbose</VAR>
|
|
is the verbose level provided by <SAMP>`-fsched-verbose-'</SAMP><VAR>n</VAR>.
|
|
<VAR>insn</VAR> is the instruction that was scheduled. <VAR>more</VAR> is the
|
|
number of instructions that can be issued in the current cycle. The
|
|
<SAMP>`MD_SCHED_VARIABLE_ISSUE'</SAMP> macro is responsible for updating the
|
|
value of <VAR>more</VAR> (typically by <VAR>more</VAR>--).
|
|
<P>
|
|
|
|
<A NAME="IDX1816"></A>
|
|
<DT><CODE>MAX_INTEGER_COMPUTATION_MODE</CODE>
|
|
<DD>Define this to the largest integer machine mode which can be used for
|
|
operations other than load, store and copy operations.
|
|
<P>
|
|
|
|
You need only define this macro if the target holds values larger than
|
|
<CODE>word_mode</CODE> in general purpose registers. Most targets should not define
|
|
this macro.
|
|
</P><P>
|
|
|
|
<A NAME="IDX1817"></A>
|
|
<DT><CODE>MATH_LIBRARY</CODE>
|
|
<DD>Define this macro as a C string constant for the linker argument to link
|
|
in the system math library, or <SAMP>`""'</SAMP> if the target does not have a
|
|
separate math library.
|
|
<P>
|
|
|
|
You need only define this macro if the default of <SAMP>`"-lm"'</SAMP> is wrong.
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="Config"></A>
|
|
<HR SIZE="6">
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_17.html#SEC201" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC201"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_18.html#SEC251" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_18.html#SEC251"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<BR>
|
|
<FONT SIZE="-1">
|
|
This document was generated
|
|
by <I>GCC Administrator</I> on <I>March, 17 2001</I>
|
|
using <A HREF="tppmsgs/msgs0.htm#1" tppabs="http://www.mathematik.uni-kl.de/~obachman/Texi2html"><I>texi2html</I></A>
|
|
|
|
</BODY>
|
|
</HTML>
|