home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 4 / FreshFish_May-June1994.bin / bbs / gnu / gcc-2.3.3-src.lha / src / amiga / gcc-2.3.3 / gcc.info-17 < prev    next >
Encoding:
GNU Info File  |  1994-02-07  |  44.1 KB  |  986 lines

  1. This is Info file gcc.info, produced by Makeinfo-1.49 from the input
  2. file gcc.texi.
  3.  
  4.    This file documents the use and the internals of the GNU compiler.
  5.  
  6.    Copyright (C) 1988, 1989, 1992 Free Software Foundation, Inc.
  7.  
  8.    Permission is granted to make and distribute verbatim copies of this
  9. manual provided the copyright notice and this permission notice are
  10. preserved on all copies.
  11.  
  12.    Permission is granted to copy and distribute modified versions of
  13. this manual under the conditions for verbatim copying, provided also
  14. that the sections entitled "GNU General Public License" and "Protect
  15. Your Freedom--Fight `Look And Feel'" are included exactly as in the
  16. original, and provided that the entire resulting derived work is
  17. distributed under the terms of a permission notice identical to this
  18. one.
  19.  
  20.    Permission is granted to copy and distribute translations of this
  21. manual into another language, under the above conditions for modified
  22. versions, except that the sections entitled "GNU General Public
  23. License" and "Protect Your Freedom--Fight `Look And Feel'", and this
  24. permission notice, may be included in translations approved by the Free
  25. Software Foundation instead of in the original English.
  26.  
  27. 
  28. File: gcc.info,  Node: Costs,  Next: Sections,  Prev: Condition Code,  Up: Target Macros
  29.  
  30. Describing Relative Costs of Operations
  31. =======================================
  32.  
  33.    These macros let you describe the relative speed of various
  34. operations on the target machine.
  35.  
  36. `CONST_COSTS (X, CODE, OUTER_CODE)'
  37.      A part of a C `switch' statement that describes the relative costs
  38.      of constant RTL expressions.  It must contain `case' labels for
  39.      expression codes `const_int', `const', `symbol_ref', `label_ref'
  40.      and `const_double'.  Each case must ultimately reach a `return'
  41.      statement to return the relative cost of the use of that kind of
  42.      constant value in an expression.  The cost may depend on the
  43.      precise value of the constant, which is available for examination
  44.      in X, and the rtx code of the expression in which it is contained,
  45.      found in OUTER_CODE.
  46.  
  47.      CODE is the expression code--redundant, since it can be obtained
  48.      with `GET_CODE (X)'.
  49.  
  50. `RTX_COSTS (X, CODE, OUTER_CODE)'
  51.      Like `CONST_COSTS' but applies to nonconstant RTL expressions.
  52.      This can be used, for example, to indicate how costly a multiply
  53.      instruction is.  In writing this macro, you can use the construct
  54.      `COSTS_N_INSNS (N)' to specify a cost equal to N fast
  55.      instructions.  OUTER_CODE is the code of the expression in which X
  56.      is contained.
  57.  
  58.      This macro is optional; do not define it if the default cost
  59.      assumptions are adequate for the target machine.
  60.  
  61. `ADDRESS_COST (ADDRESS)'
  62.      An expression giving the cost of an addressing mode that contains
  63.      ADDRESS.  If not defined, the cost is computed from the ADDRESS
  64.      expression and the `CONST_COSTS' values.
  65.  
  66.      For most CISC machines, the default cost is a good approximation
  67.      of the true cost of the addressing mode.  However, on RISC
  68.      machines, all instructions normally have the same length and
  69.      execution time.  Hence all addresses will have equal costs.
  70.  
  71.      In cases where more than one form of an address is known, the form
  72.      with the lowest cost will be used.  If multiple forms have the
  73.      same, lowest, cost, the one that is the most complex will be used.
  74.  
  75.      For example, suppose an address that is equal to the sum of a
  76.      register and a constant is used twice in the same basic block. 
  77.      When this macro is not defined, the address will be computed in a
  78.      register and memory references will be indirect through that
  79.      register.  On machines where the cost of the addressing mode
  80.      containing the sum is no higher than that of a simple indirect
  81.      reference, this will produce an additional instruction and
  82.      possibly require an additional register.  Proper specification of
  83.      this macro eliminates this overhead for such machines.
  84.  
  85.      Similar use of this macro is made in strength reduction of loops.
  86.  
  87.      ADDRESS need not be valid as an address.  In such a case, the cost
  88.      is not relevant and can be any value; invalid addresses need not be
  89.      assigned a different cost.
  90.  
  91.      On machines where an address involving more than one register is as
  92.      cheap as an address computation involving only one register,
  93.      defining `ADDRESS_COST' to reflect this can cause two registers to
  94.      be live over a region of code where only one would have been if
  95.      `ADDRESS_COST' were not defined in that manner.  This effect should
  96.      be considered in the definition of this macro.  Equivalent costs
  97.      should probably only be given to addresses with different numbers
  98.      of registers on machines with lots of registers.
  99.  
  100.      This macro will normally either not be defined or be defined as a
  101.      constant.
  102.  
  103. `REGISTER_MOVE_COST (FROM, TO)'
  104.      A C expression for the cost of moving data from a register in class
  105.      FROM to one in class TO.  The classes are expressed using the
  106.      enumeration values such as `GENERAL_REGS'.  A value of 2 is the
  107.      default; other values are interpreted relative to that.
  108.  
  109.      It is not required that the cost always equal 2 when FROM is the
  110.      same as TO; on some machines it is expensive to move between
  111.      registers if they are not general registers.
  112.  
  113.      If reload sees an insn consisting of a single `set' between two
  114.      hard registers, and if `REGISTER_MOVE_COST' applied to their
  115.      classes returns a value of 2, reload does not check to ensure that
  116.      the constraints of the insn are met.  Setting a cost of other than
  117.      2 will allow reload to verify that the constraints are met.  You
  118.      should do this if the `movM' pattern's constraints do not allow
  119.      such copying.
  120.  
  121. `MEMORY_MOVE_COST (M)'
  122.      A C expression for the cost of moving data of mode M between a
  123.      register and memory.  A value of 2 is the default; this cost is
  124.      relative to those in `REGISTER_MOVE_COST'.
  125.  
  126.      If moving between registers and memory is more expensive than
  127.      between two registers, you should define this macro to express the
  128.      relative cost.
  129.  
  130. `BRANCH_COST'
  131.      A C expression for the cost of a branch instruction.  A value of 1
  132.      is the default; other values are interpreted relative to that.
  133.  
  134.    Here are additional macros which do not specify precise relative
  135. costs, but only that certain actions are more expensive than GNU CC
  136. would ordinarily expect.
  137.  
  138. `SLOW_BYTE_ACCESS'
  139.      Define this macro as a C expression which is nonzero if accessing
  140.      less than a word of memory (i.e. a `char' or a `short') is no
  141.      faster than accessing a word of memory, i.e., if such access
  142.      require more than one instruction or if there is no difference in
  143.      cost between byte and (aligned) word loads.
  144.  
  145.      When this macro is not defined, the compiler will access a field by
  146.      finding the smallest containing object; when it is defined, a
  147.      fullword load will be used if alignment permits.  Unless bytes
  148.      accesses are faster than word accesses, using word accesses is
  149.      preferable since it may eliminate subsequent memory access if
  150.      subsequent accesses occur to other fields in the same word of the
  151.      structure, but to different bytes.
  152.  
  153. `SLOW_ZERO_EXTEND'
  154.      Define this macro if zero-extension (of a `char' or `short' to an
  155.      `int') can be done faster if the destination is a register that is
  156.      known to be zero.
  157.  
  158.      If you define this macro, you must have instruction patterns that
  159.      recognize RTL structures like this:
  160.  
  161.           (set (strict_low_part (subreg:QI (reg:SI ...) 0)) ...)
  162.  
  163.      and likewise for `HImode'.
  164.  
  165. `SLOW_UNALIGNED_ACCESS'
  166.      Define this macro to be the value 1 if unaligned accesses have a
  167.      cost many times greater than aligned accesses, for example if they
  168.      are emulated in a trap handler.
  169.  
  170.      When this macro is non-zero, the compiler will act as if
  171.      `STRICT_ALIGNMENT' were non-zero when generating code for block
  172.      moves.  This can cause significantly more instructions to be
  173.      produced. Therefore, do not set this macro non-zero if unaligned
  174.      accesses only add a cycle or two to the time for a memory access.
  175.  
  176.      If the value of this macro is always zero, it need not be defined.
  177.  
  178. `DONT_REDUCE_ADDR'
  179.      Define this macro to inhibit strength reduction of memory
  180.      addresses. (On some machines, such strength reduction seems to do
  181.      harm rather than good.)
  182.  
  183. `MOVE_RATIO'
  184.      The number of scalar move insns which should be generated instead
  185.      of a string move insn or a library call.  Increasing the value
  186.      will always make code faster, but eventually incurs high cost in
  187.      increased code size.
  188.  
  189.      If you don't define this, a reasonable default is used.
  190.  
  191. `NO_FUNCTION_CSE'
  192.      Define this macro if it is as good or better to call a constant
  193.      function address than to call an address kept in a register.
  194.  
  195. `NO_RECURSIVE_FUNCTION_CSE'
  196.      Define this macro if it is as good or better for a function to call
  197.      itself with an explicit address than to call an address kept in a
  198.      register.
  199.  
  200. `ADJUST_COST (INSN, LINK, DEP_INSN, COST)'
  201.      A C statement (sans semicolon) to update the integer variable COST
  202.      based on the relationship between INSN that is dependent on
  203.      DEP_INSN through the dependence LINK.  The default is to make no
  204.      adjustment to COST.  This can be used for example to specify to
  205.      the scheduler that an output- or anti-dependence does not incur
  206.      the same cost as a data-dependence.
  207.  
  208. 
  209. File: gcc.info,  Node: Sections,  Next: PIC,  Prev: Costs,  Up: Target Macros
  210.  
  211. Dividing the Output into Sections (Texts, Data, ...)
  212. ====================================================
  213.  
  214.    An object file is divided into sections containing different types of
  215. data.  In the most common case, there are three sections: the "text
  216. section", which holds instructions and read-only data; the "data
  217. section", which holds initialized writable data; and the "bss section",
  218. which holds uninitialized data.  Some systems have other kinds of
  219. sections.
  220.  
  221.    The compiler must tell the assembler when to switch sections.  These
  222. macros control what commands to output to tell the assembler this.  You
  223. can also define additional sections.
  224.  
  225. `TEXT_SECTION_ASM_OP'
  226.      A C expression whose value is a string containing the assembler
  227.      operation that should precede instructions and read-only data. 
  228.      Normally `".text"' is right.
  229.  
  230. `DATA_SECTION_ASM_OP'
  231.      A C expression whose value is a string containing the assembler
  232.      operation to identify the following data as writable initialized
  233.      data. Normally `".data"' is right.
  234.  
  235. `SHARED_SECTION_ASM_OP'
  236.      if defined, a C expression whose value is a string containing the
  237.      assembler operation to identify the following data as shared data.
  238.       If not defined, `DATA_SECTION_ASM_OP' will be used.
  239.  
  240. `INIT_SECTION_ASM_OP'
  241.      if defined, a C expression whose value is a string containing the
  242.      assembler operation to identify the following data as
  243.      initialization code.  If not defined, GNU CC will assume such a
  244.      section does not exist.
  245.  
  246. `EXTRA_SECTIONS'
  247.      A list of names for sections other than the standard two, which are
  248.      `in_text' and `in_data'.  You need not define this macro on a
  249.      system with no other sections (that GCC needs to use).
  250.  
  251. `EXTRA_SECTION_FUNCTIONS'
  252.      One or more functions to be defined in `varasm.c'.  These
  253.      functions should do jobs analogous to those of `text_section' and
  254.      `data_section', for your additional sections.  Do not define this
  255.      macro if you do not define `EXTRA_SECTIONS'.
  256.  
  257. `READONLY_DATA_SECTION'
  258.      On most machines, read-only variables, constants, and jump tables
  259.      are placed in the text section.  If this is not the case on your
  260.      machine, this macro should be defined to be the name of a function
  261.      (either `data_section' or a function defined in `EXTRA_SECTIONS')
  262.      that switches to the section to be used for read-only items.
  263.  
  264.      If these items should be placed in the text section, this macro
  265.      should not be defined.
  266.  
  267. `SELECT_SECTION (EXP, RELOC)'
  268.      A C statement or statements to switch to the appropriate section
  269.      for output of EXP.  You can assume that EXP is either a `VAR_DECL'
  270.      node or a constant of some sort.  RELOC indicates whether the
  271.      initial value of EXP requires link-time relocations.  Select the
  272.      section by calling `text_section' or one of the alternatives for
  273.      other sections.
  274.  
  275.      Do not define this macro if you put all read-only variables and
  276.      constants in the read-only data section (usually the text section).
  277.  
  278. `SELECT_RTX_SECTION (MODE, RTX)'
  279.      A C statement or statements to switch to the appropriate section
  280.      for output of RTX in mode MODE.  You can assume that RTX is some
  281.      kind of constant in RTL.  The argument MODE is redundant except in
  282.      the case of a `const_int' rtx.  Select the section by calling
  283.      `text_section' or one of the alternatives for other sections.
  284.  
  285.      Do not define this macro if you put all constants in the read-only
  286.      data section.
  287.  
  288. `JUMP_TABLES_IN_TEXT_SECTION'
  289.      Define this macro if jump tables (for `tablejump' insns) should be
  290.      output in the text section, along with the assembler instructions.
  291.      Otherwise, the readonly data section is used.
  292.  
  293.      This macro is irrelevant if there is no separate readonly data
  294.      section.
  295.  
  296. `ENCODE_SECTION_INFO (DECL)'
  297.      Define this macro if references to a symbol must be treated
  298.      differently depending on something about the variable or function
  299.      named by the symbol (such as what section it is in).
  300.  
  301.      The macro definition, if any, is executed immediately after the
  302.      rtl for DECL has been created and stored in `DECL_RTL (DECL)'. The
  303.      value of the rtl will be a `mem' whose address is a `symbol_ref'.
  304.  
  305.      The usual thing for this macro to do is to record a flag in the
  306.      `symbol_ref' (such as `SYMBOL_REF_FLAG') or to store a modified
  307.      name string in the `symbol_ref' (if one bit is not enough
  308.      information).
  309.  
  310. `STRIP_NAME_ENCODING (VAR, SYM_NAME)'
  311.      Decode SYM_NAME and store the real name part in VAR, sans the
  312.      characters that encode section info.  Define this macro if
  313.      `ENCODE_SECTION_INFO' alters the symbol's name string.
  314.  
  315. 
  316. File: gcc.info,  Node: PIC,  Next: Assembler Format,  Prev: Sections,  Up: Target Macros
  317.  
  318. Position Independent Code
  319. =========================
  320.  
  321.    This section describes macros that help implement generation of
  322. position independent code.  Simply defining these macros is not enough
  323. to generate valid PIC; you must also add support to the macros
  324. `GO_IF_LEGITIMATE_ADDRESS' and `LEGITIMIZE_ADDRESS', and
  325. `PRINT_OPERAND_ADDRESS' as well.  You must modify the definition of
  326. `movsi' to do something appropriate when the source operand contains a
  327. symbolic address.  You may also need to alter the handling of switch
  328. statements so that they use relative addresses.
  329.  
  330. `PIC_OFFSET_TABLE_REGNUM'
  331.      The register number of the register used to address a table of
  332.      static data addresses in memory.  In some cases this register is
  333.      defined by a processor's "application binary interface" (ABI). 
  334.      When this macro is defined, RTL is generated for this register
  335.      once, as with the stack pointer and frame pointer registers.  If
  336.      this macro is not defined, it is up to the machine-dependent files
  337.      to allocate such a register (if necessary).
  338.  
  339. `FINALIZE_PIC'
  340.      By generating position-independent code, when two different
  341.      programs (A and B) share a common library (libC.a), the text of
  342.      the library can be shared whether or not the library is linked at
  343.      the same address for both programs.  In some of these
  344.      environments, position-independent code requires not only the use
  345.      of different addressing modes, but also special code to enable the
  346.      use of these addressing modes.
  347.  
  348.      The `FINALIZE_PIC' macro serves as a hook to emit these special
  349.      codes once the function is being compiled into assembly code, but
  350.      not before.  (It is not done before, because in the case of
  351.      compiling an inline function, it would lead to multiple PIC
  352.      prologues being included in functions which used inline functions
  353.      and were compiled to assembly language.)
  354.  
  355. `LEGITIMATE_PIC_OPERAND_P (X)'
  356.      A C expression that is nonzero if X is a legitimate immediate
  357.      operand on the target machine when generating position independent
  358.      code. You can assume that X satisfies `CONSTANT_P', so you need not
  359.      check this.  You can also assume FLAG_PIC is true, so you need not
  360.      check it either.  You need not define this macro if all constants
  361.      (including `SYMBOL_REF') can be immediate operands when generating
  362.      position independent code.
  363.  
  364. 
  365. File: gcc.info,  Node: Assembler Format,  Next: Debugging Info,  Prev: PIC,  Up: Target Macros
  366.  
  367. Defining the Output Assembler Language
  368. ======================================
  369.  
  370.    This section describes macros whose principal purpose is to describe
  371. how to write instructions in assembler language--rather than what the
  372. instructions do.
  373.  
  374. * Menu:
  375.  
  376. * File Framework::       Structural information for the assembler file.
  377. * Data Output::          Output of constants (numbers, strings, addresses).
  378. * Uninitialized Data::   Output of uninitialized variables.
  379. * Label Output::         Output and generation of labels.
  380. * Initialization::       General principles of initialization
  381.                and termination routines.
  382. * Macros for Initialization::
  383.              Specific macros that control the handling of
  384.                initialization and termination routines.
  385. * Instruction Output::   Output of actual instructions.
  386. * Dispatch Tables::      Output of jump tables.
  387. * Alignment Output::     Pseudo ops for alignment and skipping data.
  388.  
  389. 
  390. File: gcc.info,  Node: File Framework,  Next: Data Output,  Up: Assembler Format
  391.  
  392. The Overall Framework of an Assembler File
  393. ------------------------------------------
  394.  
  395. `ASM_FILE_START (STREAM)'
  396.      A C expression which outputs to the stdio stream STREAM some
  397.      appropriate text to go at the start of an assembler file.
  398.  
  399.      Normally this macro is defined to output a line containing
  400.      `#NO_APP', which is a comment that has no effect on most
  401.      assemblers but tells the GNU assembler that it can save time by not
  402.      checking for certain assembler constructs.
  403.  
  404.      On systems that use SDB, it is necessary to output certain
  405.      commands; see `attasm.h'.
  406.  
  407. `ASM_FILE_END (STREAM)'
  408.      A C expression which outputs to the stdio stream STREAM some
  409.      appropriate text to go at the end of an assembler file.
  410.  
  411.      If this macro is not defined, the default is to output nothing
  412.      special at the end of the file.  Most systems don't require any
  413.      definition.
  414.  
  415.      On systems that use SDB, it is necessary to output certain
  416.      commands; see `attasm.h'.
  417.  
  418. `ASM_IDENTIFY_GCC (FILE)'
  419.      A C statement to output assembler commands which will identify the
  420.      object file as having been compiled with GNU CC (or another GNU
  421.      compiler).
  422.  
  423.      If you don't define this macro, the string `gcc_compiled.:' is
  424.      output.  This string is calculated to define a symbol which, on
  425.      BSD systems, will never be defined for any other reason. GDB
  426.      checks for the presence of this symbol when reading the symbol
  427.      table of an executable.
  428.  
  429.      On non-BSD systems, you must arrange communication with GDB in
  430.      some other fashion.  If GDB is not used on your system, you can
  431.      define this macro with an empty body.
  432.  
  433. `ASM_COMMENT_START'
  434.      A C string constant describing how to begin a comment in the target
  435.      assembler language.  The compiler assumes that the comment will
  436.      end at the end of the line.
  437.  
  438. `ASM_APP_ON'
  439.      A C string constant for text to be output before each `asm'
  440.      statement or group of consecutive ones.  Normally this is
  441.      `"#APP"', which is a comment that has no effect on most assemblers
  442.      but tells the GNU assembler that it must check the lines that
  443.      follow for all valid assembler constructs.
  444.  
  445. `ASM_APP_OFF'
  446.      A C string constant for text to be output after each `asm'
  447.      statement or group of consecutive ones.  Normally this is
  448.      `"#NO_APP"', which tells the GNU assembler to resume making the
  449.      time-saving assumptions that are valid for ordinary compiler
  450.      output.
  451.  
  452. `ASM_OUTPUT_SOURCE_FILENAME (STREAM, NAME)'
  453.      A C statement to output COFF information or DWARF debugging
  454.      information which indicates that filename NAME is the current
  455.      source file to the stdio stream STREAM.
  456.  
  457.      This macro need not be defined if the standard form of output for
  458.      the file format in use is appropriate.
  459.  
  460. `ASM_OUTPUT_SOURCE_LINE (STREAM, LINE)'
  461.      A C statement to output DBX or SDB debugging information before
  462.      code for line number LINE of the current source file to the stdio
  463.      stream STREAM.
  464.  
  465.      This macro need not be defined if the standard form of debugging
  466.      information for the debugger in use is appropriate.
  467.  
  468. `ASM_OUTPUT_IDENT (STREAM, STRING)'
  469.      A C statement to output something to the assembler file to handle a
  470.      `#ident' directive containing the text STRING.  If this macro is
  471.      not defined, nothing is output for a `#ident' directive.
  472.  
  473. `OBJC_PROLOGUE'
  474.      A C statement to output any assembler statements which are
  475.      required to precede any Objective C object definitions or message
  476.      sending.  The statement is executed only when compiling an
  477.      Objective C program.
  478.  
  479. 
  480. File: gcc.info,  Node: Data Output,  Next: Uninitialized Data,  Prev: File Framework,  Up: Assembler Format
  481.  
  482. Output of Data
  483. --------------
  484.  
  485. `ASM_OUTPUT_LONG_DOUBLE (STREAM, VALUE)'
  486. `ASM_OUTPUT_DOUBLE (STREAM, VALUE)'
  487. `ASM_OUTPUT_FLOAT (STREAM, VALUE)'
  488.      A C statement to output to the stdio stream STREAM an assembler
  489.      instruction to assemble a floating-point constant of `TFmode',
  490.      `DFmode' or `SFmode', respectively, whose value is VALUE.  VALUE
  491.      will be a C expression of type `REAL_VALUE__TYPE', usually
  492.      `double'.
  493.  
  494. `ASM_OUTPUT_QUADRUPLE_INT (STREAM, EXP)'
  495. `ASM_OUTPUT_DOUBLE_INT (STREAM, EXP)'
  496. `ASM_OUTPUT_INT (STREAM, EXP)'
  497. `ASM_OUTPUT_SHORT (STREAM, EXP)'
  498. `ASM_OUTPUT_CHAR (STREAM, EXP)'
  499.      A C statement to output to the stdio stream STREAM an assembler
  500.      instruction to assemble an integer of 16, 8, 4, 2 or 1 bytes,
  501.      respectively, whose value is VALUE.  The argument EXP will be an
  502.      RTL expression which represents a constant value.  Use
  503.      `output_addr_const (STREAM, EXP)' to output this value as an
  504.      assembler expression.
  505.  
  506.      For sizes larger than `UNITS_PER_WORD', if the action of a macro
  507.      would be identical to repeatedly calling the macro corresponding to
  508.      a size of `UNITS_PER_WORD', once for each word, you need not define
  509.      the macro.
  510.  
  511. `ASM_OUTPUT_BYTE (STREAM, VALUE)'
  512.      A C statement to output to the stdio stream STREAM an assembler
  513.      instruction to assemble a single byte containing the number VALUE.
  514.  
  515. `ASM_BYTE_OP'
  516.      A C string constant giving the pseudo-op to use for a sequence of
  517.      single-byte constants.  If this macro is not defined, the default
  518.      is `"byte"'.
  519.  
  520. `ASM_OUTPUT_ASCII (STREAM, PTR, LEN)'
  521.      A C statement to output to the stdio stream STREAM an assembler
  522.      instruction to assemble a string constant containing the LEN bytes
  523.      at PTR.  PTR will be a C expression of type `char *' and LEN a C
  524.      expression of type `int'.
  525.  
  526.      If the assembler has a `.ascii' pseudo-op as found in the Berkeley
  527.      Unix assembler, do not define the macro `ASM_OUTPUT_ASCII'.
  528.  
  529. `ASM_OUTPUT_POOL_PROLOGUE (FILE FUNNAME FUNDECL SIZE)'
  530.      A C statement to output assembler commands to define the start of
  531.      the constant pool for a function.  FUNNAME is a string giving the
  532.      name of the function.  Should the return type of the function be
  533.      required, it can be obtained via FUNDECL.  SIZE is the size, in
  534.      bytes, of the constant pool that will be written immediately after
  535.      this call.
  536.  
  537.      If no constant-pool prefix is required, the usual case, this macro
  538.      need not be defined.
  539.  
  540. `ASM_OUTPUT_SPECIAL_POOL_ENTRY (FILE, X, MODE, ALIGN, LABELNO, JUMPTO)'
  541.      A C statement (with or without semicolon) to output a constant in
  542.      the constant pool, if it needs special treatment.  (This macro
  543.      need not do anything for RTL expressions that can be output
  544.      normally.)
  545.  
  546.      The argument FILE is the standard I/O stream to output the
  547.      assembler code on.  X is the RTL expression for the constant to
  548.      output, and MODE is the machine mode (in case X is a `const_int').
  549.       ALIGN is the required alignment for the value X; you should
  550.      output an assembler directive to force this much alignment.
  551.  
  552.      The argument LABELNO is a number to use in an internal label for
  553.      the address of this pool entry.  The definition of this macro is
  554.      responsible for outputting the label definition at the proper
  555.      place. Here is how to do this:
  556.  
  557.           ASM_OUTPUT_INTERNAL_LABEL (FILE, "LC", LABELNO);
  558.  
  559.      When you output a pool entry specially, you should end with a
  560.      `goto' to the label JUMPTO.  This will prevent the same pool entry
  561.      from being output a second time in the usual manner.
  562.  
  563.      You need not define this macro if it would do nothing.
  564.  
  565. `ASM_OPEN_PAREN'
  566. `ASM_CLOSE_PAREN'
  567.      These macros are defined as C string constant, describing the
  568.      syntax in the assembler for grouping arithmetic expressions.  The
  569.      following definitions are correct for most assemblers:
  570.  
  571.           #define ASM_OPEN_PAREN "("
  572.           #define ASM_CLOSE_PAREN ")"
  573.  
  574. 
  575. File: gcc.info,  Node: Uninitialized Data,  Next: Label Output,  Prev: Data Output,  Up: Assembler Format
  576.  
  577. Output of Uninitialized Variables
  578. ---------------------------------
  579.  
  580.    Each of the macros in this section is used to do the whole job of
  581. outputting a single uninitialized variable.
  582.  
  583. `ASM_OUTPUT_COMMON (STREAM, NAME, SIZE, ROUNDED)'
  584.      A C statement (sans semicolon) to output to the stdio stream
  585.      STREAM the assembler definition of a common-label named NAME whose
  586.      size is SIZE bytes.  The variable ROUNDED is the size rounded up
  587.      to whatever alignment the caller wants.
  588.  
  589.      Use the expression `assemble_name (STREAM, NAME)' to output the
  590.      name itself; before and after that, output the additional
  591.      assembler syntax for defining the name, and a newline.
  592.  
  593.      This macro controls how the assembler definitions of uninitialized
  594.      global variables are output.
  595.  
  596. `ASM_OUTPUT_ALIGNED_COMMON (STREAM, NAME, SIZE, ALIGNMENT)'
  597.      Like `ASM_OUTPUT_COMMON' except takes the required alignment as a
  598.      separate, explicit argument.  If you define this macro, it is used
  599.      in place of `ASM_OUTPUT_COMMON', and gives you more flexibility in
  600.      handling the required alignment of the variable.
  601.  
  602. `ASM_OUTPUT_SHARED_COMMON (STREAM, NAME, SIZE, ROUNDED)'
  603.      If defined, it is similar to `ASM_OUTPUT_COMMON', except that it
  604.      is used when NAME is shared.  If not defined, `ASM_OUTPUT_COMMON'
  605.      will be used.
  606.  
  607. `ASM_OUTPUT_LOCAL (STREAM, NAME, SIZE, ROUNDED)'
  608.      A C statement (sans semicolon) to output to the stdio stream
  609.      STREAM the assembler definition of a local-common-label named NAME
  610.      whose size is SIZE bytes.  The variable ROUNDED is the size
  611.      rounded up to whatever alignment the caller wants.
  612.  
  613.      Use the expression `assemble_name (STREAM, NAME)' to output the
  614.      name itself; before and after that, output the additional
  615.      assembler syntax for defining the name, and a newline.
  616.  
  617.      This macro controls how the assembler definitions of uninitialized
  618.      static variables are output.
  619.  
  620. `ASM_OUTPUT_ALIGNED_LOCAL (STREAM, NAME, SIZE, ALIGNMENT)'
  621.      Like `ASM_OUTPUT_LOCAL' except takes the required alignment as a
  622.      separate, explicit argument.  If you define this macro, it is used
  623.      in place of `ASM_OUTPUT_LOCAL', and gives you more flexibility in
  624.      handling the required alignment of the variable.
  625.  
  626. `ASM_OUTPUT_SHARED_LOCAL (STREAM, NAME, SIZE, ROUNDED)'
  627.      If defined, it is similar to `ASM_OUTPUT_LOCAL', except that it is
  628.      used when NAME is shared.  If not defined, `ASM_OUTPUT_LOCAL' will
  629.      be used.
  630.  
  631. 
  632. File: gcc.info,  Node: Label Output,  Next: Initialization,  Prev: Uninitialized Data,  Up: Assembler Format
  633.  
  634. Output and Generation of Labels
  635. -------------------------------
  636.  
  637. `ASM_OUTPUT_LABEL (STREAM, NAME)'
  638.      A C statement (sans semicolon) to output to the stdio stream
  639.      STREAM the assembler definition of a label named NAME. Use the
  640.      expression `assemble_name (STREAM, NAME)' to output the name
  641.      itself; before and after that, output the additional assembler
  642.      syntax for defining the name, and a newline.
  643.  
  644. `ASM_DECLARE_FUNCTION_NAME (STREAM, NAME, DECL)'
  645.      A C statement (sans semicolon) to output to the stdio stream
  646.      STREAM any text necessary for declaring the name NAME of a
  647.      function which is being defined.  This macro is responsible for
  648.      outputting the label definition (perhaps using
  649.      `ASM_OUTPUT_LABEL').  The argument DECL is the `FUNCTION_DECL'
  650.      tree node representing the function.
  651.  
  652.      If this macro is not defined, then the function name is defined in
  653.      the usual manner as a label (by means of `ASM_OUTPUT_LABEL').
  654.  
  655. `ASM_DECLARE_FUNCTION_SIZE (STREAM, NAME, DECL)'
  656.      A C statement (sans semicolon) to output to the stdio stream
  657.      STREAM any text necessary for declaring the size of a function
  658.      which is being defined.  The argument NAME is the name of the
  659.      function.  The argument DECL is the `FUNCTION_DECL' tree node
  660.      representing the function.
  661.  
  662.      If this macro is not defined, then the function size is not
  663.      defined.
  664.  
  665. `ASM_DECLARE_OBJECT_NAME (STREAM, NAME, DECL)'
  666.      A C statement (sans semicolon) to output to the stdio stream
  667.      STREAM any text necessary for declaring the name NAME of an
  668.      initialized variable which is being defined.  This macro must
  669.      output the label definition (perhaps using `ASM_OUTPUT_LABEL'). 
  670.      The argument DECL is the `VAR_DECL' tree node representing the
  671.      variable.
  672.  
  673.      If this macro is not defined, then the variable name is defined in
  674.      the usual manner as a label (by means of `ASM_OUTPUT_LABEL').
  675.  
  676. `ASM_GLOBALIZE_LABEL (STREAM, NAME)'
  677.      A C statement (sans semicolon) to output to the stdio stream
  678.      STREAM some commands that will make the label NAME global; that
  679.      is, available for reference from other files.  Use the expression
  680.      `assemble_name (STREAM, NAME)' to output the name itself; before
  681.      and after that, output the additional assembler syntax for making
  682.      that name global, and a newline.
  683.  
  684. `ASM_OUTPUT_EXTERNAL (STREAM, DECL, NAME)'
  685.      A C statement (sans semicolon) to output to the stdio stream
  686.      STREAM any text necessary for declaring the name of an external
  687.      symbol named NAME which is referenced in this compilation but not
  688.      defined.  The value of DECL is the tree node for the declaration.
  689.  
  690.      This macro need not be defined if it does not need to output
  691.      anything. The GNU assembler and most Unix assemblers don't require
  692.      anything.
  693.  
  694. `ASM_OUTPUT_EXTERNAL_LIBCALL (STREAM, SYMREF)'
  695.      A C statement (sans semicolon) to output on STREAM an assembler
  696.      pseudo-op to declare a library function name external.  The name
  697.      of the library function is given by SYMREF, which has type `rtx'
  698.      and is a `symbol_ref'.
  699.  
  700.      This macro need not be defined if it does not need to output
  701.      anything. The GNU assembler and most Unix assemblers don't require
  702.      anything.
  703.  
  704. `ASM_OUTPUT_LABELREF (STREAM, NAME)'
  705.      A C statement (sans semicolon) to output to the stdio stream
  706.      STREAM a reference in assembler syntax to a label named NAME. 
  707.      This should add `_' to the front of the name, if that is customary
  708.      on your operating system, as it is in most Berkeley Unix systems. 
  709.      This macro is used in `assemble_name'.
  710.  
  711. `ASM_OUTPUT_LABELREF_AS_INT (FILE, LABEL)'
  712.      Define this macro for systems that use the program `collect2'. The
  713.      definition should be a C statement to output a word containing a
  714.      reference to the label LABEL.
  715.  
  716. `ASM_OUTPUT_INTERNAL_LABEL (STREAM, PREFIX, NUM)'
  717.      A C statement to output to the stdio stream STREAM a label whose
  718.      name is made from the string PREFIX and the number NUM.
  719.  
  720.      It is absolutely essential that these labels be distinct from the
  721.      labels used for user-level functions and variables.  Otherwise,
  722.      certain programs will have name conflicts with internal labels.
  723.  
  724.      It is desirable to exclude internal labels from the symbol table
  725.      of the object file.  Most assemblers have a naming convention for
  726.      labels that should be excluded; on many systems, the letter `L' at
  727.      the beginning of a label has this effect.  You should find out what
  728.      convention your system uses, and follow it.
  729.  
  730.      The usual definition of this macro is as follows:
  731.  
  732.           fprintf (STREAM, "L%s%d:\n", PREFIX, NUM)
  733.  
  734. `ASM_GENERATE_INTERNAL_LABEL (STRING, PREFIX, NUM)'
  735.      A C statement to store into the string STRING a label whose name
  736.      is made from the string PREFIX and the number NUM.
  737.  
  738.      This string, when output subsequently by `assemble_name', should
  739.      produce the same output that `ASM_OUTPUT_INTERNAL_LABEL' would
  740.      produce with the same PREFIX and NUM.
  741.  
  742.      If the string begins with `*', then `assemble_name' will output
  743.      the rest of the string unchanged.  It is often convenient for
  744.      `ASM_GENERATE_INTERNAL_LABEL' to use `*' in this way.  If the
  745.      string doesn't start with `*', then `ASM_OUTPUT_LABELREF' gets to
  746.      output the string, and may change it.  (Of course,
  747.      `ASM_OUTPUT_LABELREF' is also part of your machine description, so
  748.      you should know what it does on your machine.)
  749.  
  750. `ASM_FORMAT_PRIVATE_NAME (OUTVAR, NAME, NUMBER)'
  751.      A C expression to assign to OUTVAR (which is a variable of type
  752.      `char *') a newly allocated string made from the string NAME and
  753.      the number NUMBER, with some suitable punctuation added.  Use
  754.      `alloca' to get space for the string.
  755.  
  756.      This string will be used as the argument to `ASM_OUTPUT_LABELREF'
  757.      to produce an assembler label for an internal static variable whose
  758.      name is NAME.  Therefore, the string must be such as to result in
  759.      valid assembler code.  The argument NUMBER is different each time
  760.      this macro is executed; it prevents conflicts between
  761.      similarly-named internal static variables in different scopes.
  762.  
  763.      Ideally this string should not be a valid C identifier, to prevent
  764.      any conflict with the user's own symbols.  Most assemblers allow
  765.      periods or percent signs in assembler symbols; putting at least
  766.      one of these between the name and the number will suffice.
  767.  
  768. `OBJC_GEN_METHOD_LABEL (BUF, IS_INST, CLASS_NAME, CAT_NAME, SEL_NAME)'
  769.      Define this macro to override the default assembler names used for
  770.      Objective C methods.
  771.  
  772.      The default name is a unique method number followed by the name of
  773.      the class (e.g. `_1_Foo').  For methods in categories, the name of
  774.      the category is also included in the assembler name (e.g.
  775.      `_1_Foo_Bar').
  776.  
  777.      These names are safe on most systems, but make debugging difficult
  778.      since the method's selector is not present in the name. 
  779.      Therefore, particular systems define other ways of computing names.
  780.  
  781.      BUF is an expression of type `char *' which gives you a buffer in
  782.      which to store the name; its length is as long as CLASS_NAME,
  783.      CAT_NAME and SEL_NAME put together, plus 50 characters extra.
  784.  
  785.      The argument IS_INST specifies whether the method is an instance
  786.      method or a class method; CLASS_NAME is the name of the class;
  787.      CAT_NAME is the name of the category (or NULL if the method is not
  788.      in a category); and SEL_NAME is the name of the selector.
  789.  
  790.      On systems where the assembler can handle quoted names, you can
  791.      use this macro to provide more human-readable names.
  792.  
  793. 
  794. File: gcc.info,  Node: Initialization,  Next: Macros for Initialization,  Prev: Label Output,  Up: Assembler Format
  795.  
  796. How Initialization Functions Are Handled
  797. ----------------------------------------
  798.  
  799.    The compiled code for certain languages includes "constructors"
  800. (also called "initialization routines")--functions to initialize data
  801. in the program when the program is started.  These functions need to be
  802. called before the program is "started"--that is to say, before `main'
  803. is called.
  804.  
  805.    Compiling some languages generates "destructors" (also called
  806. "termination routines") that should be called when the program
  807. terminates.
  808.  
  809.    To make the initialization and termination functions work, the
  810. compiler must output something in the assembler code to cause those
  811. functions to be called at the appropriate time.  When you port the
  812. compiler to a new system, you need to specify how to do this.
  813.  
  814.    There are two major ways that GCC currently supports the execution of
  815. initialization and termination functions.  Each way has two variants.
  816. Much of the structure is common to all four variations.
  817.  
  818.    The linker must build two lists of these functions--a list of
  819. initialization functions, called `__CTOR_LIST__', and a list of
  820. termination functions, called `__DTOR_LIST__'.
  821.  
  822.    Each list always begins with an ignored function pointer (which may
  823. hold 0, -1, or a count of the function pointers after it, depending on
  824. the environment).  This is followed by a series of zero or more function
  825. pointers to constructors (or destructors), followed by a function
  826. pointer containing zero.
  827.  
  828.    Depending on the operating system and its executable file format,
  829. either `crtstuff.c' or `libgcc2.c' traverses these lists at startup
  830. time and exit time.  Constructors are called in forward order of the
  831. list; destructors in reverse order.
  832.  
  833.    The best way to handle static constructors works only for object file
  834. formats which provide arbitrarily-named sections.  A section is set
  835. aside for a list of constructors, and another for a list of destructors.
  836. Traditionally these are called `.ctors' and `.dtors'.  Each object file
  837. that defines an initialization function also puts a word in the
  838. constructor section to point to that function.  The linker accumulates
  839. all these words into one contiguous `.ctors' section. Termination
  840. functions are handled similarly.
  841.  
  842.    To use this method, you need appropriate definitions of the macros
  843. `ASM_OUTPUT_CONSTRUCTOR' and `ASM_OUTPUT_DESTRUCTOR'.  Usually you can
  844. get them by including `svr4.h'.
  845.  
  846.    When arbitrary sections are available, there are two variants,
  847. depending upon how the code in `crtstuff.c' is called.  On systems that
  848. support an "init" section which is executed at program startup, parts
  849. of `crtstuff.c' are compiled into that section.  The program is linked
  850. by the `gcc' driver like this:
  851.  
  852.      ld -o OUTPUT_FILE crtbegin.o ... crtend.o -lgcc
  853.  
  854.    The head of a function (`__do_global_ctors') appears in the init
  855. section of `crtbegin.o'; the remainder of the function appears in the
  856. init section of `crtend.o'.  The linker will pull these two parts of
  857. the section together, making a whole function.  If any of the user's
  858. object files linked into the middle of it contribute code, then that
  859. code will be executed as part of the body of `__do_global_ctors'.
  860.  
  861.    To use this variant, you must define the `INIT_SECTION_ASM_OP' macro
  862. properly.
  863.  
  864.    If no init section is available, do not define
  865. `INIT_SECTION_ASM_OP'.  Then `__do_global_ctors' is built into the text
  866. section like all other functions, and resides in `libgcc.a'.  When GCC
  867. compiles any function called `main', it inserts a procedure call to
  868. `__main' as the first executable code after the function prologue.  The
  869. `__main' function, also defined in `libgcc2.c', simply calls
  870. `__do_global_ctors'.
  871.  
  872.    In file formats that don't support arbitrary sections, there are
  873. again two variants.  In the simplest variant, the GNU linker (GNU `ld')
  874. and an `a.out' format must be used.  In this case,
  875. `ASM_OUTPUT_CONSTRUCTOR' is defined to produce a `.stabs' entry of type
  876. `N_SETT', referencing the name `__CTOR_LIST__', and with the address of
  877. the void function containing the initialization code as its value.  The
  878. GNU linker recognizes this as a request to add the value to a "set";
  879. the values are accumulated, and are eventually placed in the executable
  880. as a vector in the format described above, with a leading (ignored)
  881. count and a trailing zero element. `ASM_OUTPUT_DESTRUCTOR' is handled
  882. similarly.  Since no init section is available, the absence of
  883. `INIT_SECTION_ASM_OP' causes the compilation of `main' to call `__main'
  884. as above, starting the initialization process.
  885.  
  886.    The last variant uses neither arbitrary sections nor the GNU linker.
  887. This is preferable when you want to do dynamic linking and when using
  888. file formats which the GNU linker does not support, such as `ECOFF'.  In
  889. this case, `ASM_OUTPUT_CONSTRUCTOR' does not produce an `N_SETT'
  890. symbol; initialization and termination functions are recognized simply
  891. by their names.  This requires an extra program in the linkage step,
  892. called `collect2'.  This program pretends to be the linker, for use
  893. with GNU CC; it does its job by running the ordinary linker, but also
  894. arranges to include the vectors of initialization and termination
  895. functions.  These functions are called via `__main' as described above.
  896.  
  897.    Choosing among these configuration options has been simplified by a
  898. set of operating-system-dependent files in the `config' subdirectory.
  899. These files define all of the relevant parameters.  Usually it is
  900. sufficient to include one into your specific machine-dependent
  901. configuration file.  These files are:
  902.  
  903. `aoutos.h'
  904.      For operating systems using the `a.out' format.
  905.  
  906. `next.h'
  907.      For operating systems using the `MachO' format.
  908.  
  909. `svr3.h'
  910.      For System V Release 3 and similar systems using `COFF' format.
  911.  
  912. `svr4.h'
  913.      For System V Release 4 and similar systems using `ELF' format.
  914.  
  915. `vms.h'
  916.      For the VMS operating system.
  917.  
  918.    The following section describes the specific macros that control and
  919. customize the handling of initialization and termination functions.
  920.  
  921. 
  922. File: gcc.info,  Node: Macros for Initialization,  Next: Instruction Output,  Prev: Initialization,  Up: Assembler Format
  923.  
  924. Macros Controlling Initialization Routines
  925. ------------------------------------------
  926.  
  927.    Here are the macros that control how the compiler handles
  928. initialization and termination functions:
  929.  
  930. `INIT_SECTION_ASM_OP'
  931.      If defined, a C string constant for the assembler operation to
  932.      identify the following data as initialization code.  If not
  933.      defined, GNU CC will assume such a section does not exist.  When
  934.      you are using special sections for initialization and termination
  935.      functions, this macro also controls how `crtstuff.c' and
  936.      `libgcc2.c' arrange to run the initialization functions.
  937.  
  938. `ASM_OUTPUT_CONSTRUCTOR (STREAM, NAME)'
  939.      Define this macro as a C statement to output on the stream STREAM
  940.      the assembler code to arrange to call the function named NAME at
  941.      initialization time.
  942.  
  943.      Assume that NAME is the name of a C function generated
  944.      automatically by the compiler.  This function takes no arguments. 
  945.      Use the function `assemble_name' to output the name NAME; this
  946.      performs any system-specific syntactic transformations such as
  947.      adding an underscore.
  948.  
  949.      If you don't define this macro, nothing special is output to
  950.      arrange to call the function.  This is correct when the function
  951.      will be called in some other manner--for example, by means of the
  952.      `collect2' program, which looks through the symbol table to find
  953.      these functions by their names.  If you want to use `collect2',
  954.      then you need to arrange for it to be built and installed and used
  955.      on your system.
  956.  
  957. `ASM_OUTPUT_DESTRUCTOR (STREAM, NAME)'
  958.      This is like `ASM_OUTPUT_CONSTRUCTOR' but used for termination
  959.      functions rather than initialization functions.
  960.  
  961.    If your system uses `collect2' as the means of processing
  962. constructors, then that program normally uses `nm' to scan an object
  963. file for constructor functions to be called.  On certain kinds of
  964. systems, you can define these macros to make `collect2' work faster
  965. (and, in some cases, make it work at all):
  966.  
  967. `OBJECT_FORMAT_COFF'
  968.      Define this macro if the system uses COFF (Common Object File
  969.      Format) object files, so that `collect2' can assume this format
  970.      and scan object files directly for dynamic constructor/destructor
  971.      functions.
  972.  
  973. `OBJECT_FORMAT_ROSE'
  974.      Define this macro if the system uses ROSE format object files, so
  975.      that `collect2' can assume this format and scan object files
  976.      directly for dynamic constructor/destructor functions.
  977.  
  978.    These macros are effective only in a native compiler; `collect2' as
  979. part of a cross compiler always uses `nm'.
  980.  
  981. `REAL_NM_FILE_NAME'
  982.      Define this macro as a C string constant containing the file name
  983.      to use to execute `nm'.  The default is to search the path
  984.      normally for `nm'.
  985.  
  986.