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-17 (.txt) < prev    next >
GNU Info File  |  1994-02-06  |  45KB  |  775 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: Costs,  Next: Sections,  Prev: Condition Code,  Up: Target Macros
  21. Describing Relative Costs of Operations
  22. =======================================
  23.    These macros let you describe the relative speed of various
  24. operations on the target machine.
  25. `CONST_COSTS (X, CODE, OUTER_CODE)'
  26.      A part of a C `switch' statement that describes the relative costs
  27.      of constant RTL expressions.  It must contain `case' labels for
  28.      expression codes `const_int', `const', `symbol_ref', `label_ref'
  29.      and `const_double'.  Each case must ultimately reach a `return'
  30.      statement to return the relative cost of the use of that kind of
  31.      constant value in an expression.  The cost may depend on the
  32.      precise value of the constant, which is available for examination
  33.      in X, and the rtx code of the expression in which it is contained,
  34.      found in OUTER_CODE.
  35.      CODE is the expression code--redundant, since it can be obtained
  36.      with `GET_CODE (X)'.
  37. `RTX_COSTS (X, CODE, OUTER_CODE)'
  38.      Like `CONST_COSTS' but applies to nonconstant RTL expressions.
  39.      This can be used, for example, to indicate how costly a multiply
  40.      instruction is.  In writing this macro, you can use the construct
  41.      `COSTS_N_INSNS (N)' to specify a cost equal to N fast
  42.      instructions.  OUTER_CODE is the code of the expression in which X
  43.      is contained.
  44.      This macro is optional; do not define it if the default cost
  45.      assumptions are adequate for the target machine.
  46. `ADDRESS_COST (ADDRESS)'
  47.      An expression giving the cost of an addressing mode that contains
  48.      ADDRESS.  If not defined, the cost is computed from the ADDRESS
  49.      expression and the `CONST_COSTS' values.
  50.      For most CISC machines, the default cost is a good approximation
  51.      of the true cost of the addressing mode.  However, on RISC
  52.      machines, all instructions normally have the same length and
  53.      execution time.  Hence all addresses will have equal costs.
  54.      In cases where more than one form of an address is known, the form
  55.      with the lowest cost will be used.  If multiple forms have the
  56.      same, lowest, cost, the one that is the most complex will be used.
  57.      For example, suppose an address that is equal to the sum of a
  58.      register and a constant is used twice in the same basic block. 
  59.      When this macro is not defined, the address will be computed in a
  60.      register and memory references will be indirect through that
  61.      register.  On machines where the cost of the addressing mode
  62.      containing the sum is no higher than that of a simple indirect
  63.      reference, this will produce an additional instruction and
  64.      possibly require an additional register.  Proper specification of
  65.      this macro eliminates this overhead for such machines.
  66.      Similar use of this macro is made in strength reduction of loops.
  67.      ADDRESS need not be valid as an address.  In such a case, the cost
  68.      is not relevant and can be any value; invalid addresses need not be
  69.      assigned a different cost.
  70.      On machines where an address involving more than one register is as
  71.      cheap as an address computation involving only one register,
  72.      defining `ADDRESS_COST' to reflect this can cause two registers to
  73.      be live over a region of code where only one would have been if
  74.      `ADDRESS_COST' were not defined in that manner.  This effect should
  75.      be considered in the definition of this macro.  Equivalent costs
  76.      should probably only be given to addresses with different numbers
  77.      of registers on machines with lots of registers.
  78.      This macro will normally either not be defined or be defined as a
  79.      constant.
  80. `REGISTER_MOVE_COST (FROM, TO)'
  81.      A C expression for the cost of moving data from a register in class
  82.      FROM to one in class TO.  The classes are expressed using the
  83.      enumeration values such as `GENERAL_REGS'.  A value of 2 is the
  84.      default; other values are interpreted relative to that.
  85.      It is not required that the cost always equal 2 when FROM is the
  86.      same as TO; on some machines it is expensive to move between
  87.      registers if they are not general registers.
  88.      If reload sees an insn consisting of a single `set' between two
  89.      hard registers, and if `REGISTER_MOVE_COST' applied to their
  90.      classes returns a value of 2, reload does not check to ensure that
  91.      the constraints of the insn are met.  Setting a cost of other than
  92.      2 will allow reload to verify that the constraints are met.  You
  93.      should do this if the `movM' pattern's constraints do not allow
  94.      such copying.
  95. `MEMORY_MOVE_COST (M)'
  96.      A C expression for the cost of moving data of mode M between a
  97.      register and memory.  A value of 2 is the default; this cost is
  98.      relative to those in `REGISTER_MOVE_COST'.
  99.      If moving between registers and memory is more expensive than
  100.      between two registers, you should define this macro to express the
  101.      relative cost.
  102. `BRANCH_COST'
  103.      A C expression for the cost of a branch instruction.  A value of 1
  104.      is the default; other values are interpreted relative to that.
  105.    Here are additional macros which do not specify precise relative
  106. costs, but only that certain actions are more expensive than GNU CC
  107. would ordinarily expect.
  108. `SLOW_BYTE_ACCESS'
  109.      Define this macro as a C expression which is nonzero if accessing
  110.      less than a word of memory (i.e. a `char' or a `short') is no
  111.      faster than accessing a word of memory, i.e., if such access
  112.      require more than one instruction or if there is no difference in
  113.      cost between byte and (aligned) word loads.
  114.      When this macro is not defined, the compiler will access a field by
  115.      finding the smallest containing object; when it is defined, a
  116.      fullword load will be used if alignment permits.  Unless bytes
  117.      accesses are faster than word accesses, using word accesses is
  118.      preferable since it may eliminate subsequent memory access if
  119.      subsequent accesses occur to other fields in the same word of the
  120.      structure, but to different bytes.
  121. `SLOW_ZERO_EXTEND'
  122.      Define this macro if zero-extension (of a `char' or `short' to an
  123.      `int') can be done faster if the destination is a register that is
  124.      known to be zero.
  125.      If you define this macro, you must have instruction patterns that
  126.      recognize RTL structures like this:
  127.           (set (strict_low_part (subreg:QI (reg:SI ...) 0)) ...)
  128.      and likewise for `HImode'.
  129. `SLOW_UNALIGNED_ACCESS'
  130.      Define this macro to be the value 1 if unaligned accesses have a
  131.      cost many times greater than aligned accesses, for example if they
  132.      are emulated in a trap handler.
  133.      When this macro is non-zero, the compiler will act as if
  134.      `STRICT_ALIGNMENT' were non-zero when generating code for block
  135.      moves.  This can cause significantly more instructions to be
  136.      produced. Therefore, do not set this macro non-zero if unaligned
  137.      accesses only add a cycle or two to the time for a memory