This is doc/gccint.info, produced by makeinfo version 4.1 from
doc/gccint.texi.

INFO-DIR-SECTION Programming
START-INFO-DIR-ENTRY
* gccint: (gccint).            Internals of the GNU Compiler Collection.
END-INFO-DIR-ENTRY
   This file documents the internals of the GNU compilers.


   Published by the Free Software Foundation
59 Temple Place - Suite 330
Boston, MA 02111-1307 USA


   Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002 Free Software Foundation, Inc.


   Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.1 or
any later version published by the Free Software Foundation; with the
Invariant Sections being "GNU General Public License" and "Funding Free
Software", the Front-Cover texts being (a) (see below), and with the
Back-Cover Texts being (b) (see below).  A copy of the license is
included in the section entitled "GNU Free Documentation License".

   (a) The FSF's Front-Cover Text is:

   A GNU Manual

   (b) The FSF's Back-Cover Text is:

   You have freedom to copy and modify this GNU Manual, like GNU
software.  Copies published by the Free Software Foundation raise
funds for GNU development.


File: gccint.info,  Node: Costs,  Next: Scheduling,  Prev: Condition Code,  Up: Target Macros

Describing Relative Costs of Operations
=======================================

   These macros let you describe the relative speed of various
operations on the target machine.

`CONST_COSTS (X, CODE, OUTER_CODE)'
     A part of a C `switch' statement that describes the relative costs
     of constant RTL expressions.  It must contain `case' labels for
     expression codes `const_int', `const', `symbol_ref', `label_ref'
     and `const_double'.  Each case must ultimately reach a `return'
     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 X, and the rtx code of the expression in which it is contained,
     found in OUTER_CODE.

     CODE is the expression code--redundant, since it can be obtained
     with `GET_CODE (X)'.

`RTX_COSTS (X, CODE, OUTER_CODE)'
     Like `CONST_COSTS' 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
     `COSTS_N_INSNS (N)' to specify a cost equal to N fast
     instructions.  OUTER_CODE is the code of the expression in which X
     is contained.

     This macro is optional; do not define it if the default cost
     assumptions are adequate for the target machine.

`DEFAULT_RTX_COSTS (X, CODE, OUTER_CODE)'
     This macro, if defined, is called for any case not handled by the
     `RTX_COSTS' or `CONST_COSTS' 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 X could be of any type that has
     not already been handled.  The arguments are the same as for
     `RTX_COSTS', 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.

     This macro is optional; do not define it if the default cost
     assumptions are adequate for the target machine.

`ADDRESS_COST (ADDRESS)'
     An expression giving the cost of an addressing mode that contains
     ADDRESS.  If not defined, the cost is computed from the ADDRESS
     expression and the `CONST_COSTS' values.

     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.

     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.

     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.

     Similar use of this macro is made in strength reduction of loops.

     ADDRESS 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.

     On machines where an address involving more than one register is as
     cheap as an address computation involving only one register,
     defining `ADDRESS_COST' to reflect this can cause two registers to
     be live over a region of code where only one would have been if
     `ADDRESS_COST' 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.

     This macro will normally either not be defined or be defined as a
     constant.

`REGISTER_MOVE_COST (MODE, FROM, TO)'
     A C expression for the cost of moving data of mode MODE from a
     register in class FROM to one in class TO.  The classes are
     expressed using the enumeration values such as `GENERAL_REGS'.  A
     value of 2 is the default; other values are interpreted relative to
     that.

     It is not required that the cost always equal 2 when FROM is the
     same as TO; on some machines it is expensive to move between
     registers if they are not general registers.

     If reload sees an insn consisting of a single `set' between two
     hard registers, and if `REGISTER_MOVE_COST' 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 `movM' pattern's constraints do not allow
     such copying.

`MEMORY_MOVE_COST (MODE, CLASS, IN)'
     A C expression for the cost of moving data of mode MODE between a
     register of class CLASS and memory; IN is zero if the value is to
     be written to memory, nonzero if it is to be read in.  This cost
     is relative to those in `REGISTER_MOVE_COST'.  If moving between
     registers and memory is more expensive than between two registers,
     you should define this macro to express the relative cost.

     If you do not define this macro, GCC 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 CLASS but the reload
     mechanism is more complex than copying via an intermediate, define
     this macro to reflect the actual cost of the move.

     GCC defines the function `memory_move_secondary_cost' 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.

`BRANCH_COST'
     A C expression for the cost of a branch instruction.  A value of 1
     is the default; other values are interpreted relative to that.

   Here are additional macros which do not specify precise relative
costs, but only that certain actions are more expensive than GCC would
ordinarily expect.

`SLOW_BYTE_ACCESS'
     Define this macro as a C expression which is nonzero if accessing
     less than a word of memory (i.e. a `char' or a `short') 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.

     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.

