home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / Source / GNU / gcc / gcc.info-14 (.txt) < prev    next >
GNU Info File  |  1995-11-26  |  41KB  |  758 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: Machine Modes,  Next: Constants,  Prev: Flags,  Up: RTL
  26. Machine Modes
  27. =============
  28.    A machine mode describes a size of data object and the
  29. representation used for it.  In the C code, machine modes are
  30. represented by an enumeration type, `enum machine_mode', defined in
  31. `machmode.def'.  Each RTL expression has room for a machine mode and so
  32. do certain kinds of tree expressions (declarations and types, to be
  33. precise).
  34.    In debugging dumps and machine descriptions, the machine mode of an
  35. RTL expression is written after the expression code with a colon to
  36. separate them.  The letters `mode' which appear at the end of each
  37. machine mode name are omitted.  For example, `(reg:SI 38)' is a `reg'
  38. expression with machine mode `SImode'.  If the mode is `VOIDmode', it
  39. is not written at all.
  40.    Here is a table of machine modes.  The term "byte" below refers to an
  41. object of `BITS_PER_UNIT' bits (*note Storage Layout::.).
  42. `QImode'
  43.      "Quarter-Integer" mode represents a single byte treated as an
  44.      integer.
  45. `HImode'
  46.      "Half-Integer" mode represents a two-byte integer.
  47. `PSImode'
  48.      "Partial Single Integer" mode represents an integer which occupies
  49.      four bytes but which doesn't really use all four.  On some
  50.      machines, this is the right mode to use for pointers.
  51. `SImode'
  52.      "Single Integer" mode represents a four-byte integer.
  53. `PDImode'
  54.      "Partial Double Integer" mode represents an integer which occupies
  55.      eight bytes but which doesn't really use all eight.  On some
  56.      machines, this is the right mode to use for certain pointers.
  57. `DImode'
  58.      "Double Integer" mode represents an eight-byte integer.
  59. `TImode'
  60.      "Tetra Integer" (?) mode represents a sixteen-byte integer.
  61. `SFmode'
  62.      "Single Floating" mode represents a single-precision (four byte)
  63.      floating point number.
  64. `DFmode'
  65.      "Double Floating" mode represents a double-precision (eight byte)
  66.      floating point number.
  67. `XFmode'
  68.      "Extended Floating" mode represents a triple-precision (twelve
  69.      byte) floating point number.  This mode is used for IEEE extended
  70.      floating point.  On some systems not all bits within these bytes
  71.      will actually be used.
  72. `TFmode'
  73.      "Tetra Floating" mode represents a quadruple-precision (sixteen
  74.      byte) floating point number.
  75. `CCmode'
  76.      "Condition Code" mode represents the value of a condition code,
  77.      which is a machine-specific set of bits used to represent the
  78.      result of a comparison operation.  Other machine-specific modes
  79.      may also be used for the condition code.  These modes are not used
  80.      on machines that use `cc0' (see *note Condition Code::.).
  81. `BLKmode'
  82.      "Block" mode represents values that are aggregates to which none of
  83.      the other modes apply.  In RTL, only memory references can have
  84.      this mode, and only if they appear in string-move or vector
  85.      instructions.  On machines which have no such instructions,
  86.      `BLKmode' will not appear in RTL.
  87. `VOIDmode'
  88.      Void mode means the absence of a mode or an unspecified mode.  For
  89.      example, RTL expressions of code `const_int' have mode `VOIDmode'
  90.      because they can be taken to have whatever mode the context
  91.      requires.  In debugging dumps of RTL, `VOIDmode' is expressed by
  92.      the absence of any mode.
  93. `SCmode, DCmode, XCmode, TCmode'
  94.      These modes stand for a complex number represented as a pair of
  95.      floating point values.  The floating point values are in `SFmode',
  96.      `DFmode', `XFmode', and `TFmode', respectively.
  97. `CQImode, CHImode, CSImode, CDImode, CTImode, COImode'
  98.      These modes stand for a complex number represented as a pair of
  99.      integer values.  The integer values are in `QImode', `HImode',
  100.      `SImode', `DImode', `TImode', and `OImode', respectively.
  101.    The machine description defines `Pmode' as a C macro which expands
  102. into the machine mode used for addresses.  Normally this is the mode
  103. whose size is `BITS_PER_WORD', `SImode' on 32-bit machines.
  104.    The only modes which a machine description must support are
  105. `QImode', and the modes corresponding to `BITS_PER_WORD',
  106. `FLOAT_TYPE_SIZE' and `DOUBLE_TYPE_SIZE'.  The compiler will attempt to
  107. use `DImode' for 8-byte structures and unions, but this can be
  108. prevented by overriding the definition of `MAX_FIXED_MODE_SIZE'.
  109. Alternatively, you can have the compiler use `TImode' for 16-byte
  110. structures and unions.  Likewise, you can arrange for the C type `short
  111. int' to avoid using `HImode'.
  112.    Very few explicit references to machine modes remain in the compiler
  113. and these few references will soon be removed.  Instead, the machine
  114. modes are divided into mode classes.  These are represented by the
  115. enumeration type `enum mode_class' defined in `machmode.h'.  The
  116. possible mode classes are:
  117. `MODE_INT'
  118.      Integer modes.  By default these are `QImode', `HImode', `SImode',
  119.      `DImode', and `TImode'.
  120. `MODE_PARTIAL_INT'
  121.      The "partial integer" modes, `PSImode' and `PDImode'.
  122. `MODE_FLOAT'
  123.      floating point modes.  By default these are `SFmode', `DFmode',
  124.      `XFmode' and `TFmode'.
  125. `MODE_COMPLEX_INT'
  126.      Complex integer modes.  (These are not currently implemented).
  127. `MODE_COMPLEX_FLOAT'
  128.      Complex floating point modes.  By default these are `SCmode',
  129.      `DCmode', `XCmode', and `TCmode'.
  130. `MODE_FUNCTION'
  131.      Algol or Pascal function variables including a static chain.
  132.      (These are not currently implemented).
  133. `MODE_CC'
  134.      Modes representing condition code values.  These are `CCmode' plus
  135.      any modes listed in the `EXTRA_CC_MODES' macro.  *Note Jump
  136.      Patterns::, also see *Note Condition Code::.
  137. `MODE_RANDOM'
  138.      This is a catchall mode class for modes which don't fit into the
  139.      above classes.  Currently `VOIDmode' and `BLKmode' are in
  140.      `MODE_RANDOM'.
  141.    Here are some C macros that relate to machine modes:
  142. `GET_MODE (X)'
  143.      Returns the machine mode of the RTX X.
  144. `PUT_MODE (X, NEWMODE)'
  145.      Alters the machine mode of the RTX X to be NEWMODE.
  146. `NUM_MACHINE_MODES'
  147.      Stands for the number of machine modes available on the target
  148.      machine.  This is one greater than the largest numeric value of any
  149.      machine mode.
  150. `GET_MODE_NAME (M)'
  151.      Returns the name of mode M as a string.
  152. `GET_MODE_CLASS (M)'
  153.      Returns the mode class of mode M.
  154. `GET_MODE_WIDER_MODE (M)'
  155.      Returns the next wider natural mode.  For example, the expression
  156.      `GET_MODE_WIDER_MODE (QImode)' returns `HImode'.
  157. `GET_MODE_SIZE (M)'
  158.      Returns the size in bytes of a datum of mode M.
  159. `GET_MODE_BITSIZE (M)'
  160.      Returns the size in bits of a datum of mode M.
  161. `GET_MODE_MASK (M)'
  162.      Returns a bitmask containing 1 for all bits in a word that fit
  163.      within mode M.  This macro can only be used for modes whose
  164.      bitsize is less than or equal to `HOST_BITS_PER_INT'.
  165. `GET_MODE_ALIGNMENT (M))'
  166.      Return the required alignment, in bits, for an object of mode M.
  167. `GET_MODE_UNIT_SIZE (M)'
  168.      Returns the size in bytes of the subunits of a datum of mode M.
  169.      This is the same as `GET_MODE_SIZE' except in the case of complex
  170.      modes.  For them, the unit size is the size of the real or
  171.      imaginary part.
  172. `GET_MODE_NUNITS (M)'
  173.      Returns the number of units contained in a mode, i.e.,
  174.      `GET_MODE_SIZE' divided by `GET_MODE_UNIT_SIZE'.
  175. `GET_CLASS_NARROWEST_MODE (C)'
  176.      Returns the narrowest mode in mode class C.
  177.    The global variables `byte_mode' and `word_mode' contain modes whose
  178. classes are `MODE_INT' and whose bitsizes are either `BITS_PER_UNIT' or
  179. `BITS_PER_WORD', respectively.  On 32-bit machines, these are `QImode'
  180. and `SImode', respectively.
  181. File: gcc.info,  Node: Constants,  Next: Regs and Memory,  Prev: Machine Modes,  Up: RTL
  182. Constant Expression Types
  183. =========================
  184.    The simplest RTL expressions are those that represent constant
  185. values.
  186. `(const_int I)'
  187.      This type of expression represents the integer value I.  I is
  188.      customarily accessed with the macro `INTVAL' as in `INTVAL (EXP)',
  189.      which is equivalent to `XWINT (EXP, 0)'.
  190.      There is only one expression object for the integer value zero; it
  191.      is the value of the variable `const0_rtx'.  Likewise, the only
  192.      expression for integer value one is found in `const1_rtx', the only
  193.      expression for integer value two is found in `const2_rtx', and the
  194.      only expression for integer value negative one is found in
  195.      `constm1_rtx'.  Any attempt to create an expression of code
  196.      `const_int' and value zero, one, two or negative one will return
  197.      `const0_rtx', `const1_rtx', `const2_rtx' or `constm1_rtx' as
  198.      appropriate.
  199.      Similarly, there is only one object for the integer whose value is
  200.      `STORE_FLAG_VALUE'.  It is found in `const_true_rtx'.  If
  201.      `STORE_FLAG_VALUE' is one, `const_true_rtx' and `const1_rtx' will
  202.      point to the same object.  If `STORE_FLAG_VALUE' is -1,
  203.      `const_true_rtx' and `constm1_rtx' will point to the same object.
  204. `(const_double:M ADDR I0 I1 ...)'
  205.      Represents either a floating-point constant of mode M or an
  206.      integer constant too large to fit into `HOST_BITS_PER_WIDE_INT'
  207.      bits but small enough to fit within twice that number of bits (GNU
  208.      CC does not provide a mechanism to represent even larger
  209.      constants).  In the latter case, M will be `VOIDmode'.
  210.      ADDR is used to contain the `mem' expression that corresponds to
  211.      the location in memory that at which the constant can be found.  If
  212.      it has not been allocated a memory location, but is on the chain
  213.      of all `const_double' expressions in this compilation (maintained
  214.      using an undisplayed field), ADDR contains `const0_rtx'.  If it is
  215.      not on the chain, ADDR contains `cc0_rtx'.  ADDR is customarily
  216.      accessed with the macro `CONST_DOUBLE_MEM' and the chain field via
  217.      `CONST_DOUBLE_CHAIN'.
  218.      If M is `VOIDmode', the bits of the value are stored in I0 and I1.
  219.      I0 is customarily accessed with the macro `CONST_DOUBLE_LOW' and
  220.      I1 with `CONST_DOUBLE_HIGH'.
  221.      If the constant is floating point (regardless of its precision),
  222.      then the number of integers used to store the value depends on the
  223.      size of `REAL_VALUE_TYPE' (*note Cross-compilation::.).  The
  224.      integers represent a floating point number, but not precisely in
  225.      the target machine's or host machine's floating point format.  To
  226.      convert them to the precise bit pattern used by the target
  227.      machine, use the macro `REAL_VALUE_TO_TARGET_DOUBLE' and friends
  228.      (*note Data Output::.).
  229.      The macro `CONST0_RTX (MODE)' refers to an expression with value 0
  230.      in mode MODE.  If mode MODE is of mode class `MODE_INT', it
  231.      returns `const0_rtx'.  Otherwise, it returns a `CONST_DOUBLE'
  232.      expression in mode MODE.  Similarly, the macro `CONST1_RTX (MODE)'
  233.      refers to an expression with value 1 in mode MODE and similarly
  234.      for `CONST2_RTX'.
  235. `(const_string STR)'
  236.      Represents a constant string with value STR.  Currently this is
  237.      used only for insn attributes (*note Insn Attributes::.) since
  238.      constant strings in C are placed in memory.
  239. `(symbol_ref:MODE SYMBOL)'
  240.      Represents the value of an assembler label for data.  SYMBOL is a
  241.      string that describes the name of the assembler label.  If it
  242.      starts with a `*', the label is the rest of SYMBOL not including
  243.      the `*'.  Otherwise, the label is SYMBOL, usually prefixed with
  244.      `_'.
  245.      The `symbol_ref' contains a mode, which is usually `Pmode'.
  246.      Usually that is the only mode for which a symbol is directly valid.
  247. `(label_ref LABEL)'
  248.      Represents the value of an assembler label for code.  It contains
  249.      one operand, an expression, which must be a `code_label' that
  250.      appears in the instruction sequence to identify the place where
  251.      the label should go.
  252.      The reason for using a distinct expression type for code label
  253.      references is so that jump optimization can distinguish them.
  254. `(const:M EXP)'
  255.      Represents a constant that is the result of an assembly-time
  256.      arithmetic computation.  The operand, EXP, is an expression that
  257.      contains only constants (`const_int', `symbol_ref' and `label_ref'
  258.      expressions) combined with `plus' and `minus'.  However, not all
  259.      combinations are valid, since the assembler cannot do arbitrary
  260.      arithmetic on relocatable symbols.
  261.      M should be `Pmode'.
  262. `(high:M EXP)'
  263.      Represents the high-order bits of EXP, usually a `symbol_ref'.
  264.      The number of bits is machine-dependent and is normally the number
  265.      of bits specified in an instruction that initializes the high
  266.      order bits of a register.  It is used with `lo_sum' to represent
  267.      the typical two-instruction sequence used in RISC machines to
  268.      reference a global memory location.
  269.      M should be `Pmode'.
  270. File: gcc.info,  Node: Regs and Memory,  Next: Arithmetic,  Prev: Constants,  Up: RTL
  271. Registers and Memory
  272. ====================
  273.    Here are the RTL expression types for describing access to machine
  274. registers and to main memory.
  275. `(reg:M N)'
  276.      For small values of the integer N (those that are less than
  277.      `FIRST_PSEUDO_REGISTER'), this stands for a reference to machine
  278.      register number N: a "hard register".  For larger values of N, it
  279.      stands for a temporary value or "pseudo register".  The compiler's
  280.      strategy is to generate code assuming an unlimited number of such
  281.      pseudo registers, and later convert them into hard registers or
  282.      into memory references.
  283.      M is the machine mode of the reference.  It is necessary because
  284.      machines can generally refer to each register in more than one
  285.      mode.  For example, a register may contain a full word but there
  286.      may be instructions to refer to it as a half word or as a single
  287.      byte, as well as instructions to refer to it as a floating point
  288.      number of various precisions.
  289.      Even for a register that the machine can access in only one mode,
  290.      the mode must always be specified.
  291.      The symbol `FIRST_PSEUDO_REGISTER' is defined by the machine
  292.      description, since the number of hard registers on the machine is
  293.      an invariant characteristic of the machine.  Note, however, that
  294.      not all of the machine registers must be general registers.  All
  295.      the machine registers that can be used for storage of data are
  296.      given hard register numbers, even those that can be used only in
  297.      certain instructions or can hold only certain types of data.
  298.      A hard register may be accessed in various modes throughout one
  299.      function, but each pseudo register is given a natural mode and is
  300.      accessed only in that mode.  When it is necessary to describe an
  301.      access to a pseudo register using a nonnatural mode, a `subreg'
  302.      expression is used.
  303.      A `reg' expression with a machine mode that specifies more than
  304.      one word of data may actually stand for several consecutive
  305.      registers.  If in addition the register number specifies a
  306.      hardware register, then it actually represents several consecutive
  307.      hardware registers starting with the specified one.
  308.      Each pseudo register number used in a function's RTL code is
  309.      represented by a unique `reg' expression.
  310.      Some pseudo register numbers, those within the range of
  311.      `FIRST_VIRTUAL_REGISTER' to `LAST_VIRTUAL_REGISTER' only appear
  312.      during the RTL generation phase and are eliminated before the
  313.      optimization phases.  These represent locations in the stack frame
  314.      that cannot be determined until RTL generation for the function
  315.      has been completed.  The following virtual register numbers are
  316.      defined:
  317.     `VIRTUAL_INCOMING_ARGS_REGNUM'
  318.           This points to the first word of the incoming arguments
  319.           passed on the stack.  Normally these arguments are placed
  320.           there by the caller, but the callee may have pushed some
  321.           arguments that were previously passed in registers.
  322.           When RTL generation is complete, this virtual register is
  323.           replaced by the sum of the register given by
  324.           `ARG_POINTER_REGNUM' and the value of `FIRST_PARM_OFFSET'.
  325.     `VIRTUAL_STACK_VARS_REGNUM'
  326.           If `FRAME_GROWS_DOWNWARD' is defined, this points to
  327.           immediately above the first variable on the stack.
  328.           Otherwise, it points to the first variable on the stack.
  329.           `VIRTUAL_STACK_VARS_REGNUM' is replaced with the sum of the
  330.           register given by `FRAME_POINTER_REGNUM' and the value
  331.           `STARTING_FRAME_OFFSET'.
  332.     `VIRTUAL_STACK_DYNAMIC_REGNUM'
  333.           This points to the location of dynamically allocated memory
  334.           on the stack immediately after the stack pointer has been
  335.           adjusted by the amount of memory desired.
  336.           This virtual register is replaced by the sum of the register
  337.           given by `STACK_POINTER_REGNUM' and the value
  338.           `STACK_DYNAMIC_OFFSET'.
  339.     `VIRTUAL_OUTGOING_ARGS_REGNUM'
  340.           This points to the location in the stack at which outgoing
  341.           arguments should be written when the stack is pre-pushed
  342.           (arguments pushed using push insns should always use
  343.           `STACK_POINTER_REGNUM').
  344.           This virtual register is replaced by the sum of the register
  345.           given by `STACK_POINTER_REGNUM' and the value
  346.           `STACK_POINTER_OFFSET'.
  347. `(subreg:M REG WORDNUM)'
  348.      `subreg' expressions are used to refer to a register in a machine
  349.      mode other than its natural one, or to refer to one register of a
  350.      multi-word `reg' that actually refers to several registers.
  351.      Each pseudo-register has a natural mode.  If it is necessary to
  352.      operate on it in a different mode--for example, to perform a
  353.      fullword move instruction on a pseudo-register that contains a
  354.      single byte--the pseudo-register must be enclosed in a `subreg'.
  355.      In such a case, WORDNUM is zero.
  356.      Usually M is at least as narrow as the mode of REG, in which case
  357.      it is restricting consideration to only the bits of REG that are
  358.      in M.
  359.      Sometimes M is wider than the mode of REG.  These `subreg'
  360.      expressions are often called "paradoxical".  They are used in
  361.      cases where we want to refer to an object in a wider mode but do
  362.      not care what value the additional bits have.  The reload pass
  363.      ensures that paradoxical references are only made to hard
  364.      registers.
  365.      The other use of `subreg' is to extract the individual registers of
  366.      a multi-register value.  Machine modes such as `DImode' and
  367.      `TImode' can indicate values longer than a word, values which
  368.      usually require two or more consecutive registers.  To access one
  369.      of the registers, use a `subreg' with mode `SImode' and a WORDNUM
  370.      that says which register.
  371.      Storing in a non-paradoxical `subreg' has undefined results for
  372.      bits belonging to the same word as the `subreg'.  This laxity makes
  373.      it easier to generate efficient code for such instructions.  To
  374.      represent an instruction that preserves all the bits outside of
  375.      those in the `subreg', use `strict_low_part' around the `subreg'.
  376.      The compilation parameter `WORDS_BIG_ENDIAN', if set to 1, says
  377.      that word number zero is the most significant part; otherwise, it
  378.      is the least significant part.
  379.      Between the combiner pass and the reload pass, it is possible to
  380.      have a paradoxical `subreg' which contains a `mem' instead of a
  381.      `reg' as its first operand.  After the reload pass, it is also
  382.      possible to have a non-paradoxical `subreg' which contains a
  383.      `mem'; this usually occurs when the `mem' is a stack slot which
  384.      replaced a pseudo register.
  385.      Note that it is not valid to access a `DFmode' value in `SFmode'
  386.      using a `subreg'.  On some machines the most significant part of a
  387.      `DFmode' value does not have the same format as a single-precision
  388.      floating value.
  389.      It is also not valid to access a single word of a multi-word value
  390.      in a hard register when less registers can hold the value than
  391.      would be expected from its size.  For example, some 32-bit
  392.      machines have floating-point registers that can hold an entire
  393.      `DFmode' value.  If register 10 were such a register `(subreg:SI
  394.      (reg:DF 10) 1)' would be invalid because there is no way to
  395.      convert that reference to a single machine register.  The reload
  396.      pass prevents `subreg' expressions such as these from being formed.
  397.      The first operand of a `subreg' expression is customarily accessed
  398.      with the `SUBREG_REG' macro and the second operand is customarily
  399.      accessed with the `SUBREG_WORD' macro.
  400. `(scratch:M)'
  401.      This represents a scratch register that will be required for the
  402.      execution of a single instruction and not used subsequently.  It is
  403.      converted into a `reg' by either the local register allocator or
  404.      the reload pass.
  405.      `scratch' is usually present inside a `clobber' operation (*note
  406.      Side Effects::.).
  407. `(cc0)'
  408.      This refers to the machine's condition code register.  It has no
  409.      operands and may not have a machine mode.  There are two ways to
  410.      use it:
  411.         * To stand for a complete set of condition code flags.  This is
  412.           best on most machines, where each comparison sets the entire
  413.           series of flags.
  414.           With this technique, `(cc0)' may be validly used in only two
  415.           contexts: as the destination of an assignment (in test and
  416.           compare instructions) and in comparison operators comparing
  417.           against zero (`const_int' with value zero; that is to say,
  418.           `const0_rtx').
  419.         * To stand for a single flag that is the result of a single
  420.           condition.  This is useful on machines that have only a
  421.           single flag bit, and in which comparison instructions must
  422.           specify the condition to test.
  423.           With this technique, `(cc0)' may be validly used in only two
  424.           contexts: as the destination of an assignment (in test and
  425.           compare instructions) where the source is a comparison
  426.           operator, and as the first operand of `if_then_else' (in a
  427.           conditional branch).
  428.      There is only one expression object of code `cc0'; it is the value
  429.      of the variable `cc0_rtx'.  Any attempt to create an expression of
  430.      code `cc0' will return `cc0_rtx'.
  431.      Instructions can set the condition code implicitly.  On many
  432.      machines, nearly all instructions set the condition code based on
  433.      the value that they compute or store.  It is not necessary to
  434.      record these actions explicitly in the RTL because the machine
  435.      description includes a prescription for recognizing the
  436.      instructions that do so (by means of the macro
  437.      `NOTICE_UPDATE_CC').  *Note Condition Code::.  Only instructions
  438.      whose sole purpose is to set the condition code, and instructions
  439.      that use the condition code, need mention `(cc0)'.
  440.      On some machines, the condition code register is given a register
  441.      number and a `reg' is used instead of `(cc0)'.  This is usually the
  442.      preferable approach if only a small subset of instructions modify
  443.      the condition code.  Other machines store condition codes in
  444.      general registers; in such cases a pseudo register should be used.
  445.      Some machines, such as the Sparc and RS/6000, have two sets of
  446.      arithmetic instructions, one that sets and one that does not set
  447.      the condition code.  This is best handled by normally generating
  448.      the instruction that does not set the condition code, and making a
  449.      pattern that both performs the arithmetic and sets the condition
  450.      code register (which would not be `(cc0)' in this case).  For
  451.      examples, search for `addcc' and `andcc' in `sparc.md'.
  452. `(pc)'
  453.      This represents the machine's program counter.  It has no operands
  454.      and may not have a machine mode.  `(pc)' may be validly used only
  455.      in certain specific contexts in jump instructions.
  456.      There is only one expression object of code `pc'; it is the value
  457.      of the variable `pc_rtx'.  Any attempt to create an expression of
  458.      code `pc' will return `pc_rtx'.
  459.      All instructions that do not jump alter the program counter
  460.      implicitly by incrementing it, but there is no need to mention
  461.      this in the RTL.
  462. `(mem:M ADDR)'
  463.      This RTX represents a reference to main memory at an address
  464.      represented by the expression ADDR.  M specifies how large a unit
  465.      of memory is accessed.
  466. File: gcc.info,  Node: Arithmetic,  Next: Comparisons,  Prev: Regs and Memory,  Up: RTL
  467. RTL Expressions for Arithmetic
  468. ==============================
  469.    Unless otherwise specified, all the operands of arithmetic
  470. expressions must be valid for mode M.  An operand is valid for mode M
  471. if it has mode M, or if it is a `const_int' or `const_double' and M is
  472. a mode of class `MODE_INT'.
  473.    For commutative binary operations, constants should be placed in the
  474. second operand.
  475. `(plus:M X Y)'
  476.      Represents the sum of the values represented by X and Y carried
  477.      out in machine mode M.
  478. `(lo_sum:M X Y)'
  479.      Like `plus', except that it represents that sum of X and the
  480.      low-order bits of Y.  The number of low order bits is
  481.      machine-dependent but is normally the number of bits in a `Pmode'
  482.      item minus the number of bits set by the `high' code (*note
  483.      Constants::.).
  484.      M should be `Pmode'.
  485. `(minus:M X Y)'
  486.      Like `plus' but represents subtraction.
  487. `(compare:M X Y)'
  488.      Represents the result of subtracting Y from X for purposes of
  489.      comparison.  The result is computed without overflow, as if with
  490.      infinite precision.
  491.      Of course, machines can't really subtract with infinite precision.
  492.      However, they can pretend to do so when only the sign of the
  493.      result will be used, which is the case when the result is stored
  494.      in the condition code.   And that is the only way this kind of
  495.      expression may validly be used: as a value to be stored in the
  496.      condition codes.
  497.      The mode M is not related to the modes of X and Y, but instead is
  498.      the mode of the condition code value.  If `(cc0)' is used, it is
  499.      `VOIDmode'.  Otherwise it is some mode in class `MODE_CC', often
  500.      `CCmode'.  *Note Condition Code::.
  501.      Normally, X and Y must have the same mode.  Otherwise, `compare'
  502.      is valid only if the mode of X is in class `MODE_INT' and Y is a
  503.      `const_int' or `const_double' with mode `VOIDmode'.  The mode of X
  504.      determines what mode the comparison is to be done in; thus it must
  505.      not be `VOIDmode'.
  506.      If one of the operands is a constant, it should be placed in the
  507.      second operand and the comparison code adjusted as appropriate.
  508.      A `compare' specifying two `VOIDmode' constants is not valid since
  509.      there is no way to know in what mode the comparison is to be
  510.      performed; the comparison must either be folded during the
  511.      compilation or the first operand must be loaded into a register
  512.      while its mode is still known.
  513. `(neg:M X)'
  514.      Represents the negation (subtraction from zero) of the value
  515.      represented by X, carried out in mode M.
  516. `(mult:M X Y)'
  517.      Represents the signed product of the values represented by X and Y
  518.      carried out in machine mode M.
  519.      Some machines support a multiplication that generates a product
  520.      wider than the operands.  Write the pattern for this as
  521.           (mult:M (sign_extend:M X) (sign_extend:M Y))
  522.      where M is wider than the modes of X and Y, which need not be the
  523.      same.
  524.      Write patterns for unsigned widening multiplication similarly using
  525.      `zero_extend'.
  526. `(div:M X Y)'
  527.      Represents the quotient in signed division of X by Y, carried out
  528.      in machine mode M.  If M is a floating point mode, it represents
  529.      the exact quotient; otherwise, the integerized quotient.
  530.      Some machines have division instructions in which the operands and
  531.      quotient widths are not all the same; you should represent such
  532.      instructions using `truncate' and `sign_extend' as in,
  533.           (truncate:M1 (div:M2 X (sign_extend:M2 Y)))
  534. `(udiv:M X Y)'
  535.      Like `div' but represents unsigned division.
  536. `(mod:M X Y)'
  537. `(umod:M X Y)'
  538.      Like `div' and `udiv' but represent the remainder instead of the
  539.      quotient.
  540. `(smin:M X Y)'
  541. `(smax:M X Y)'
  542.      Represents the smaller (for `smin') or larger (for `smax') of X
  543.      and Y, interpreted as signed integers in mode M.
  544. `(umin:M X Y)'
  545. `(umax:M X Y)'
  546.      Like `smin' and `smax', but the values are interpreted as unsigned
  547.      integers.
  548. `(not:M X)'
  549.      Represents the bitwise complement of the value represented by X,
  550.      carried out in mode M, which must be a fixed-point machine mode.
  551. `(and:M X Y)'
  552.      Represents the bitwise logical-and of the values represented by X
  553.      and Y, carried out in machine mode M, which must be a fixed-point
  554.      machine mode.
  555. `(ior:M X Y)'
  556.      Represents the bitwise inclusive-or of the values represented by X
  557.      and Y, carried out in machine mode M, which must be a fixed-point
  558.      mode.
  559. `(xor:M X Y)'
  560.      Represents the bitwise exclusive-or of the values represented by X
  561.      and Y, carried out in machine mode M, which must be a fixed-point
  562.      mode.
  563. `(ashift:M X C)'
  564.      Represents the result of arithmetically shifting X left by C
  565.      places.  X have mode M, a fixed-point machine mode.  C be a
  566.      fixed-point mode or be a constant with mode `VOIDmode'; which mode
  567.      is determined by the mode called for in the machine description
  568.      entry for the left-shift instruction.  For example, on the Vax,
  569.      the mode of C is `QImode' regardless of M.
  570. `(lshiftrt:M X C)'
  571. `(ashiftrt:M X C)'
  572.      Like `ashift' but for right shift.  Unlike the case for left shift,
  573.      these two operations are distinct.
  574. `(rotate:M X C)'
  575. `(rotatert:M X C)'
  576.      Similar but represent left and right rotate.  If C is a constant,
  577.      use `rotate'.
  578. `(abs:M X)'
  579.      Represents the absolute value of X, computed in mode M.
  580. `(sqrt:M X)'
  581.      Represents the square root of X, computed in mode M.  Most often M
  582.      will be a floating point mode.
  583. `(ffs:M X)'
  584.      Represents one plus the index of the least significant 1-bit in X,
  585.      represented as an integer of mode M.  (The value is zero if X is
  586.      zero.)  The mode of X need not be M; depending on the target
  587.      machine, various mode combinations may be valid.
  588. File: gcc.info,  Node: Comparisons,  Next: Bit Fields,  Prev: Arithmetic,  Up: RTL
  589. Comparison Operations
  590. =====================
  591.    Comparison operators test a relation on two operands and are
  592. considered to represent a machine-dependent nonzero value described by,
  593. but not necessarily equal to, `STORE_FLAG_VALUE' (*note Misc::.) if the
  594. relation holds, or zero if it does not.  The mode of the comparison
  595. operation is independent of the mode of the data being compared.  If
  596. the comparison operation is being tested (e.g., the first operand of an
  597. `if_then_else'), the mode must be `VOIDmode'.  If the comparison
  598. operation is producing data to be stored in some variable, the mode
  599. must be in class `MODE_INT'.  All comparison operations producing data
  600. must use the same mode, which is machine-specific.
  601.    There are two ways that comparison operations may be used.  The
  602. comparison operators may be used to compare the condition codes `(cc0)'
  603. against zero, as in `(eq (cc0) (const_int 0))'.  Such a construct
  604. actually refers to the result of the preceding instruction in which the
  605. condition codes were set.  The instructing setting the condition code
  606. must be adjacent to the instruction using the condition code; only
  607. `note' insns may separate them.
  608.    Alternatively, a comparison operation may directly compare two data
  609. objects.  The mode of the comparison is determined by the operands; they
  610. must both be valid for a common machine mode.  A comparison with both
  611. operands constant would be invalid as the machine mode could not be
  612. deduced from it, but such a comparison should never exist in RTL due to
  613. constant folding.
  614.    In the example above, if `(cc0)' were last set to `(compare X Y)',
  615. the comparison operation is identical to `(eq X Y)'.  Usually only one
  616. style of comparisons is supported on a particular machine, but the
  617. combine pass will try to merge the operations to produce the `eq' shown
  618. in case it exists in the context of the particular insn involved.
  619.    Inequality comparisons come in two flavors, signed and unsigned.
  620. Thus, there are distinct expression codes `gt' and `gtu' for signed and
  621. unsigned greater-than.  These can produce different results for the same
  622. pair of integer values: for example, 1 is signed greater-than -1 but not
  623. unsigned greater-than, because -1 when regarded as unsigned is actually
  624. `0xffffffff' which is greater than 1.
  625.    The signed comparisons are also used for floating point values.
  626. Floating point comparisons are distinguished by the machine modes of
  627. the operands.
  628. `(eq:M X Y)'
  629.      1 if the values represented by X and Y are equal, otherwise 0.
  630. `(ne:M X Y)'
  631.      1 if the values represented by X and Y are not equal, otherwise 0.
  632. `(gt:M X Y)'
  633.      1 if the X is greater than Y.  If they are fixed-point, the
  634.      comparison is done in a signed sense.
  635. `(gtu:M X Y)'
  636.      Like `gt' but does unsigned comparison, on fixed-point numbers
  637.      only.
  638. `(lt:M X Y)'
  639. `(ltu:M X Y)'
  640.      Like `gt' and `gtu' but test for "less than".
  641. `(ge:M X Y)'
  642. `(geu:M X Y)'
  643.      Like `gt' and `gtu' but test for "greater than or equal".
  644. `(le:M X Y)'
  645. `(leu:M X Y)'
  646.      Like `gt' and `gtu' but test for "less than or equal".
  647. `(if_then_else COND THEN ELSE)'
  648.      This is not a comparison operation but is listed here because it is
  649.      always used in conjunction with a comparison operation.  To be
  650.      precise, COND is a comparison expression.  This expression
  651.      represents a choice, according to COND, between the value
  652.      represented by THEN and the one represented by ELSE.
  653.      On most machines, `if_then_else' expressions are valid only to
  654.      express conditional jumps.
  655. `(cond [TEST1 VALUE1 TEST2 VALUE2 ...] DEFAULT)'
  656.      Similar to `if_then_else', but more general.  Each of TEST1,
  657.      TEST2, ... is performed in turn.  The result of this expression is
  658.      the VALUE corresponding to the first non-zero test, or DEFAULT if
  659.      none of the tests are non-zero expressions.
  660.      This is currently not valid for instruction patterns and is
  661.      supported only for insn attributes.  *Note Insn Attributes::.
  662. File: gcc.info,  Node: Bit Fields,  Next: Conversions,  Prev: Comparisons,  Up: RTL
  663. Bit Fields
  664. ==========
  665.    Special expression codes exist to represent bitfield instructions.
  666. These types of expressions are lvalues in RTL; they may appear on the
  667. left side of an assignment, indicating insertion of a value into the
  668. specified bit field.
  669. `(sign_extract:M LOC SIZE POS)'
  670.      This represents a reference to a sign-extended bit field contained
  671.      or starting in LOC (a memory or register reference).  The bit field
  672.      is SIZE bits wide and starts at bit POS.  The compilation option
  673.      `BITS_BIG_ENDIAN' says which end of the memory unit POS counts
  674.      from.
  675.      If LOC is in memory, its mode must be a single-byte integer mode.
  676.      If LOC is in a register, the mode to use is specified by the
  677.      operand of the `insv' or `extv' pattern (*note Standard Names::.)
  678.      and is usually a full-word integer mode.
  679.      The mode of POS is machine-specific and is also specified in the
  680.      `insv' or `extv' pattern.
  681.      The mode M is the same as the mode that would be used for LOC if
  682.      it were a register.
  683. `(zero_extract:M LOC SIZE POS)'
  684.      Like `sign_extract' but refers to an unsigned or zero-extended bit
  685.      field.  The same sequence of bits are extracted, but they are
  686.      filled to an entire word with zeros instead of by sign-extension.
  687. File: gcc.info,  Node: Conversions,  Next: RTL Declarations,  Prev: Bit Fields,  Up: RTL
  688. Conversions
  689. ===========
  690.    All conversions between machine modes must be represented by
  691. explicit conversion operations.  For example, an expression which is
  692. the sum of a byte and a full word cannot be written as `(plus:SI
  693. (reg:QI 34) (reg:SI 80))' because the `plus' operation requires two
  694. operands of the same machine mode.  Therefore, the byte-sized operand
  695. is enclosed in a conversion operation, as in
  696.      (plus:SI (sign_extend:SI (reg:QI 34)) (reg:SI 80))
  697.    The conversion operation is not a mere placeholder, because there
  698. may be more than one way of converting from a given starting mode to
  699. the desired final mode.  The conversion operation code says how to do
  700.    For all conversion operations, X must not be `VOIDmode' because the
  701. mode in which to do the conversion would not be known.  The conversion
  702. must either be done at compile-time or X must be placed into a register.
  703. `(sign_extend:M X)'
  704.      Represents the result of sign-extending the value X to machine
  705.      mode M.  M must be a fixed-point mode and X a fixed-point value of
  706.      a mode narrower than M.
  707. `(zero_extend:M X)'
  708.      Represents the result of zero-extending the value X to machine
  709.      mode M.  M must be a fixed-point mode and X a fixed-point value of
  710.      a mode narrower than M.
  711. `(float_extend:M X)'
  712.      Represents the result of extending the value X to machine mode M.
  713.      m must be a floating point mode and X a floating point value of a
  714.      mode narrower than M.
  715. `(truncate:M X)'
  716.      Represents the result of truncating the value X to machine mode M.
  717.      M must be a fixed-point mode and X a fixed-point value of a mode
  718.      wider than M.
  719. `(float_truncate:M X)'
  720.      Represents the result of truncating the value X to machine mode M.
  721.      M must be a floating point mode and X a floating point value of a
  722.      mode wider than M.
  723. `(float:M X)'
  724.      Represents the result of converting fixed point value X, regarded
  725.      as signed, to floating point mode M.
  726. `(unsigned_float:M X)'
  727.      Represents the result of converting fixed point value X, regarded
  728.      as unsigned, to floating point mode M.
  729. `(fix:M X)'
  730.      When M is a fixed point mode, represents the result of converting
  731.      floating point value X to mode M, regarded as signed.  How
  732.      rounding is done is not specified, so this operation may be used
  733.      validly in compiling C code only for integer-valued operands.
  734. `(unsigned_fix:M X)'
  735.      Represents the result of converting floating point value X to
  736.      fixed point mode M, regarded as unsigned.  How rounding is done is
  737.      not specified.
  738. `(fix:M X)'
  739.      When M is a floating point mode, represents the result of
  740.      converting floating point value X (valid for mode M) to an
  741.      integer, still represented in floating point mode M, by rounding
  742.      towards zero.
  743. File: gcc.info,  Node: RTL Declarations,  Next: Side Effects,  Prev: Conversions,  Up: RTL
  744. Declarations
  745. ============
  746.    Declaration expression codes do not represent arithmetic operations
  747. but rather state assertions about their operands.
  748. `(strict_low_part (subreg:M (reg:N R) 0))'
  749.      This expression code is used in only one context: as the
  750.      destination operand of a `set' expression.  In addition, the
  751.      operand of this expression must be a non-paradoxical `subreg'
  752.      expression.
  753.      The presence of `strict_low_part' says that the part of the
  754.      register which is meaningful in mode N, but is not part of mode M,
  755.      is not to be altered.  Normally, an assignment to such a subreg is
  756.      allowed to have undefined effects on the rest of the register when
  757.      M is less than a word.
  758.