home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 7 / FreshFishVol7.bin / bbs / gnu / gcc-2.3.3-src.lha / GNU / src / amiga / gcc-2.3.3 / gcc.info-15 (.txt) < prev    next >
GNU Info File  |  1994-02-06  |  50KB  |  850 lines

  1. This is Info file gcc.info, produced by Makeinfo-1.49 from the input
  2. file gcc.texi.
  3.    This file documents the use and the internals of the GNU compiler.
  4.    Copyright (C) 1988, 1989, 1992 Free Software Foundation, Inc.
  5.    Permission is granted to make and distribute verbatim copies of this
  6. manual provided the copyright notice and this permission notice are
  7. preserved on all copies.
  8.    Permission is granted to copy and distribute modified versions of
  9. this manual under the conditions for verbatim copying, provided also
  10. that the sections entitled "GNU General Public License" and "Protect
  11. Your Freedom--Fight `Look And Feel'" are included exactly as in the
  12. original, and provided that the entire resulting derived work is
  13. distributed under the terms of a permission notice identical to this
  14.    Permission is granted to copy and distribute translations of this
  15. manual into another language, under the above conditions for modified
  16. versions, except that the sections entitled "GNU General Public
  17. License" and "Protect Your Freedom--Fight `Look And Feel'", and this
  18. permission notice, may be included in translations approved by the Free
  19. Software Foundation instead of in the original English.
  20. File: gcc.info,  Node: Register Classes,  Next: Stack and Calling,  Prev: Registers,  Up: Target Macros
  21. Register Classes
  22. ================
  23.    On many machines, the numbered registers are not all equivalent. For
  24. example, certain registers may not be allowed for indexed addressing;
  25. certain registers may not be allowed in some instructions.  These
  26. machine restrictions are described to the compiler using "register
  27. classes".
  28.    You define a number of register classes, giving each one a name and
  29. saying which of the registers belong to it.  Then you can specify
  30. register classes that are allowed as operands to particular instruction
  31. patterns.
  32.    In general, each register will belong to several classes.  In fact,
  33. one class must be named `ALL_REGS' and contain all the registers. 
  34. Another class must be named `NO_REGS' and contain no registers.  Often
  35. the union of two classes will be another class; however, this is not
  36. required.
  37.    One of the classes must be named `GENERAL_REGS'.  There is nothing
  38. terribly special about the name, but the operand constraint letters `r'
  39. and `g' specify this class.  If `GENERAL_REGS' is the same as
  40. `ALL_REGS', just define it as a macro which expands to `ALL_REGS'.
  41.    Order the classes so that if class X is contained in class Y then X
  42. has a lower class number than Y.
  43.    The way classes other than `GENERAL_REGS' are specified in operand
  44. constraints is through machine-dependent operand constraint letters.
  45. You can define such letters to correspond to various classes, then use
  46. them in operand constraints.
  47.    You should define a class for the union of two classes whenever some
  48. instruction allows both classes.  For example, if an instruction allows
  49. either a floating point (coprocessor) register or a general register
  50. for a certain operand, you should define a class `FLOAT_OR_GENERAL_REGS'
  51. which includes both of them.  Otherwise you will get suboptimal code.
  52.    You must also specify certain redundant information about the
  53. register classes: for each class, which classes contain it and which
  54. ones are contained in it; for each pair of classes, the largest class
  55. contained in their union.
  56.    When a value occupying several consecutive registers is expected in a
  57. certain class, all the registers used must belong to that class.
  58. Therefore, register classes cannot be used to enforce a requirement for
  59. a register pair to start with an even-numbered register.  The way to
  60. specify this requirement is with `HARD_REGNO_MODE_OK'.
  61.    Register classes used for input-operands of bitwise-and or shift
  62. instructions have a special requirement: each such class must have, for
  63. each fixed-point machine mode, a subclass whose registers can transfer
  64. that mode to or from memory.  For example, on some machines, the
  65. operations for single-byte values (`QImode') are limited to certain
  66. registers.  When this is so, each register class that is used in a
  67. bitwise-and or shift instruction must have a subclass consisting of
  68. registers from which single-byte values can be loaded or stored.  This
  69. is so that `PREFERRED_RELOAD_CLASS' can always have a possible value to
  70. return.
  71. `enum reg_class'
  72.      An enumeral type that must be defined with all the register class
  73.      names as enumeral values.  `NO_REGS' must be first.  `ALL_REGS'
  74.      must be the last register class, followed by one more enumeral
  75.      value, `LIM_REG_CLASSES', which is not a register class but rather
  76.      tells how many classes there are.
  77.      Each register class has a number, which is the value of casting
  78.      the class name to type `int'.  The number serves as an index in
  79.      many of the tables described below.
  80. `N_REG_CLASSES'
  81.      The number of distinct register classes, defined as follows:
  82.           #define N_REG_CLASSES (int) LIM_REG_CLASSES
  83. `REG_CLASS_NAMES'
  84.      An initializer containing the names of the register classes as C
  85.      string constants.  These names are used in writing some of the
  86.      debugging dumps.
  87. `REG_CLASS_CONTENTS'
  88.      An initializer containing the contents of the register classes, as
  89.      integers which are bit masks.  The Nth integer specifies the
  90.      contents of class N.  The way the integer MASK is interpreted is
  91.      that register R is in the class if `MASK & (1 << R)' is 1.
  92.      When the machine has more than 32 registers, an integer does not
  93.      suffice. Then the integers are replaced by sub-initializers,
  94.      braced groupings containing several integers.  Each
  95.      sub-initializer must be suitable as an initializer for the type
  96.      `HARD_REG_SET' which is defined in `hard-reg-set.h'.
  97. `REGNO_REG_CLASS (REGNO)'
  98.      A C expression whose value is a register class containing hard
  99.      register REGNO.  In general there is more than one such class;
  100.      choose a class which is "minimal", meaning that no smaller class
  101.      also contains the register.
  102. `BASE_REG_CLASS'
  103.      A macro whose definition is the name of the class to which a valid
  104.      base register must belong.  A base register is one used in an
  105.      address which is the register value plus a displacement.
  106. `INDEX_REG_CLASS'
  107.      A macro whose definition is the name of the class to which a valid
  108.      index register must belong.  An index register is one used in an
  109.      address where its value is either multiplied by a scale factor or
  110.      added to another register (as well as added to a displacement).
  111. `REG_CLASS_FROM_LETTER (CHAR)'
  112.      A C expression which defines the machine-dependent operand
  113.      constraint letters for register classes.  If CHAR is such a
  114.      letter, the value should be the register class corresponding to
  115.      it.  Otherwise, the value should be `NO_REGS'.  The register
  116.      letter `r', corresponding to class `GENERAL_REGS', will not be
  117.      passed to this macro; you do not need to handle it.
  118. `REGNO_OK_FOR_BASE_P (NUM)'
  119.      A C expression which is nonzero if register number NUM is suitable
  120.      for use as a base register in operand addresses.  It may be either
  121.      a suitable hard register or a pseudo register that has been
  122.      allocated such a hard register.
  123. `REGNO_OK_FOR_INDEX_P (NUM)'
  124.      A C expression which is nonzero if register number NUM is suitable
  125.      for use as an index register in operand addresses.  It may be
  126.      either a suitable hard register or a pseudo register that has been
  127.      allocated such a hard register.
  128.      The difference between an index register and a base register is
  129.      that the index register may be scaled.  If an address involves the
  130.      sum of two registers, neither one of them scaled, then either one
  131.      may be labeled the "base" and the other the "index"; but whichever
  132.      labeling is used must fit the machine's constraints of which
  133.      registers may serve in each capacity.  The compiler will try both
  134.      labelings, looking for one that is valid, and will reload one or
  135.      both registers only if neither labeling works.
  136. `PREFERRED_RELOAD_CLASS (X, CLASS)'
  137.      A C expression that places additional restrictions on the register
  138.      class to use when it is necessary to copy value X int