`SLOW_UNALIGNED_ACCESS (MODE, ALIGNMENT)'
     Define this macro to be the value 1 if memory accesses described
     by the MODE and ALIGNMENT parameters have a cost many times greater
     than aligned accesses, for example if they are emulated in a trap
     handler.

     When this macro is nonzero, the compiler will act as if
     `STRICT_ALIGNMENT' were nonzero when generating code for block
     moves.  This can cause significantly more instructions to be
     produced.  Therefore, do not set this macro nonzero if unaligned
     accesses only add a cycle or two to the time for a memory access.

     If the value of this macro is always zero, it need not be defined.
     If this macro is defined, it should produce a nonzero value when
     `STRICT_ALIGNMENT' is nonzero.

`DONT_REDUCE_ADDR'
     Define this macro to inhibit strength reduction of memory
     addresses.  (On some machines, such strength reduction seems to do
     harm rather than good.)

`MOVE_RATIO'
     The threshold of number of scalar memory-to-memory move insns,
     _below_ 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.

     Note that on machines where the corresponding move insn is a
     `define_expand' that emits a sequence of insns, this macro counts
     the number of such sequences.

     If you don't define this, a reasonable default is used.

`MOVE_BY_PIECES_P (SIZE, ALIGNMENT)'
     A C expression used to determine whether `move_by_pieces' will be
     used to copy a chunk of memory, or whether some other block move
     mechanism will be used.  Defaults to 1 if `move_by_pieces_ninsns'
     returns less than `MOVE_RATIO'.

`MOVE_MAX_PIECES'
     A C expression used by `move_by_pieces' to determine the largest
     unit a load or store used to copy memory is.  Defaults to
     `MOVE_MAX'.

`USE_LOAD_POST_INCREMENT (MODE)'
     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
     `HAVE_POST_INCREMENT'.

`USE_LOAD_POST_DECREMENT (MODE)'
     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
     `HAVE_POST_DECREMENT'.

`USE_LOAD_PRE_INCREMENT (MODE)'
     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
     `HAVE_PRE_INCREMENT'.

`USE_LOAD_PRE_DECREMENT (MODE)'
     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
     `HAVE_PRE_DECREMENT'.

`USE_STORE_POST_INCREMENT (MODE)'
     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
     `HAVE_POST_INCREMENT'.

`USE_STORE_POST_DECREMENT (MODE)'
     A C expression used to determine whether a store postdecrement is
     a good thing to use for a given mode.  Defaults to the value of
     `HAVE_POST_DECREMENT'.

`USE_STORE_PRE_INCREMENT (MODE)'
     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
     `HAVE_PRE_INCREMENT'.

`USE_STORE_PRE_DECREMENT (MODE)'
     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
     `HAVE_PRE_DECREMENT'.

`NO_FUNCTION_CSE'
     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.

