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 >
Wrap
GNU Info File
|
1994-02-06
|
45KB
|
775 lines
This is Info file gcc.info, produced by Makeinfo-1.49 from the input
file gcc.texi.
This file documents the use and the internals of the GNU compiler.
Copyright (C) 1988, 1989, 1992 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.
Permission is granted to copy and distribute modified versions of
this manual under the conditions for verbatim copying, provided also
that the sections entitled "GNU General Public License" and "Protect
Your Freedom--Fight `Look And Feel'" are included exactly as in the
original, and provided that the entire resulting derived work is
distributed under the terms of a permission notice identical to this
Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions, except that the sections entitled "GNU General Public
License" and "Protect Your Freedom--Fight `Look And Feel'", and this
permission notice, may be included in translations approved by the Free
Software Foundation instead of in the original English.
File: gcc.info, Node: Costs, Next: Sections, Prev: Condition Code, Up: Target Macros
Describing Relative Costs of Operations
=======================================
These macros let you describe the relative speed of various
operations on the target machine.
`CONST_COSTS (X, CODE, OUTER_CODE)'
A part of a C `switch' statement that describes the relative costs
of constant RTL expressions. It must contain `case' labels for
expression codes `const_int', `const', `symbol_ref', `label_ref'
and `const_double'. Each case must ultimately reach a `return'
statement to return the relative cost of the use of that kind of
constant value in an expression. The cost may depend on the
precise value of the constant, which is available for examination
in X, and the rtx code of the expression in which it is contained,
found in OUTER_CODE.
CODE is the expression code--redundant, since it can be obtained
with `GET_CODE (X)'.
`RTX_COSTS (X, CODE, OUTER_CODE)'
Like `CONST_COSTS' but applies to nonconstant RTL expressions.
This can be used, for example, to indicate how costly a multiply
instruction is. In writing this macro, you can use the construct
`COSTS_N_INSNS (N)' to specify a cost equal to N fast
instructions. OUTER_CODE is the code of the expression in which X
is contained.
This macro is optional; do not define it if the default cost
assumptions are adequate for the target machine.
`ADDRESS_COST (ADDRESS)'
An expression giving the cost of an addressing mode that contains
ADDRESS. If not defined, the cost is computed from the ADDRESS
expression and the `CONST_COSTS' values.
For most CISC machines, the default cost is a good approximation
of the true cost of the addressing mode. However, on RISC
machines, all instructions normally have the same length and
execution time. Hence all addresses will have equal costs.
In cases where more than one form of an address is known, the form
with the lowest cost will be used. If multiple forms have the
same, lowest, cost, the one that is the most complex will be used.
For example, suppose an address that is equal to the sum of a
register and a constant is used twice in the same basic block.
When this macro is not defined, the address will be computed in a
register and memory references will be indirect through that
register. On machines where the cost of the addressing mode
containing the sum is no higher than that of a simple indirect
reference, this will produce an additional instruction and
possibly require an additional register. Proper specification of
this macro eliminates this overhead for such machines.
Similar use of this macro is made in strength reduction of loops.
ADDRESS need not be valid as an address. In such a case, the cost
is not relevant and can be any value; invalid addresses need not be
assigned a different cost.
On machines where an address involving more than one register is as
cheap as an address computation involving only one register,
defining `ADDRESS_COST' to reflect this can cause two registers to
be live over a region of code where only one would have been if
`ADDRESS_COST' were not defined in that manner. This effect should
be considered in the definition of this macro. Equivalent costs
should probably only be given to addresses with different numbers
of registers on machines with lots of registers.
This macro will normally either not be defined or be defined as a
constant.
`REGISTER_MOVE_COST (FROM, TO)'
A C expression for the cost of moving data from a register in class
FROM to one in class TO. The classes are expressed using the
enumeration values such as `GENERAL_REGS'. A value of 2 is the
default; other values are interpreted relative to that.
It is not required that the cost always equal 2 when FROM is the
same as TO; on some machines it is expensive to move between
registers if they are not general registers.
If reload sees an insn consisting of a single `set' between two
hard registers, and if `REGISTER_MOVE_COST' applied to their
classes returns a value of 2, reload does not check to ensure that
the constraints of the insn are met. Setting a cost of other than
2 will allow reload to verify that the constraints are met. You
should do this if the `movM' pattern's constraints do not allow
such copying.
`MEMORY_MOVE_COST (M)'
A C expression for the cost of moving data of mode M between a
register and memory. A value of 2 is the default; this cost is
relative to those in `REGISTER_MOVE_COST'.
If moving between registers and memory is more expensive than
between two registers, you should define this macro to express the
relative cost.
`BRANCH_COST'
A C expression for the cost of a branch instruction. A value of 1
is the default; other values are interpreted relative to that.
Here are additional macros which do not specify precise relative
costs, but only that certain actions are more expensive than GNU CC
would ordinarily expect.
`SLOW_BYTE_ACCESS'
Define this macro as a C expression which is nonzero if accessing
less than a word of memory (i.e. a `char' or a `short') is no
faster than accessing a word of memory, i.e., if such access
require more than one instruction or if there is no difference in
cost between byte and (aligned) word loads.
When this macro is not defined, the compiler will access a field by
finding the smallest containing object; when it is defined, a
fullword load will be used if alignment permits. Unless bytes
accesses are faster than word accesses, using word accesses is
preferable since it may eliminate subsequent memory access if
subsequent accesses occur to other fields in the same word of the
structure, but to different bytes.
`SLOW_ZERO_EXTEND'
Define this macro if zero-extension (of a `char' or `short' to an
`int') can be done faster if the destination is a register that is
known to be zero.
If you define this macro, you must have instruction patterns that
recognize RTL structures like this:
(set (strict_low_part (subreg:QI (reg:SI ...) 0)) ...)
and likewise for `HImode'.
`SLOW_UNALIGNED_ACCESS'
Define this macro to be the value 1 if unaligned accesses have a
cost many times greater than aligned accesses, for example if they
are emulated in a trap handler.
When this macro is non-zero, the compiler will act as if
`STRICT_ALIGNMENT' were non-zero when generating code for block
moves. This can cause significantly more instructions to be
produced. Therefore, do not set this macro non-zero if unaligned
accesses only add a cycle or two to the time for a memory