home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / Source / GNU / gcc / gcc.info-20 (.txt) < prev    next >
GNU Info File  |  1995-06-16  |  45KB  |  782 lines

  1. This is Info file gcc.info, produced by Makeinfo-1.55 from the input
  2. file gcc.texi.
  3.    This file documents the use and the internals of the GNU compiler.
  4.    Published by the Free Software Foundation 59 Temple Place - Suite 330
  5. Boston, MA 02111-1307 USA
  6.    Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995 Free Software
  7. Foundation, Inc.
  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.    Permission is granted to copy and distribute modified versions of
  12. this manual under the conditions for verbatim copying, provided also
  13. that the sections entitled "GNU General Public License," "Funding for
  14. Free Software," and "Protect Your Freedom--Fight `Look And Feel'" are
  15. included exactly as in the original, and provided that the entire
  16. resulting derived work is distributed under the terms of a permission
  17. notice identical to this one.
  18.    Permission is granted to copy and distribute translations of this
  19. manual into another language, under the above conditions for modified
  20. versions, except that the sections entitled "GNU General Public
  21. License," "Funding for Free Software," and "Protect Your Freedom--Fight
  22. `Look And Feel'", and this permission notice, may be included in
  23. translations approved by the Free Software Foundation instead of in the
  24. original English.
  25. File: gcc.info,  Node: Leaf Functions,  Next: Stack Registers,  Prev: Values in Registers,  Up: Registers
  26. Handling Leaf Functions
  27. -----------------------
  28.    On some machines, a leaf function (i.e., one which makes no calls)
  29. can run more efficiently if it does not make its own register window.
  30. Often this means it is required to receive its arguments in the
  31. registers where they are passed by the caller, instead of the registers
  32. where they would normally arrive.
  33.    The special treatment for leaf functions generally applies only when
  34. other conditions are met; for example, often they may use only those
  35. registers for its own variables and temporaries.  We use the term "leaf
  36. function" to mean a function that is suitable for this special
  37. handling, so that functions with no calls are not necessarily "leaf
  38. functions".
  39.    GNU CC assigns register numbers before it knows whether the function
  40. is suitable for leaf function treatment.  So it needs to renumber the
  41. registers in order to output a leaf function.  The following macros
  42. accomplish this.
  43. `LEAF_REGISTERS'
  44.      A C initializer for a vector, indexed by hard register number,
  45.      which contains 1 for a register that is allowable in a candidate
  46.      for leaf function treatment.
  47.      If leaf function treatment involves renumbering the registers,
  48.      then the registers marked here should be the ones before
  49.      renumbering--those that GNU CC would ordinarily allocate.  The
  50.      registers which will actually be used in the assembler code, after
  51.      renumbering, should not be marked with 1 in this vector.
  52.      Define this macro only if the target machine offers a way to
  53.      optimize the treatment of leaf functions.
  54. `LEAF_REG_REMAP (REGNO)'
  55.      A C expression whose value is the register number to which REGNO
  56.      should be renumbered, when a function is treated as a leaf
  57.      function.
  58.      If REGNO is a register number which should not appear in a leaf
  59.      function before renumbering, then the expression should yield -1,
  60.      which will cause the compiler to abort.
  61.      Define this macro only if the target machine offers a way to
  62.      optimize the treatment of leaf functions, and registers need to be
  63.      renumbered to do this.
  64.    Normally, `FUNCTION_PROLOGUE' and `FUNCTION_EPILOGUE' must treat
  65. leaf functions specially.  It can test the C variable `leaf_function'
  66. which is nonzero for leaf functions.  (The variable `leaf_function' is
  67. defined only if `LEAF_REGISTERS' is defined.)
  68. File: gcc.info,  Node: Stack Registers,  Next: Obsolete Register Macros,  Prev: Leaf Functions,  Up: Registers
  69. Registers That Form a Stack
  70. ---------------------------
  71.    There are special features to handle computers where some of the
  72. "registers" form a stack, as in the 80387 coprocessor for the 80386.
  73. Stack registers are normally written by pushing onto the stack, and are
  74. numbered relative to the top of the stack.
  75.    Currently, GNU CC can only handle one group of stack-like registers,
  76. and they must be consecutively numbered.
  77. `STACK_REGS'
  78.      Define this if the machine has any stack-like registers.
  79. `FIRST_STACK_REG'
  80.      The number of the first stack-like register.  This one is the top
  81.      of the stack.
  82. `LAST_STACK_REG'
  83.      The number of the last stack-like register.  This one is the
  84.      bottom of the stack.
  85. File: gcc.info,  Node: Obsolete Register Macros,  Prev: Stack Registers,  Up: Registers
  86. Obsolete Macros for Controlling Register Usage
  87. ----------------------------------------------
  88.    These features do not work very well.  They exist because they used
  89. to be required to generate correct code for the 80387 coprocessor of the
  90. 80386.  They are no longer used by that machine description and may be
  91. removed in a later version of the compiler.  Don't use them!
  92. `OVERLAPPING_REGNO_P (REGNO)'
  93.      If defined, this is a C expression whose value is nonzero if hard
  94.      register number REGNO is an overlapping register.  This means a
  95.      hard register which overlaps a hard register with a different
  96.      number.  (Such overlap is undesirable, but occasionally it allows
  97.      a machine to be supported which otherwise could not be.)  This
  98.      macro must return nonzero for *all* the registers which overlap
  99.      each other.  GNU CC can use an overlapping register only in
  100.      certain limited ways.  It can be used for allocation within a
  101.      basic block, and may be spilled for reloading; that is all.
  102.      If this macro is not defined, it means that none of the hard
  103.      registers overlap each other.  This is the usual situation.
  104. `INSN_CLOBBERS_REGNO_P (INSN, REGNO)'
  105.      If defined, this is a C expression whose value should be nonzero if
  106.      the insn INSN has the effect of mysteriously clobbering the
  107.      contents of hard register number REGNO.  By "mysterious" we mean
  108.      that the insn's RTL expression doesn't describe such an effect.
  109.      If this macro is not defined, it means that no insn clobbers
  110.      registers mysteriously.  This is the usual situation; all else
  111.      being equal, it is best for the RTL expression to show all the
  112.      activity.
  113. `PRESERVE_DEATH_INFO_REGNO_P (REGNO)'
  114.      If defined, this is a C expression whose value is nonzero if
  115.      accurate `REG_DEAD' notes are needed for hard register number REGNO
  116.      at the time of outputting the assembler code.  When this is so, a
  117.      few optimizations that take place after register allocation and
  118.      could invalidate the death notes are not done when this register is
  119.      involved.
  120.      You would arrange to preserve death info for a register when some
  121.      of the code in the machine description which is executed to write
  122.      the assembler code looks at the death notes.  This is necessary
  123.      only when the actual hardware feature which GNU CC thinks of as a
  124.      register is not actually a register of the usual sort.  (It might,
  125.      for example, be a hardware stack.)
  126.      If this macro is not defined, it means that no death notes need to
  127.      be preserved.  This is the usual situation.
  128. File: gcc.info,  Node: Register Classes,  Next: Stack and Calling,  Prev: Registers,  Up: Target Macros
  129. Register Classes
  130. ================
  131.    On many machines, the numbered registers are not all equivalent.
  132. For example, certain registers may not be allowed for indexed
  133. addressing; certain registers may not be allowed in some instructions.
  134. These machine restrictions are described to the compiler using
  135. "register classes".
  136.    You define a number of register classes, giving each one a name and
  137. saying which of the registers belong to it.  Then you can specify
  138. register classes that are allowed as operands to particular instruction
  139. patterns.
  140.    In general, each register will belong to several classes.  In fact,
  141. one class must be named `ALL_REGS' and contain all the registers.
  142. Another class must be named `NO_REGS' and contain no registers.  Often
  143. the union of two classes will be another class; however, this is not
  144. required.
  145.    One of the classes must be named `GENERAL_REGS'.  There is nothing
  146. terribly special about the name, but the operand constraint letters `r'
  147. and `g' specify this class.  If `GENERAL_REGS' is the same as
  148. `ALL_REGS', just define it as a macro which expands to `ALL_REGS'.
  149.    Order the classes so that if class X is contained in class Y then X
  150. has a lower class number than Y.
  151.    The way classes other than `GENERAL_REGS' are specified in operand
  152. constraints is through machine-dependent operand constraint letters.
  153. You can define such letters to correspond to various classes, then use
  154. them in operand constraints.
  155.    You should define a class for the union of two classes whenever some
  156. instruction allows both classes.  For example, if an instruction allows
  157. either a floating point (coprocessor) register or a general register
  158. for a certain operand, you should define a class `FLOAT_OR_GENERAL_REGS'
  159. which includes both of them.  Otherwise you will get suboptimal code.
  160.    You must also specify certain redundant information about the
  161. register classes: for each class, which classes contain it and which
  162. ones are contained in it; for each pair of classes, the largest class
  163. contained in their union.
  164.    When a value occupying several consecutive registers is expected in a
  165. certain class, all the registers used must belong to that class.
  166. Therefore, register classes cannot be used to enforce a requirement for
  167. a register pair to start with an even-numbered register.  The way to
  168. specify this requirement is with `HARD_REGNO_MODE_OK'.
  169.    Register classes used for input-operands of bitwise-and or shift
  170. instructions have a special requirement: each such class must have, for
  171. each fixed-point machine mode, a subclass whose registers can transfer
  172. that mode to or from memory.  For example, on some machines, the
  173. operations for single-byte values (`QImode') are limited to certain
  174. registers.  When this is so, each register class that is used in a
  175. bitwise-and or shift instruction must have a subclass consisting of
  176. registers from which single-byte values can be loaded or stored.  This
  177. is so that `PREFERRED_RELOAD_CLASS' can always have a possible value to
  178. return.
  179. `enum reg_class'
  180.      An enumeral type that must be defined with all the register class
  181.      names as enumeral values.  `NO_REGS' must be first.  `ALL_REGS'
  182.      must be the last register class, followed by one more enumeral
  183.      value, `LIM_REG_CLASSES', which is not a register class but rather
  184.      tells how many classes there are.
  185.      Each register class has a number, which is the value of casting
  186.      the class name to type `int'.  The number serves as an index in
  187.      many of the tables described below.
  188. `N_REG_CLASSES'
  189.      The number of distinct register classes, defined as follows:
  190.           #define N_REG_CLASSES (int) LIM_REG_CLASSES
  191. `REG_CLASS_NAMES'
  192.      An initializer containing the names of the register classes as C
  193.      string constants.  These names are used in writing some of the
  194.      debugging dumps.
  195. `REG_CLASS_CONTENTS'
  196.      An initializer containing the contents of the register classes, as
  197.      integers which are bit masks.  The Nth integer specifies the
  198.      contents of class N.  The way the integer MASK is interpreted is
  199.      that register R is in the class if `MASK & (1 << R)' is 1.
  200.      When the machine has more than 32 registers, an integer does not
  201.      suffice.  Then the integers are replaced by sub-initializers,
  202.      braced groupings containing several integers.  Each
  203.      sub-initializer must be suitable as an initializer for the type
  204.      `HARD_REG_SET' which is defined in `hard-reg-set.h'.
  205. `REGNO_REG_CLASS (REGNO)'
  206.      A C expression whose value is a register class containing hard
  207.      register REGNO.  In general there is more than one such class;
  208.      choose a class which is "minimal", meaning that no smaller class
  209.      also contains the register.
  210. `BASE_REG_CLASS'
  211.      A macro whose definition is the name of the class to which a valid
  212.      base register must belong.  A base register is one used in an
  213.      address which is the register value plus a displacement.
  214. `INDEX_REG_CLASS'
  215.      A macro whose definition is the name of the class to which a valid
  216.      index register must belong.  An index register is one used in an
  217.      address where its value is either multiplied by a scale factor or
  218.      added to another register (as well as added to a displacement).
  219. `REG_CLASS_FROM_LETTER (CHAR)'
  220.      A C expression which defines the machine-dependent operand
  221.      constraint letters for register classes.  If CHAR is such a
  222.      letter, the value should be the register class corresponding to
  223.      it.  Otherwise, the value should be `NO_REGS'.  The register
  224.      letter `r', corresponding to class `GENERAL_REGS', will not be
  225.      passed to this macro; you do not need to handle it.
  226. `REGNO_OK_FOR_BASE_P (NUM)'
  227.      A C expression which is nonzero if register number NUM is suitable
  228.      for use as a base register in operand addresses.  It may be either
  229.      a suitable hard register or a pseudo register that has been
  230.      allocated such a hard register.
  231. `REGNO_OK_FOR_INDEX_P (NUM)'
  232.      A C expression which is nonzero if register number NUM is suitable
  233.      for use as an index register in operand addresses.  It may be
  234.      either a suitable hard register or a pseudo register that has been
  235.      allocated such a hard register.
  236.      The difference between an index register and a base register is
  237.      that the index register may be scaled.  If an address involves the
  238.      sum of two registers, neither one of them scaled, then either one
  239.      may be labeled the "base" and the other the "index"; but whichever
  240.      labeling is used must fit the machine's constraints of which
  241.      registers may serve in each capacity.  The compiler will try both
  242.      labelings, looking for one that is valid, and will reload one or
  243.      both registers only if neither labeling works.
  244. `PREFERRED_RELOAD_CLASS (X, CLASS)'
  245.      A C expression that places additional restrictions on the register
  246.      class to use when it is necessary to copy value X into a register
  247.      in class CLASS.  The value is a register class; perhaps CLASS, or
  248.      perhaps another, smaller class.  On many machines, the following
  249.      definition is safe:
  250.           #define PREFERRED_RELOAD_CLASS(X,CLASS) CLASS
  251.      Sometimes returning a more restrictive class makes better code.
  252.      For example, on the 68000, when X is an integer constant that is
  253.      in range for a `moveq' instruction, the value of this macro is
  254.      always `DATA_REGS' as long as CLASS includes the data registers.
  255.      Requiring a data register guarantees that a `moveq' will be used.
  256.      If X is a `const_double', by returning `NO_REGS' you can force X
  257.      into a memory constant.  This is useful on certain machines where
  258.      immediate floating values cannot be loaded into certain kinds of
  259.      registers.
  260. `PREFERRED_OUTPUT_RELOAD_CLASS (X, CLASS)'
  261.      Like `PREFERRED_RELOAD_CLASS', but for output reloads instead of
  262.      input reloads.  If you don't define this macro, the default is to
  263.      use CLASS, unchanged.
  264. `LIMIT_RELOAD_CLASS (MODE, CLASS)'
  265.      A C expression that places additional restrictions on the register
  266.      class to use when it is necessary to be able to hold a value of
  267.      mode MODE in a reload register for which class CLASS would
  268.      ordinarily be used.
  269.      Unlike `PREFERRED_RELOAD_CLASS', this macro should be used when
  270.      there are certain modes that simply can't go in certain reload
  271.      classes.
  272.      The value is a register class; perhaps CLASS, or perhaps another,
  273.      smaller class.
  274.      Don't define this macro unless the target machine has limitations
  275.      which require the macro to do something nontrivial.
  276. `SECONDARY_RELOAD_CLASS (CLASS, MODE, X)'
  277. `SECONDARY_INPUT_RELOAD_CLASS (CLASS, MODE, X)'
  278. `SECONDARY_OUTPUT_RELOAD_CLASS (CLASS, MODE, X)'
  279.      Many machines have some registers that cannot be copied directly
  280.      to or from memory or even from other types of registers.  An
  281.      example is the `MQ' register, which on most machines, can only be
  282.      copied to or from general registers, but not memory.  Some
  283.      machines allow copying all registers to and from memory, but
  284.      require a scratch register for stores to some memory locations
  285.      (e.g., those with symbolic address on the RT, and those with
  286.      certain symbolic address on the Sparc when compiling PIC).  In
  287.      some cases, both an intermediate and a scratch register are
  288.      required.
  289.      You should define these macros to indicate to the reload phase
  290.      that it may need to allocate at least one register for a reload in
  291.      addition to the register to contain the data.  Specifically, if
  292.      copying X to a register CLASS in MODE requires an intermediate
  293.      register, you should define `SECONDARY_INPUT_RELOAD_CLASS' to
  294.      return the largest register class all of whose registers can be
  295.      used as intermediate registers or scratch registers.
  296.      If copying a register CLASS in MODE to X requires an intermediate
  297.      or scratch register, `SECONDARY_OUTPUT_RELOAD_CLASS' should be
  298.      defined to return the largest register class required.  If the
  299.      requirements for input and output reloads are the same, the macro
  300.      `SECONDARY_RELOAD_CLASS' should be used instead of defining both
  301.      macros identically.
  302.      The values returned by these macros are often `GENERAL_REGS'.
  303.      Return `NO_REGS' if no spare register is needed; i.e., if X can be
  304.      directly copied to or from a register of CLASS in MODE without
  305.      requiring a scratch register.  Do not define this macro if it
  306.      would always return `NO_REGS'.
  307.      If a scratch register is required (either with or without an
  308.      intermediate register), you should define patterns for
  309.      `reload_inM' or `reload_outM', as required (*note Standard
  310.      Names::..  These patterns, which will normally be implemented with
  311.      a `define_expand', should be similar to the `movM' patterns,
  312.      except that operand 2 is the scratch register.
  313.      Define constraints for the reload register and scratch register
  314.      that contain a single register class.  If the original reload
  315.      register (whose class is CLASS) can meet the constraint given in
  316.      the pattern, the value returned by these macros is used for the
  317.      class of the scratch register.  Otherwise, two additional reload
  318.      registers are required.  Their classes are obtained from the
  319.      constraints in the insn pattern.
  320.      X might be a pseudo-register or a `subreg' of a pseudo-register,
  321.      which could either be in a hard register or in memory.  Use
  322.      `true_regnum' to find out; it will return -1 if the pseudo is in
  323.      memory and the hard register number if it is in a register.
  324.      These macros should not be used in the case where a particular
  325.      class of registers can only be copied to memory and not to another
  326.      class of registers.  In that case, secondary reload registers are
  327.      not needed and would not be helpful.  Instead, a stack location
  328.      must be used to perform the copy and the `movM' pattern should use
  329.      memory as a intermediate storage.  This case often occurs between
  330.      floating-point and general registers.
  331. `SECONDARY_MEMORY_NEEDED (CLASS1, CLASS2, M)'
  332.      Certain machines have the property that some registers cannot be
  333.      copied to some other registers without using memory.  Define this
  334.      macro on those machines to be a C expression that is non-zero if
  335.      objects of mode M in registers of CLASS1 can only be copied to
  336.      registers of class CLASS2 by storing a register of CLASS1 into
  337.      memory and loading that memory location into a register of CLASS2.
  338.      Do not define this macro if its value would always be zero.
  339. `SECONDARY_MEMORY_NEEDED_RTX (MODE)'
  340.      Normally when `SECONDARY_MEMORY_NEEDED' is defined, the compiler
  341.      allocates a stack slot for a memory location needed for register
  342.      copies.  If this macro is defined, the compiler instead uses the
  343.      memory location defined by this macro.
  344.      Do not define this macro if you do not define
  345.      `SECONDARY_MEMORY_NEEDED'.
  346. `SECONDARY_MEMORY_NEEDED_MODE (MODE)'
  347.      When the compiler needs a secondary memory location to copy
  348.      between two registers of mode MODE, it normally allocates
  349.      sufficient memory to hold a quantity of `BITS_PER_WORD' bits and
  350.      performs the store and load operations in a mode that many bits
  351.      wide and whose class is the same as that of MODE.
  352.      This is right thing to do on most machines because it ensures that
  353.      all bits of the register are copied and prevents accesses to the
  354.      registers in a narrower mode, which some machines prohibit for
  355.      floating-point registers.
  356.      However, this default behavior is not correct on some machines,
  357.      such as the DEC Alpha, that store short integers in floating-point
  358.      registers differently than in integer registers.  On those
  359.      machines, the default widening will not work correctly and you
  360.      must define this macro to suppress that widening in some cases.
  361.      See the file `alpha.h' for details.
  362.      Do not define this macro if you do not define
  363.      `SECONDARY_MEMORY_NEEDED' or if widening MODE to a mode that is
  364.      `BITS_PER_WORD' bits wide is correct for your machine.
  365. `SMALL_REGISTER_CLASSES'
  366.      Normally the compiler avoids choosing registers that have been
  367.      explicitly mentioned in the rtl as spill registers (these
  368.      registers are normally those used to pass parameters and return
  369.      values).  However, some machines have so few registers of certain
  370.      classes that there would not be enough registers to use as spill
  371.      registers if this were done.
  372.      Define `SMALL_REGISTER_CLASSES' on these machines.  When it is
  373.      defined, the compiler allows registers explicitly used in the rtl
  374.      to be used as spill registers but avoids extending the lifetime of
  375.      these registers.
  376.      It is always safe to define this macro, but if you unnecessarily
  377.      define it, you will reduce the amount of optimizations that can be
  378.      performed in some cases.  If you do not define this macro when it
  379.      is required, the compiler will run out of spill registers and
  380.      print a fatal error message.  For most machines, you should not
  381.      define this macro.
  382. `CLASS_LIKELY_SPILLED_P (CLASS)'
  383.      A C expression whose value is nonzero if pseudos that have been
  384.      assigned to registers of class CLASS would likely be spilled
  385.      because registers of CLASS are needed for spill registers.
  386.      The default value of this macro returns 1 if CLASS has exactly one
  387.      register and zero otherwise.  On most machines, this default
  388.      should be used.  Only define this macro to some other expression
  389.      if pseudo allocated by `local-alloc.c' end up in memory because
  390.      their hard registers were needed for spill registers.  If this
  391.      macro returns nonzero for those classes, those pseudos will only
  392.      be allocated by `global.c', which knows how to reallocate the
  393.      pseudo to another register.  If there would not be another
  394.      register available for reallocation, you should not change the
  395.      definition of this macro since the only effect of such a
  396.      definition would be to slow down register allocation.
  397. `CLASS_MAX_NREGS (CLASS, MODE)'
  398.      A C expression for the maximum number of consecutive registers of
  399.      class CLASS needed to hold a value of mode MODE.
  400.      This is closely related to the macro `HARD_REGNO_NREGS'.  In fact,
  401.      the value of the macro `CLASS_MAX_NREGS (CLASS, MODE)' should be
  402.      the maximum value of `HARD_REGNO_NREGS (REGNO, MODE)' for all
  403.      REGNO values in the class CLASS.
  404.      This macro helps control the handling of multiple-word values in
  405.      the reload pass.
  406. `CLASS_CANNOT_CHANGE_SIZE'
  407.      If defined, a C expression for a class that contains registers
  408.      which the compiler must always access in a mode that is the same
  409.      size as the mode in which it loaded the register.
  410.      For the example, loading 32-bit integer or floating-point objects
  411.      into floating-point registers on the Alpha extends them to 64-bits.
  412.      Therefore loading a 64-bit object and then storing it as a 32-bit
  413.      object does not store the low-order 32-bits, as would be the case
  414.      for a normal register.  Therefore, `alpha.h' defines this macro as
  415.      `FLOAT_REGS'.
  416.    Three other special macros describe which operands fit which
  417. constraint letters.
  418. `CONST_OK_FOR_LETTER_P (VALUE, C)'
  419.      A C expression that defines the machine-dependent operand
  420.      constraint letters that specify particular ranges of integer
  421.      values.  If C is one of those letters, the expression should check
  422.      that VALUE, an integer, is in the appropriate range and return 1
  423.      if so, 0 otherwise.  If C is not one of those letters, the value
  424.      should be 0 regardless of VALUE.
  425. `CONST_DOUBLE_OK_FOR_LETTER_P (VALUE, C)'
  426.      A C expression that defines the machine-dependent operand
  427.      constraint letters that specify particular ranges of
  428.      `const_double' values.
  429.      If C is one of those letters, the expression should check that
  430.      VALUE, an RTX of code `const_double', is in the appropriate range
  431.      and return 1 if so, 0 otherwise.  If C is not one of those
  432.      letters, the value should be 0 regardless of VALUE.
  433.      `const_double' is used for all floating-point constants and for
  434.      `DImode' fixed-point constants.  A given letter can accept either
  435.      or both kinds of values.  It can use `GET_MODE' to distinguish
  436.      between these kinds.
  437. `EXTRA_CONSTRAINT (VALUE, C)'
  438.      A C expression that defines the optional machine-dependent
  439.      constraint letters that can be used to segregate specific types of
  440.      operands, usually memory references, for the target machine.
  441.      Normally this macro will not be defined.  If it is required for a
  442.      particular target machine, it should return 1 if VALUE corresponds
  443.      to the operand type represented by the constraint letter C.  If C
  444.      is not defined as an extra constraint, the value returned should
  445.      be 0 regardless of VALUE.
  446.      For example, on the ROMP, load instructions cannot have their
  447.      output in r0 if the memory reference contains a symbolic address.
  448.      Constraint letter `Q' is defined as representing a memory address
  449.      that does *not* contain a symbolic address.  An alternative is
  450.      specified with a `Q' constraint on the input and `r' on the
  451.      output.  The next alternative specifies `m' on the input and a
  452.      register class that does not include r0 on the output.
  453. File: gcc.info,  Node: Stack and Calling,  Next: Varargs,  Prev: Register Classes,  Up: Target Macros
  454. Stack Layout and Calling Conventions
  455. ====================================
  456.    This describes the stack layout and calling conventions.
  457. * Menu:
  458. * Frame Layout::
  459. * Frame Registers::
  460. * Elimination::
  461. * Stack Arguments::
  462. * Register Arguments::
  463. * Scalar Return::
  464. * Aggregate Return::
  465. * Caller Saves::
  466. * Function Entry::
  467. * Profiling::
  468. File: gcc.info,  Node: Frame Layout,  Next: Frame Registers,  Up: Stack and Calling
  469. Basic Stack Layout
  470. ------------------
  471.    Here is the basic stack layout.
  472. `STACK_GROWS_DOWNWARD'
  473.      Define this macro if pushing a word onto the stack moves the stack
  474.      pointer to a smaller address.
  475.      When we say, "define this macro if ...," it means that the
  476.      compiler checks this macro only with `#ifdef' so the precise
  477.      definition used does not matter.
  478. `FRAME_GROWS_DOWNWARD'
  479.      Define this macro if the addresses of local variable slots are at
  480.      negative offsets from the frame pointer.
  481. `ARGS_GROW_DOWNWARD'
  482.      Define this macro if successive arguments to a function occupy
  483.      decreasing addresses on the stack.
  484. `STARTING_FRAME_OFFSET'
  485.      Offset from the frame pointer to the first local variable slot to
  486.      be allocated.
  487.      If `FRAME_GROWS_DOWNWARD', find the next slot's offset by
  488.      subtracting the first slot's length from `STARTING_FRAME_OFFSET'.
  489.      Otherwise, it is found by adding the length of the first slot to
  490.      the value `STARTING_FRAME_OFFSET'.
  491. `STACK_POINTER_OFFSET'
  492.      Offset from the stack pointer register to the first location at
  493.      which outgoing arguments are placed.  If not specified, the
  494.      default value of zero is used.  This is the proper value for most
  495.      machines.
  496.      If `ARGS_GROW_DOWNWARD', this is the offset to the location above
  497.      the first location at which outgoing arguments are placed.
  498. `FIRST_PARM_OFFSET (FUNDECL)'
  499.      Offset from the argument pointer register to the first argument's
  500.      address.  On some machines it may depend on the data type of the
  501.      function.
  502.      If `ARGS_GROW_DOWNWARD', this is the offset to the location above
  503.      the first argument's address.
  504. `STACK_DYNAMIC_OFFSET (FUNDECL)'
  505.      Offset from the stack pointer register to an item dynamically
  506.      allocated on the stack, e.g., by `alloca'.
  507.      The default value for this macro is `STACK_POINTER_OFFSET' plus the
  508.      length of the outgoing arguments.  The default is correct for most
  509.      machines.  See `function.c' for details.
  510. `DYNAMIC_CHAIN_ADDRESS (FRAMEADDR)'
  511.      A C expression whose value is RTL representing the address in a
  512.      stack frame where the pointer to the caller's frame is stored.
  513.      Assume that FRAMEADDR is an RTL expression for the address of the
  514.      stack frame itself.
  515.      If you don't define this macro, the default is to return the value
  516.      of FRAMEADDR--that is, the stack frame address is also the address
  517.      of the stack word that points to the previous frame.
  518. `SETUP_FRAME_ADDRESSES ()'
  519.      If defined, a C expression that produces the machine-specific code
  520.      to setup the stack so that arbitrary frames can be accessed.  For
  521.      example, on the Sparc, we must flush all of the register windows
  522.      to the stack before we can access arbitrary stack frames.  This
  523.      macro will seldom need to be defined.
  524. `RETURN_ADDR_RTX (COUNT, FRAMEADDR)'
  525.      A C expression whose value is RTL representing the value of the
  526.      return address for the frame COUNT steps up from the current frame.
  527.      fRAMEADDR is the frame pointer of the COUNT frame, or the frame
  528.      pointer of the COUNT - 1 frame if `RETURN_ADDR_IN_PREVIOUS_FRAME'
  529.      is defined.
  530. `RETURN_ADDR_IN_PREVIOUS_FRAME'
  531.      Define this if the return address of a particular stack frame is
  532.      accessed from the frame pointer of the previous stack frame.
  533. File: gcc.info,  Node: Frame Registers,  Next: Elimination,  Prev: Frame Layout,  Up: Stack and Calling
  534. Registers That Address the Stack Frame
  535. --------------------------------------
  536.    This discusses registers that address the stack frame.
  537. `STACK_POINTER_REGNUM'
  538.      The register number of the stack pointer register, which must also
  539.      be a fixed register according to `FIXED_REGISTERS'.  On most
  540.      machines, the hardware determines which register this is.
  541. `FRAME_POINTER_REGNUM'
  542.      The register number of the frame pointer register, which is used to
  543.      access automatic variables in the stack frame.  On some machines,
  544.      the hardware determines which register this is.  On other
  545.      machines, you can choose any register you wish for this purpose.
  546. `HARD_FRAME_POINTER_REGNUM'
  547.      On some machines the offset between the frame pointer and starting
  548.      offset of the automatic variables is not known until after register
  549.      allocation has been done (for example, because the saved registers
  550.      are between these two locations).  On those machines, define
  551.      `FRAME_POINTER_REGNUM' the number of a special, fixed register to
  552.      be used internally until the offset is known, and define
  553.      `HARD_FRAME_POINTER_REGNUM' to be actual the hard register number
  554.      used for the frame pointer.
  555.      You should define this macro only in the very rare circumstances
  556.      when it is not possible to calculate the offset between the frame
  557.      pointer and the automatic variables until after register
  558.      allocation has been completed.  When this macro is defined, you
  559.      must also indicate in your definition of `ELIMINABLE_REGS' how to
  560.      eliminate `FRAME_POINTER_REGNUM' into either
  561.      `HARD_FRAME_POINTER_REGNUM' or `STACK_POINTER_REGNUM'.
  562.      Do not define this macro if it would be the same as
  563.      `FRAME_POINTER_REGNUM'.
  564. `ARG_POINTER_REGNUM'
  565.      The register number of the arg pointer register, which is used to
  566.      access the function's argument list.  On some machines, this is
  567.      the same as the frame pointer register.  On some machines, the
  568.      hardware determines which register this is.  On other machines,
  569.      you can choose any register you wish for this purpose.  If this is
  570.      not the same register as the frame pointer register, then you must
  571.      mark it as a fixed register according to `FIXED_REGISTERS', or
  572.      arrange to be able to eliminate it (*note Elimination::.).
  573. `STATIC_CHAIN_REGNUM'
  574. `STATIC_CHAIN_INCOMING_REGNUM'
  575.      Register numbers used for passing a function's static chain
  576.      pointer.  If register windows are used, the register number as
  577.      seen by the called function is `STATIC_CHAIN_INCOMING_REGNUM',
  578.      while the register number as seen by the calling function is
  579.      `STATIC_CHAIN_REGNUM'.  If these registers are the same,
  580.      `STATIC_CHAIN_INCOMING_REGNUM' need not be defined.
  581.      The static chain register need not be a fixed register.
  582.      If the static chain is passed in memory, these macros should not be
  583.      defined; instead, the next two macros should be defined.
  584. `STATIC_CHAIN'
  585. `STATIC_CHAIN_INCOMING'
  586.      If the static chain is passed in memory, these macros provide rtx
  587.      giving `mem' expressions that denote where they are stored.
  588.      `STATIC_CHAIN' and `STATIC_CHAIN_INCOMING' give the locations as
  589.      seen by the calling and called functions, respectively.  Often the
  590.      former will be at an offset from the stack pointer and the latter
  591.      at an offset from the frame pointer.
  592.      The variables `stack_pointer_rtx', `frame_pointer_rtx', and
  593.      `arg_pointer_rtx' will have been initialized prior to the use of
  594.      these macros and should be used to refer to those items.
  595.      If the static chain is passed in a register, the two previous
  596.      macros should be defined instead.
  597. File: gcc.info,  Node: Elimination,  Next: Stack Arguments,  Prev: Frame Registers,  Up: Stack and Calling
  598. Eliminating Frame Pointer and Arg Pointer
  599. -----------------------------------------
  600.    This is about eliminating the frame pointer and arg pointer.
  601. `FRAME_POINTER_REQUIRED'
  602.      A C expression which is nonzero if a function must have and use a
  603.      frame pointer.  This expression is evaluated  in the reload pass.
  604.      If its value is nonzero the function will have a frame pointer.
  605.      The expression can in principle examine the current function and
  606.      decide according to the facts, but on most machines the constant 0
  607.      or the constant 1 suffices.  Use 0 when the machine allows code to
  608.      be generated with no frame pointer, and doing so saves some time
  609.      or space.  Use 1 when there is no possible advantage to avoiding a
  610.      frame pointer.
  611.      In certain cases, the compiler does not know how to produce valid
  612.      code without a frame pointer.  The compiler recognizes those cases
  613.      and automatically gives the function a frame pointer regardless of
  614.      what `FRAME_POINTER_REQUIRED' says.  You don't need to worry about
  615.      them.
  616.      In a function that does not require a frame pointer, the frame
  617.      pointer register can be allocated for ordinary usage, unless you
  618.      mark it as a fixed register.  See `FIXED_REGISTERS' for more
  619.      information.
  620. `INITIAL_FRAME_POINTER_OFFSET (DEPTH-VAR)'
  621.      A C statement to store in the variable DEPTH-VAR the difference
  622.      between the frame pointer and the stack pointer values immediately
  623.      after the function prologue.  The value would be computed from
  624.      information such as the result of `get_frame_size ()' and the
  625.      tables of registers `regs_ever_live' and `call_used_regs'.
  626.      If `ELIMINABLE_REGS' is defined, this macro will be not be used and
  627.      need not be defined.  Otherwise, it must be defined even if
  628.      `FRAME_POINTER_REQUIRED' is defined to always be true; in that
  629.      case, you may set DEPTH-VAR to anything.
  630. `ELIMINABLE_REGS'
  631.      If defined, this macro specifies a table of register pairs used to
  632.      eliminate unneeded registers that point into the stack frame.  If
  633.      it is not defined, the only elimination attempted by the compiler
  634.      is to replace references to the frame pointer with references to
  635.      the stack pointer.
  636.      The definition of this macro is a list of structure
  637.      initializations, each of which specifies an original and
  638.      replacement register.
  639.      On some machines, the position of the argument pointer is not
  640.      known until the compilation is completed.  In such a case, a
  641.      separate hard register must be used for the argument pointer.
  642.      This register can be eliminated by replacing it with either the
  643.      frame pointer or the argument pointer, depending on whether or not
  644.      the frame pointer has been eliminated.
  645.      In this case, you might specify:
  646.           #define ELIMINABLE_REGS  \
  647.           {{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
  648.            {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
  649.            {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
  650.      Note that the elimination of the argument pointer with the stack
  651.      pointer is specified first since that is the preferred elimination.
  652. `CAN_ELIMINATE (FROM-REG, TO-REG)'
  653.      A C expression that returns non-zero if the compiler is allowed to
  654.      try to replace register number FROM-REG with register number
  655.      TO-REG.  This macro need only be defined if `ELIMINABLE_REGS' is
  656.      defined, and will usually be the constant 1, since most of the
  657.      cases preventing register elimination are things that the compiler
  658.      already knows about.
  659. `INITIAL_ELIMINATION_OFFSET (FROM-REG, TO-REG, OFFSET-VAR)'
  660.      This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'.  It
  661.      specifies the initial difference between the specified pair of
  662.      registers.  This macro must be defined if `ELIMINABLE_REGS' is
  663.      defined.
  664. `LONGJMP_RESTORE_FROM_STACK'
  665.      Define this macro if the `longjmp' function restores registers from
  666.      the stack frames, rather than from those saved specifically by
  667.      `setjmp'.  Certain quantities must not be kept in registers across
  668.      a call to `setjmp' on such machines.
  669. File: gcc.info,  Node: Stack Arguments,  Next: Register Arguments,  Prev: Elimination,  Up: Stack and Calling
  670. Passing Function Arguments on the Stack
  671. ---------------------------------------
  672.    The macros in this section control how arguments are passed on the
  673. stack.  See the following section for other macros that control passing
  674. certain arguments in registers.
  675. `PROMOTE_PROTOTYPES'
  676.      Define this macro if an argument declared in a prototype as an
  677.      integral type smaller than `int' should actually be passed as an
  678.      `int'.  In addition to avoiding errors in certain cases of
  679.      mismatch, it also makes for better code on certain machines.
  680. `PUSH_ROUNDING (NPUSHED)'
  681.      A C expression that is the number of bytes actually pushed onto the
  682.      stack when an instruction attempts to push NPUSHED bytes.
  683.      If the target machine does not have a push instruction, do not
  684.      define this macro.  That directs GNU CC to use an alternate
  685.      strategy: to allocate the entire argument block and then store the
  686.      arguments into it.
  687.      On some machines, the definition
  688.           #define PUSH_ROUNDING(BYTES) (BYTES)
  689.      will suffice.  But on other machines, instructions that appear to
  690.      push one byte actually push two bytes in an attempt to maintain
  691.      alignment.  Then the definition should be
  692.           #define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & ~1)
  693. `ACCUMULATE_OUTGOING_ARGS'
  694.      If defined, the maximum amount of space required for outgoing
  695.      arguments will be computed and placed into the variable
  696.      `current_function_outgoing_args_size'.  No space will be pushed
  697.      onto the stack for each call; instead, the function prologue should
  698.      increase the stack frame size by this amount.
  699.      Defining both `PUSH_ROUNDING' and `ACCUMULATE_OUTGOING_ARGS' is
  700.      not proper.
  701. `REG_PARM_STACK_SPACE (FNDECL)'
  702.      Define this macro if functions should assume that stack space has
  703.      been allocated for arguments even when their values are passed in
  704.      registers.
  705.      The value of this macro is the size, in bytes, of the area
  706.      reserved for arguments passed in registers for the function
  707.      represented by FNDECL.
  708.      This space can be allocated by the caller, or be a part of the
  709.      machine-dependent stack frame: `OUTGOING_REG_PARM_STACK_SPACE' says
  710.      which.
  711. `MAYBE_REG_PARM_STACK_SPACE'
  712. `FINAL_REG_PARM_STACK_SPACE (CONST_SIZE, VAR_SIZE)'
  713.      Define these macros in addition to the one above if functions might
  714.      allocate stack space for arguments even when their values are
  715.      passed in registers.  These should be used when the stack space
  716.      allocated for arguments in registers is not a simple constant
  717.      independent of the function declaration.
  718.      The value of the first macro is the size, in bytes, of the area
  719.      that we should initially assume would be reserved for arguments
  720.      passed in registers.
  721.      The value of the second macro is the actual size, in bytes, of the
  722.      area that will be reserved for arguments passed in registers.
  723.      This takes two arguments: an integer representing the number of
  724.      bytes of fixed sized arguments on the stack, and a tree
  725.      representing the number of bytes of variable sized arguments on
  726.      the stack.
  727.      When these macros are defined, `REG_PARM_STACK_SPACE' will only be
  728.      called for libcall functions, the current function, or for a
  729.      function being called when it is known that such stack space must
  730.      be allocated.  In each case this value can be easily computed.
  731.      When deciding whether a called function needs such stack space,
  732.      and how much space to reserve, GNU CC uses these two macros
  733.      instead of `REG_PARM_STACK_SPACE'.
  734. `OUTGOING_REG_PARM_STACK_SPACE'
  735.      Define this if it is the responsibility of the caller to allocate
  736.      the area reserved for arguments passed in registers.
  737.      If `ACCUMULATE_OUTGOING_ARGS' is defined, this macro controls
  738.      whether the space for these arguments counts in the value of
  739.      `current_function_outgoing_args_size'.
  740. `STACK_PARMS_IN_REG_PARM_AREA'
  741.      Define this macro if `REG_PARM_STACK_SPACE' is defined, but the
  742.      stack parameters don't skip the area specified by it.
  743.      Normally, when a parameter is not passed in registers, it is
  744.      placed on the stack beyond the `REG_PARM_STACK_SPACE' area.
  745.      Defining this macro suppresses this behavior and causes the
  746.      parameter to be passed on the stack in its natural location.
  747. `RETURN_POPS_ARGS (FUNDECL, FUNTYPE, STACK-SIZE)'
  748.      A C expression that should indicate the number of bytes of its own
  749.      arguments that a function pops on returning, or 0 if the function
  750.      pops no arguments and the caller must therefore pop them all after
  751.      the function returns.
  752.      FUNDECL is a C variable whose value is a tree node that describes
  753.      the function in question.  Normally it is a node of type
  754.      `FUNCTION_DECL' that describes the declaration of the function.
  755.      From this it is possible to obtain the DECL_MACHINE_ATTRIBUTES of
  756.      the function.
  757.      FUNTYPE is a C variable whose value is a tree node that describes
  758.      the function in question.  Normally it is a node of type
  759.      `FUNCTION_TYPE' that describes the data type of the function.
  760.      From this it is possible to obtain the data types of the value and
  761.      arguments (if known).
  762.      When a call to a library function is being considered, FUNTYPE
  763.      will contain an identifier node for the library function.  Thus, if
  764.      you need to distinguish among various library functions, you can
  765.      do so by their names.  Note that "library function" in this
  766.      context means a function used to perform arithmetic, whose name is
  767.      known specially in the compiler and was not mentioned in the C
  768.      code being compiled.
  769.      STACK-SIZE is the number of bytes of arguments passed on the
  770.      stack.  If a variable number of bytes is passed, it is zero, and
  771.      argument popping will always be the responsibility of the calling
  772.      function.
  773.      On the Vax, all functions always pop their arguments, so the
  774.      definition of this macro is STACK-SIZE.  On the 68000, using the
  775.      standard calling convention, no functions pop their arguments, so
  776.      the value of the macro is always 0 in this case.  But an
  777.      alternative calling convention is available in which functions
  778.      that take a fixed number of arguments pop them but other functions
  779.      (such as `printf') pop nothing (the caller pops all).  When this
  780.      convention is in use, FUNTYPE is examined to determine whether a
  781.      function takes a fixed number of arguments.
  782.