`NO_RECURSIVE_FUNCTION_CSE'
     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.


File: gccint.info,  Node: Scheduling,  Next: Sections,  Prev: Costs,  Up: Target Macros

Adjusting the Instruction Scheduler
===================================

   The instruction scheduler may need a fair amount of machine-specific
adjustment in order to produce good code.  GCC provides several target
hooks for this purpose.  It is usually enough to define just a few of
them: try the first ones in this list first.

 - Target Hook: int TARGET_SCHED_ISSUE_RATE (void)
     This hook returns the maximum number of instructions that can ever
     issue at the same time on the target machine.  The default is one.
     This value must be constant over the entire compilation.  If you
     need it to vary depending on what the instructions are, you must
     use `TARGET_SCHED_VARIABLE_ISSUE'.

 - Target Hook: int TARGET_SCHED_VARIABLE_ISSUE (FILE *FILE, int
          VERBOSE, rtx INSN, int MORE)
     This hook is executed by the scheduler after it has scheduled an
     insn from the ready list.  It should return the number of insns
     which can still be issued in the current cycle.  Normally this is
     `MORE - 1'.  You should define this hook if some insns take more
     machine resources than others, so that fewer insns can follow them
     in the same cycle.  FILE is either a null pointer, or a stdio
     stream to write any debug output to.  VERBOSE is the verbose level
     provided by `-fsched-verbose-N'.  INSN is the instruction that was
     scheduled.

 - Target Hook: int TARGET_SCHED_ADJUST_COST (rtx INSN, rtx LINK, rtx
          DEP_INSN, int COST)
     This function corrects the value of COST based on the relationship
     between INSN and DEP_INSN through the dependence LINK.  It should
     return the new value.  The default is to make no adjustment to
     COST.  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.

 - Target Hook: int TARGET_SCHED_ADJUST_PRIORITY (rtx INSN, int
          PRIORITY)
     This hook adjusts the integer scheduling priority PRIORITY of
     INSN.  It should return the new priority.  Reduce the priority to
     execute INSN earlier, increase the priority to execute INSN later.
     Do not define this hook if you do not need to adjust the
     scheduling priorities of insns.

 - Target Hook: int TARGET_SCHED_REORDER (FILE *FILE, int VERBOSE, rtx
          *READY, int *N_READYP, int CLOCK)
     This hook is executed by the 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 `VLIW'
     machines).  FILE is either a null pointer, or a stdio stream to
     write any debug output to.  VERBOSE is the verbose level provided
     by `-fsched-verbose-N'.  READY is a pointer to the ready list of
     instructions that are ready to be scheduled.  N_READYP is a
     pointer to the number of elements in the ready list.  The scheduler
     reads the ready list in reverse order, starting with
     READY[*N_READYP-1] and going to READY[0].  CLOCK is the timer tick
     of the scheduler.  You may modify the ready list and the number of
     ready insns.  The return value is the number of insns that can
     issue this cycle; normally this is just `issue_rate'.  See also
     `TARGET_SCHED_REORDER2'.

 - Target Hook: int TARGET_SCHED_REORDER2 (FILE *FILE, int VERBOSE, rtx
          *READY, int *N_READY, CLOCK)
     Like `TARGET_SCHED_REORDER', but called at a different time.  That
     function is called whenever the scheduler starts a new cycle.
     This one is called once per iteration over a cycle, immediately
     after `TARGET_SCHED_VARIABLE_ISSUE'; it can reorder the ready list
     and return the number of insns to be scheduled in the same cycle.
     Defining this hook can be useful if there are frequent situations
     where scheduling one insn causes other insns to become ready in
     the same cycle.  These other insns can then be taken into account
     properly.

 - Target Hook: void TARGET_SCHED_INIT (FILE *FILE, int VERBOSE, int
          MAX_READY)
     This hook is executed by the scheduler at the beginning of each
     block of instructions that are to be scheduled.  FILE is either a
     null pointer, or a stdio stream to write any debug output to.
     VERBOSE is the verbose level provided by `-fsched-verbose-N'.
     MAX_READY is the maximum number of insns in the current scheduling
     region that can be live at the same time.  This can be used to
     allocate scratch space if it is needed, e.g. by
     `TARGET_SCHED_REORDER'.

 - Target Hook: void TARGET_SCHED_FINISH (FILE *FILE, int VERBOSE)
     This hook is executed by the scheduler at the end of each block of
     instructions that are to be scheduled.  It can be used to perform
     cleanup of any actions done by the other scheduling hooks.  FILE
     is either a null pointer, or a stdio stream to write any debug
     output to.  VERBOSE is the verbose level provided by
     `-fsched-verbose-N'.

 - Target Hook: rtx TARGET_SCHED_CYCLE_DISPLAY (int CLOCK, rtx LAST)
     This hook is called in verbose mode only, at the beginning of each
     pass over a basic block.  It should insert an insn into the chain
     after LAST, which has no effect, but records the value CLOCK in
     RTL dumps and assembly output.  Define this hook only if you need
     this level of detail about what the scheduler is doing.


File: gccint.info,  Node: Sections,  Next: PIC,  Prev: Scheduling,  Up: Target Macros

Dividing the Output into Sections (Texts, Data, ...)
====================================================

   An object file is divided into sections containing different types of
data.  In the most common case, there are three sections: the "text
section", which holds instructions and read-only data; the "data
section", which holds initialized writable data; and the "bss section",
which holds uninitialized data.  Some systems have other kinds of
sections.

   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.

`TEXT_SECTION_ASM_OP'
     A C expression whose value is a string, including spacing,
     containing the assembler operation that should precede
     instructions and read-only data.  Normally `"\t.text"' is right.

`TEXT_SECTION'
     A C statement that switches to the default section containing
     instructions.  Normally this is not needed, as simply defining
     `TEXT_SECTION_ASM_OP' is enough.  The MIPS port uses this to sort
     all functions after all data declarations.

`DATA_SECTION_ASM_OP'
     A C expression whose value is a string, including spacing,
     containing the assembler operation to identify the following data
     as writable initialized data.  Normally `"\t.data"' is right.

`SHARED_SECTION_ASM_OP'
     If defined, a C expression whose value is a string, including
     spacing, containing the assembler operation to identify the
     following data as shared data.  If not defined,
     `DATA_SECTION_ASM_OP' will be used.

`BSS_SECTION_ASM_OP'
     If defined, a C expression whose value is a string, including
     spacing, containing the assembler operation to identify the
     following data as uninitialized global data.  If not defined, and
     neither `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined,
     uninitialized global data will be output in the data section if
     `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be
     used.

`SHARED_BSS_SECTION_ASM_OP'
     If defined, a C expression whose value is a string, including
     spacing, containing the assembler operation to identify the
     following data as uninitialized global shared data.  If not
     defined, and `BSS_SECTION_ASM_OP' is, the latter will be used.

