home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / gnu / info / gcc.info-14 (.txt) < prev    next >
GNU Info File  |  1994-12-22  |  51KB  |  875 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 675 Massachusetts Avenue
  5. Cambridge, MA 02139 USA
  6.    Copyright (C) 1988, 1989, 1992, 1993, 1994 Free Software Foundation,
  7.    Permission is granted to make and distribute verbatim copies of this
  8. manual provided the copyright notice and this permission notice are
  9. preserved on all copies.
  10.    Permission is granted to copy and distribute modified versions of
  11. this manual under the conditions for verbatim copying, provided also
  12. that the sections entitled "GNU General Public License," "Funding for
  13. Free Software," and "Protect Your Freedom--Fight `Look And Feel'" are
  14. included exactly as in the original, and provided that the entire
  15. resulting derived work is distributed under the terms of a permission
  16. notice identical to this one.
  17.    Permission is granted to copy and distribute translations of this
  18. manual into another language, under the above conditions for modified
  19. versions, except that the sections entitled "GNU General Public
  20. License," "Funding for Free Software," and "Protect Your Freedom--Fight
  21. `Look And Feel'", and this permission notice, may be included in
  22. translations approved by the Free Software Foundation instead of in the
  23. original English.
  24. File: gcc.info,  Node: Insns,  Next: Calls,  Prev: Assembler,  Up: RTL
  25. Insns
  26. =====
  27.    The RTL representation of the code for a function is a doubly-linked
  28. chain of objects called "insns".  Insns are expressions with special
  29. codes that are used for no other purpose.  Some insns are actual
  30. instructions; others represent dispatch tables for `switch' statements;
  31. others represent labels to jump to or various sorts of declarative
  32. information.
  33.    In addition to its own specific data, each insn must have a unique
  34. id-number that distinguishes it from all other insns in the current
  35. function (after delayed branch scheduling, copies of an insn with the
  36. same id-number may be present in multiple places in a function, but
  37. these copies will always be identical and will only appear inside a
  38. `sequence'), and chain pointers to the preceding and following insns.
  39. These three fields occupy the same position in every insn, independent
  40. of the expression code of the insn.  They could be accessed with `XEXP'
  41. and `XINT', but instead three special macros are always used:
  42. `INSN_UID (I)'
  43.      Accesses the unique id of insn I.
  44. `PREV_INSN (I)'
  45.      Accesses the chain pointer to the insn preceding I.  If I is the
  46.      first insn, this is a null pointer.
  47. `NEXT_INSN (I)'
  48.      Accesses the chain pointer to the insn following I.  If I is the
  49.      last insn, this is a null pointer.
  50.    The first insn in the chain is obtained by calling `get_insns'; the
  51. last insn is the result of calling `get_last_insn'.  Within the chain
  52. delimited by these insns, the `NEXT_INSN' and `PREV_INSN' pointers must
  53. always correspond: if INSN is not the first insn,
  54.      NEXT_INSN (PREV_INSN (INSN)) == INSN
  55. is always true and if INSN is not the last insn,
  56.      PREV_INSN (NEXT_INSN (INSN)) == INSN
  57. is always true.
  58.    After delay slot scheduling, some of the insns in the chain might be
  59. `sequence' expressions, which contain a vector of insns.  The value of
  60. `NEXT_INSN' in all but the last of these insns is the next insn in the
  61. vector; the value of `NEXT_INSN' of the last insn in the vector is the
  62. same as the value of `NEXT_INSN' for the `sequence' in which it is
  63. contained.  Similar rules apply for `PREV_INSN'.
  64.    This means that the above invariants are not necessarily true for
  65. insns inside `sequence' expressions.  Specifically, if INSN is the
  66. first insn in a `sequence', `NEXT_INSN (PREV_INSN (INSN))' is the insn
  67. containing the `sequence' expression, as is the value of `PREV_INSN
  68. (NEXT_INSN (INSN))' is INSN is the last insn in the `sequence'
  69. expression.  You can use these expressions to find the containing
  70. `sequence' expression.
  71.    Every insn has one of the following six expression codes:
  72. `insn'
  73.      The expression code `insn' is used for instructions that do not
  74.      jump and do not do function calls.  `sequence' expressions are
  75.      always contained in insns with code `insn' even if one of those
  76.      insns should jump or do function calls.
  77.      Insns with code `insn' have four additional fields beyond the three
  78.      mandatory ones listed above.  These four are described in a table
  79.      below.
  80. `jump_insn'
  81.      The expression code `jump_insn' is used for instructions that may
  82.      jump (or, more generally, may contain `label_ref' expressions).  If
  83.      there is an instruction to return from the current function, it is
  84.      recorded as a `jump_insn'.
  85.      `jump_insn' insns have the same extra fields as `insn' insns,
  86.      accessed in the same way and in addition contain a field
  87.      `JUMP_LABEL' which is defined once jump optimization has completed.
  88.      For simple conditional and unconditional jumps, this field
  89.      contains the `code_label' to which this insn will (possibly
  90.      conditionally) branch.  In a more complex jump, `JUMP_LABEL'
  91.      records one of the labels that the insn refers to; the only way to
  92.      find the others is to scan the entire body of the insn.
  93.      Return insns count as jumps, but since they do not refer to any
  94.      labels, they have zero in the `JUMP_LABEL' field.
  95. `call_insn'
  96.      The expression code `call_insn' is used for instructions that may
  97.      do function calls.  It is important to distinguish these
  98.      instructions because they imply that certain registers and memory
  99.      locations may be altered unpredictably.
  100.      `call_insn' insns have the same extra fields as `insn' insns,
  101.      accessed in the same way and in addition contain a field
  102.      `CALL_INSN_FUNCTION_USAGE', which contains a list (chain of
  103.      `expr_list' expressions) containing `use' and `clobber'
  104.      expressions that denote hard registers used or clobbered by the
  105.      called function.  A register specified in a `clobber' in this list
  106.      is modified *after* the execution of the `call_insn', while a
  107.      register in a `clobber' in the body of the `call_insn' is
  108.      clobbered before the insn completes execution.  `clobber'
  109.      expressions in this list augment registers specified in
  110.      `CALL_USED_REGISTERS' (*note Register Basics::.).
  111. `code_label'
  112.      A `code_label' insn represents a label that a jump insn can jump
  113.      to.  It contains two special fields of data in addition to the
  114.      three standard ones.  `CODE_LABEL_NUMBER' is used to hold the
  115.      "label number", a number that identifies this label uniquely among
  116.      all the labels in the compilation (not just in the current
  117.      function).  Ultimately, the label is represented in the assembler
  118.      output as an assembler label, usually of the form `LN' where N is
  119.      the label number.
  120.      When a `code_label' appears in an RTL expression, it normally
  121.      appears within a `label_ref' which represents the address of the
  122.      label, as a number.
  123.      The field `LABEL_NUSES' is only defined once the jump optimization
  124.      phase is completed and contains the number of times this label is
  125.      referenced in the current function.
  126. `barrier'
  127.      Barriers are placed in the instruction stream when control cannot
  128.      flow past them.  They are placed after unconditional jump
  129.      instructions to indicate that the jumps are unconditional and
  130.      after calls to `volatile' functions, which do not return (e.g.,
  131.      `exit').  They contain no information beyond the three standard
  132.      fields.
  133. `note'
  134.      `note' insns are used to represent additional debugging and
  135.      declarative information.  They contain two nonstandard fields, an
  136.      integer which is accessed with the macro `NOTE_LINE_NUMBER' and a
  137.      string accessed with `NOTE_SOURCE_FILE'.
  138.      If `NOTE_LINE_NUMBER' is positive, the note represents the
  139.      position of a source line and `NOTE_SOURCE_FILE' is the source
  140.      file name that the line came from.  These notes control generation
  141.      of line number data in the assembler output.
  142.      Otherwise, `NOTE_LINE_NUMBER' is not really a line number but a
  143.      code with one of the following values (and `NOTE_SOURCE_