`INIT_SECTION_ASM_OP'
     If defined, a C expression whose value is a string, including
     spacing, containing the assembler operation to identify the
     following data as initialization code.  If not defined, GCC will
     assume such a section does not exist.

`FINI_SECTION_ASM_OP'
     If defined, a C expression whose value is a string, including
     spacing, containing the assembler operation to identify the
     following data as finalization code.  If not defined, GCC will
     assume such a section does not exist.

`ASM_SECTION_END (STREAM)'
     If defined, a C expression to output to the stdio stream STREAM
     anything needed to end the current section.  If not defined,
     nothing will be output.

`CRT_CALL_STATIC_FUNCTION (SECTION_OP, FUNCTION)'
     If defined, an ASM statement that switches to a different section
     via SECTION_OP, calls FUNCTION, and switches back to the text
     section.  This is used in `crtstuff.c' if `INIT_SECTION_ASM_OP' or
     `FINI_SECTION_ASM_OP' to calls to initialization and finalization
     functions from the init and fini sections.  By default, this macro
     uses a simple function call.  Some ports need hand-crafted
     assembly code to avoid dependencies on registers initialized in
     the function prologue or to ensure that constant pools don't end
     up too far way in the text section.

`FORCE_CODE_SECTION_ALIGN'
     If defined, an ASM statement that aligns a code section to some
     arbitrary boundary.  This is used to force all fragments of the
     `.init' and `.fini' sections to have to same alignment and thus
     prevent the linker from having to add any padding.

`EXTRA_SECTIONS'
     A list of names for sections other than the standard two, which are
     `in_text' and `in_data'.  You need not define this macro on a
     system with no other sections (that GCC needs to use).

`EXTRA_SECTION_FUNCTIONS'
     One or more functions to be defined in `varasm.c'.  These
     functions should do jobs analogous to those of `text_section' and
     `data_section', for your additional sections.  Do not define this
     macro if you do not define `EXTRA_SECTIONS'.

`READONLY_DATA_SECTION'
     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 `data_section' or a function defined in `EXTRA_SECTIONS')
     that switches to the section to be used for read-only items.

     If these items should be placed in the text section, this macro
     should not be defined.

`SELECT_SECTION (EXP, RELOC, ALIGN)'
     A C statement or statements to switch to the appropriate section
     for output of EXP.  You can assume that EXP is either a `VAR_DECL'
     node or a constant of some sort.  RELOC indicates whether the
     initial value of EXP requires link-time relocations.  Bit 1 is set
     when variable contains local relocations only, while bit 2 is set
     for global relocations.  Select the section by calling
     `text_section' or one of the alternatives for other sections.
     ALIGN is the constant alignment in bits.

     Do not define this macro if you put all read-only variables and
     constants in the read-only data section (usually the text section).

`SELECT_RTX_SECTION (MODE, RTX, ALIGN)'
     A C statement or statements to switch to the appropriate section
     for output of RTX in mode MODE.  You can assume that RTX is some
     kind of constant in RTL.  The argument MODE is redundant except in
     the case of a `const_int' rtx.  Select the section by calling
     `text_section' or one of the alternatives for other sections.
     ALIGN is the constant alignment in bits.

     Do not define this macro if you put all constants in the read-only
     data section.

`JUMP_TABLES_IN_TEXT_SECTION'
     Define this macro to be an expression with a nonzero value if jump
     tables (for `tablejump' insns) should be output in the text
     section, along with the assembler instructions.  Otherwise, the
     readonly data section is used.

     This macro is irrelevant if there is no separate readonly data
     section.

`ENCODE_SECTION_INFO (DECL, NEW_DECL_P)'
     Define this macro if references to a symbol or a constant must be
     treated differently depending on something about the variable or
     function named by the symbol (such as what section it is in).

     The macro definition, if any, is executed under two circumstances.
     One is immediately after the rtl for DECL that represents a
     variable or a function has been created and stored in
     `DECL_RTL(DECL)'.  The value of the rtl will be a `mem' whose
     address is a `symbol_ref'.  The other is immediately after the rtl
     for DECL that represents a constant has been created and stored in
     `TREE_CST_RTL (DECL)'.  The macro is called once for each distinct
     constant in a source file.

     The NEW_DECL_P argument will be true if this is the first time that
     `ENCODE_SECTION_INFO' has been invoked on this decl.  It will be
     false for subsequent invocations, which will happen for duplicate
     declarations.  Whether or not anything must be done for the
     duplicate declaration depends on whether `ENCODE_SECTION_INFO'
     examines `DECL_ATTRIBUTES'.

     The usual thing for this macro to do is to record a flag in the
     `symbol_ref' (such as `SYMBOL_REF_FLAG') or to store a modified
     name string in the `symbol_ref' (if one bit is not enough
     information).

`STRIP_NAME_ENCODING (VAR, SYM_NAME)'
     Decode SYM_NAME and store the real name part in VAR, sans the
     characters that encode section info.  Define this macro if
     `ENCODE_SECTION_INFO' alters the symbol's name string.

`UNIQUE_SECTION (DECL, RELOC)'
     A C statement to build up a unique section name, expressed as a
     `STRING_CST' node, and assign it to `DECL_SECTION_NAME (DECL)'.
     RELOC indicates whether the initial value of EXP requires
     link-time relocations.  If you do not define this macro, GCC will
     use the symbol name prefixed by `.' as the section name.  Note -
     this macro can now be called for uninitialized data items as well
     as initialized data and functions.


File: gccint.info,  Node: PIC,  Next: Assembler Format,  Prev: Sections,  Up: Target Macros

Position Independent Code
=========================

   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
`GO_IF_LEGITIMATE_ADDRESS' and `PRINT_OPERAND_ADDRESS', as well as
`LEGITIMIZE_ADDRESS'.  You must modify the definition of `movsi' 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.

`PIC_OFFSET_TABLE_REGNUM'
     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).  Note that this
     register must be fixed when in use (e.g.  when `flag_pic' is true).

`PIC_OFFSET_TABLE_REG_CALL_CLOBBERED'
     Define this macro if the register defined by
     `PIC_OFFSET_TABLE_REGNUM' is clobbered by calls.  Do not define
     this macro if `PIC_OFFSET_TABLE_REGNUM' is not defined.

`FINALIZE_PIC'
     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.

     The `FINALIZE_PIC' 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.)

`LEGITIMATE_PIC_OPERAND_P (X)'
     A C expression that is nonzero if X is a legitimate immediate
     operand on the target machine when generating position independent
     code.  You can assume that X satisfies `CONSTANT_P', so you need
     not check this.  You can also assume FLAG_PIC is true, so you need
     not check it either.  You need not define this macro if all
     constants (including `SYMBOL_REF') can be immediate operands when
     generating position independent code.


File: gccint.info,  Node: Assembler Format,  Next: Debugging Info,  Prev: PIC,  Up: Target Macros

Defining the Output Assembler Language
======================================

   This section describes macros whose principal purpose is to describe
how to write instructions in assembler language--rather than what the
instructions do.

* Menu:

* File Framework::       Structural information for the assembler file.
* Data Output::          Output of constants (numbers, strings, addresses).
* Uninitialized Data::   Output of uninitialized variables.
* Label Output::         Output and generation of labels.
* Initialization::       General principles of initialization
			   and termination routines.
* Macros for Initialization::
			 Specific macros that control the handling of
			   initialization and termination routines.
* Instruction Output::   Output of actual instructions.
* Dispatch Tables::      Output of jump tables.
* Exception Region Output:: Output of exception region code.
* Alignment Output::     Pseudo ops for alignment and skipping data.


File: gccint.info,  Node: File Framework,  Next: Data Output,  Up: Assembler Format

The Overall Framework of an Assembler File
------------------------------------------

   This describes the overall framework of an assembler file.

`ASM_FILE_START (STREAM)'
     A C expression which outputs to the stdio stream STREAM some
     appropriate text to go at the start of an assembler file.

     Normally this macro is defined to output a line containing
     `#NO_APP', 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.

     On systems that use SDB, it is necessary to output certain
     commands; see `attasm.h'.

`ASM_FILE_END (STREAM)'
     A C expression which outputs to the stdio stream STREAM some
     appropriate text to go at the end of an assembler file.

     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.

     On systems that use SDB, it is necessary to output certain
     commands; see `attasm.h'.

`ASM_COMMENT_START'
     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.

`ASM_APP_ON'
     A C string constant for text to be output before each `asm'
     statement or group of consecutive ones.  Normally this is
     `"#APP"', 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.

`ASM_APP_OFF'
     A C string constant for text to be output after each `asm'
     statement or group of consecutive ones.  Normally this is
     `"#NO_APP"', which tells the GNU assembler to resume making the
     time-saving assumptions that are valid for ordinary compiler
     output.

`ASM_OUTPUT_SOURCE_FILENAME (STREAM, NAME)'
     A C statement to output COFF information or DWARF debugging
     information which indicates that filename NAME is the current
     source file to the stdio stream STREAM.

     This macro need not be defined if the standard form of output for
     the file format in use is appropriate.

`OUTPUT_QUOTED_STRING (STREAM, STRING)'
     A C statement to output the string STRING to the stdio stream
     STREAM.  If you do not call the function `output_quoted_string' in
     your config files, GCC 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.

`ASM_OUTPUT_SOURCE_LINE (STREAM, LINE)'
     A C statement to output DBX or SDB debugging information before
     code for line number LINE of the current source file to the stdio
     stream STREAM.

     This macro need not be defined if the standard form of debugging
     information for the debugger in use is appropriate.

`ASM_OUTPUT_IDENT (STREAM, STRING)'
     A C statement to output something to the assembler file to handle a
     `#ident' directive containing the text STRING.  If this macro is
     not defined, nothing is output for a `#ident' directive.

`OBJC_PROLOGUE'
     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.

 - Target Hook: void TARGET_ASM_NAMED_SECTION (const char *NAME,
          unsigned int FLAGS, unsigned int ALIGN)
     Output assembly directives to switch to section NAME.  The section
     should have attributes as specified by FLAGS, which is a bit mask
     of the `SECTION_*' flags defined in `output.h'.  If ALIGN is
     nonzero, it contains an alignment in bytes to be used for the
     section, otherwise some target default should be used.  Only
     targets that must specify an alignment within the section
     directive need pay attention to ALIGN - we will still use
     `ASM_OUTPUT_ALIGN'.

 - Target Hook: bool TARGET_HAVE_NAMED_SECTIONS
     This flag is true if the target supports
     `TARGET_ASM_NAMED_SECTION'.

 - Target Hook: unsigned int TARGET_SECTION_TYPE_FLAGS (tree DECL,
          const char *NAME, int RELOC)
     Choose a set of section attributes for use by
     `TARGET_ASM_NAMED_SECTION' based on a variable or function decl, a
     section name, and whether or not the declaration's initializer may
     contain runtime relocations.  DECL may be  null, in which case
     read-write data should be assumed.

     The default version if this function handles choosing code vs data,
     read-only vs read-write data, and `flag_pic'.  You should only
     need to override this if your target has special flags that might
     be set via `__attribute__'.


File: gccint.info,  Node: Data Output,  Next: Uninitialized Data,  Prev: File Framework,  Up: Assembler Format

Output of Data
--------------

 - Target Hook: const char * TARGET_ASM_BYTE_OP
 - Target Hook: const char * TARGET_ASM_ALIGNED_HI_OP
 - Target Hook: const char * TARGET_ASM_ALIGNED_SI_OP
 - Target Hook: const char * TARGET_ASM_ALIGNED_DI_OP
 - Target Hook: const char * TARGET_ASM_ALIGNED_TI_OP
 - Target Hook: const char * TARGET_ASM_UNALIGNED_HI_OP
 - Target Hook: const char * TARGET_ASM_UNALIGNED_SI_OP
 - Target Hook: const char * TARGET_ASM_UNALIGNED_DI_OP
 - Target Hook: const char * TARGET_ASM_UNALIGNED_TI_OP
     These hooks specify assembly directives for creating certain kinds
     of integer object.  The `TARGET_ASM_BYTE_OP' directive creates a
     byte-sized object, the `TARGET_ASM_ALIGNED_HI_OP' one creates an
     aligned two-byte object, and so on.  Any of the hooks may be
     `NULL', indicating that no suitable directive is available.

     The compiler will print these strings at the start of a new line,
     followed immediately by the object's initial value.  In most cases,
     the string should contain a tab, a pseudo-op, and then another tab.

 - Target Hook: bool TARGET_ASM_INTEGER (rtx X, unsigned int SIZE, int
          ALIGNED_P)
     The `assemble_integer' function uses this hook to output an
     integer object.  X is the object's value, SIZE is its size in
     bytes and ALIGNED_P indicates whether it is aligned.  The function
     should return `true' if it was able to output the object.  If it
     returns false, `assemble_integer' will try to split the object
     into smaller parts.

     The default implementation of this hook will use the
     `TARGET_ASM_BYTE_OP' family of strings, returning `false' when the
     relevant string is `NULL'.

`OUTPUT_ADDR_CONST_EXTRA (STREAM, X, FAIL)'
     A C statement to recognize RTX patterns that `output_addr_const'
     can't deal with, and output assembly code to STREAM corresponding
     to the pattern X.  This may be used to allow machine-dependent
     `UNSPEC's to appear within constants.

     If `OUTPUT_ADDR_CONST_EXTRA' fails to recognize a pattern, it must
     `goto fail', so that a standard error message is printed.  If it
     prints an error message itself, by calling, for example,
     `output_operand_lossage', it may just complete normally.

`ASM_OUTPUT_ASCII (STREAM, PTR, LEN)'
     A C statement to output to the stdio stream STREAM an assembler
     instruction to assemble a string constant containing the LEN bytes
     at PTR.  PTR will be a C expression of type `char *' and LEN a C
     expression of type `int'.

     If the assembler has a `.ascii' pseudo-op as found in the Berkeley
     Unix assembler, do not define the macro `ASM_OUTPUT_ASCII'.

`ASM_OUTPUT_FDESC (STREAM, DECL, N)'
     A C statement to output word N of a function descriptor for DECL.
     This must be defined if `TARGET_VTABLE_USES_DESCRIPTORS' is
     defined, and is otherwise unused.

`CONSTANT_POOL_BEFORE_FUNCTION'
     You may define this macro as a C expression.  You should define the
     expression to have a nonzero value if GCC should output the
     constant pool for a function before the code for the function, or
     a zero value if GCC should output the constant pool after the
     function.  If you do not define this macro, the usual case, GCC
     will output the constant pool before the function.

`ASM_OUTPUT_POOL_PROLOGUE (FILE, FUNNAME, FUNDECL, SIZE)'
     A C statement to output assembler commands to define the start of
     the constant pool for a function.  FUNNAME is a string giving the
     name of the function.  Should the return type of the function be
     required, it can be obtained via FUNDECL.  SIZE is the size, in
     bytes, of the constant pool that will be written immediately after
     this call.

     If no constant-pool prefix is required, the usual case, this macro
     need not be defined.

`ASM_OUTPUT_SPECIAL_POOL_ENTRY (FILE, X, MODE, ALIGN, LABELNO, JUMPTO)'
     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.)

     The argument FILE is the standard I/O stream to output the
     assembler code on.  X is the RTL expression for the constant to
     output, and MODE is the machine mode (in case X is a `const_int').
     ALIGN is the required alignment for the value X; you should
     output an assembler directive to force this much alignment.

     The argument LABELNO 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:

          ASM_OUTPUT_INTERNAL_LABEL (FILE, "LC", LABELNO);

     When you output a pool entry specially, you should end with a
     `goto' to the label JUMPTO.  This will prevent the same pool entry
     from being output a second time in the usual manner.

     You need not define this macro if it would do nothing.

`CONSTANT_AFTER_FUNCTION_P (EXP)'
     Define this macro as a C expression which is nonzero if the
     constant EXP, of type `tree', 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.

`ASM_OUTPUT_POOL_EPILOGUE (FILE FUNNAME FUNDECL SIZE)'
     A C statement to output assembler commands to at the end of the
     constant pool for a function.  FUNNAME is a string giving the name
     of the function.  Should the return type of the function be
     required, you can obtain it via FUNDECL.  SIZE is the size, in
     bytes, of the constant pool that GCC wrote immediately before this
     call.

     If no constant-pool epilogue is required, the usual case, you need
     not define this macro.

`IS_ASM_LOGICAL_LINE_SEPARATOR (C)'
     Define this macro as a C expression which is nonzero if C is used
     as a logical line separator by the assembler.

     If you do not define this macro, the default is that only the
     character `;' is treated as a logical line separator.

 - Target Hook: const char * TARGET_ASM_OPEN_PAREN
 - Target Hook: const char * TARGET_ASM_CLOSE_PAREN
     These target hooks are C string constants, describing the syntax
     in the assembler for grouping arithmetic expressions.  If not
     overridden, they default to normal parentheses, which is correct
     for most assemblers.

   These macros are provided by `real.h' for writing the definitions of
`ASM_OUTPUT_DOUBLE' and the like:

`REAL_VALUE_TO_TARGET_SINGLE (X, L)'
`REAL_VALUE_TO_TARGET_DOUBLE (X, L)'
`REAL_VALUE_TO_TARGET_LONG_DOUBLE (X, L)'
     These translate X, of type `REAL_VALUE_TYPE', to the target's
     floating point representation, and store its bit pattern in the
     variable L.  For `REAL_VALUE_TO_TARGET_SINGLE', this variable
     should be a simple `long int'.  For the others, it should be an
     array of `long int'.  The number of elements in this array is
     determined by the size of the desired target floating point data
     type: 32 bits of it go in each `long int' array element.  Each
     array element holds 32 bits of the result, even if `long int' is
     wider than 32 bits on the host machine.

     The array element values are designed so that you can print them
     out using `fprintf' in the order they should appear in the target
     machine's memory.

`REAL_VALUE_TO_DECIMAL (X, FORMAT, STRING)'
     This macro converts X, of type `REAL_VALUE_TYPE', to a decimal
     number and stores it as a string into STRING.  You must pass, as
     STRING, the address of a long enough block of space to hold the
     result.

     The argument FORMAT is a `printf'-specification that serves as a
     suggestion for how to format the output string.


File: gccint.info,  Node: Uninitialized Data,  Next: Label Output,  Prev: Data Output,  Up: Assembler Format

Output of Uninitialized Variables
---------------------------------

   Each of the macros in this section is used to do the whole job of
outputting a single uninitialized variable.

`ASM_OUTPUT_COMMON (STREAM, NAME, SIZE, ROUNDED)'
     A C statement (sans semicolon) to output to the stdio stream
     STREAM the assembler definition of a common-label named NAME whose
     size is SIZE bytes.  The variable ROUNDED is the size rounded up
     to whatever alignment the caller wants.

     Use the expression `assemble_name (STREAM, NAME)' to output the
     name itself; before and after that, output the additional
     assembler syntax for defining the name, and a newline.

     This macro controls how the assembler definitions of uninitialized
     common global variables are output.

`ASM_OUTPUT_ALIGNED_COMMON (STREAM, NAME, SIZE, ALIGNMENT)'
     Like `ASM_OUTPUT_COMMON' except takes the required alignment as a
     separate, explicit argument.  If you define this macro, it is used
     in place of `ASM_OUTPUT_COMMON', and gives you more flexibility in
     handling the required alignment of the variable.  The alignment is
     specified as the number of bits.

`ASM_OUTPUT_ALIGNED_DECL_COMMON (STREAM, DECL, NAME, SIZE, ALIGNMENT)'
     Like `ASM_OUTPUT_ALIGNED_COMMON' except that DECL of the variable
     to be output, if there is one, or `NULL_TREE' if there is no
     corresponding variable.  If you define this macro, GCC will use it
     in place of both `ASM_OUTPUT_COMMON' and
     `ASM_OUTPUT_ALIGNED_COMMON'.  Define this macro when you need to
     see the variable's decl in order to chose what to output.

`ASM_OUTPUT_SHARED_COMMON (STREAM, NAME, SIZE, ROUNDED)'
     If defined, it is similar to `ASM_OUTPUT_COMMON', except that it
     is used when NAME is shared.  If not defined, `ASM_OUTPUT_COMMON'
     will be used.

`ASM_OUTPUT_BSS (STREAM, DECL, NAME, SIZE, ROUNDED)'
     A C statement (sans semicolon) to output to the stdio stream
     STREAM the assembler definition of uninitialized global DECL named
     NAME whose size is SIZE bytes.  The variable ROUNDED is the size
     rounded up to whatever alignment the caller wants.

     Try to use function `asm_output_bss' defined in `varasm.c' when
     defining this macro.  If unable, use the expression `assemble_name
     (STREAM, NAME)' to output the name itself; before and after that,
     output the additional assembler syntax for defining the name, and
     a newline.

     This macro controls how the assembler definitions of uninitialized
     global variables are output.  This macro exists to properly
     support languages like C++ which do not have `common' data.
     However, this macro currently is not defined for all targets.  If
     this macro and `ASM_OUTPUT_ALIGNED_BSS' are not defined then
     `ASM_OUTPUT_COMMON' or `ASM_OUTPUT_ALIGNED_COMMON' or
     `ASM_OUTPUT_ALIGNED_DECL_COMMON' is used.

`ASM_OUTPUT_ALIGNED_BSS (STREAM, DECL, NAME, SIZE, ALIGNMENT)'
     Like `ASM_OUTPUT_BSS' except takes the required alignment as a
     separate, explicit argument.  If you define this macro, it is used
     in place of `ASM_OUTPUT_BSS', and gives you more flexibility in
     handling the required alignment of the variable.  The alignment is
     specified as the number of bits.

     Try to use function `asm_output_aligned_bss' defined in file
     `varasm.c' when defining this macro.

`ASM_OUTPUT_SHARED_BSS (STREAM, DECL, NAME, SIZE, ROUNDED)'
     If defined, it is similar to `ASM_OUTPUT_BSS', except that it is
     used when NAME is shared.  If not defined, `ASM_OUTPUT_BSS' will
     be used.

`ASM_OUTPUT_LOCAL (STREAM, NAME, SIZE, ROUNDED)'
     A C statement (sans semicolon) to output to the stdio stream
     STREAM the assembler definition of a local-common-label named NAME
     whose size is SIZE bytes.  The variable ROUNDED is the size
     rounded up to whatever alignment the caller wants.

     Use the expression `assemble_name (STREAM, NAME)' to output the
     name itself; before and after that, output the additional
     assembler syntax for defining the name, and a newline.

     This macro controls how the assembler definitions of uninitialized
     static variables are output.

`ASM_OUTPUT_ALIGNED_LOCAL (STREAM, NAME, SIZE, ALIGNMENT)'
     Like `ASM_OUTPUT_LOCAL' except takes the required alignment as a
     separate, explicit argument.  If you define this macro, it is used
     in place of `ASM_OUTPUT_LOCAL', and gives you more flexibility in
     handling the required alignment of the variable.  The alignment is
     specified as the number of bits.

`ASM_OUTPUT_ALIGNED_DECL_LOCAL (STREAM, DECL, NAME, SIZE, ALIGNMENT)'
     Like `ASM_OUTPUT_ALIGNED_DECL' except that DECL of the variable to
     be output, if there is one, or `NULL_TREE' if there is no
     corresponding variable.  If you define this macro, GCC will use it
     in place of both `ASM_OUTPUT_DECL' and `ASM_OUTPUT_ALIGNED_DECL'.
     Define this macro when you need to see the variable's decl in
     order to chose what to output.

`ASM_OUTPUT_SHARED_LOCAL (STREAM, NAME, SIZE, ROUNDED)'
     If defined, it is similar to `ASM_OUTPUT_LOCAL', except that it is
     used when NAME is shared.  If not defined, `ASM_OUTPUT_LOCAL' will
     be used.

