diff options
-rw-r--r-- | gcc/doc/tm.texi | 77 |
1 files changed, 35 insertions, 42 deletions
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 84dc1de..382df86 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -5264,48 +5264,6 @@ These macros let you describe the relative speed of various operations on the target machine. @table @code -@findex ADDRESS_COST -@item ADDRESS_COST (@var{address}) -An expression giving the cost of an addressing mode that contains -@var{address}. If not defined, the cost is computed from -the @var{address} expression and the @code{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. - -@var{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 -@code{ADDRESS_COST} to reflect this can cause two registers to be live -over a region of code where only one would have been if -@code{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. - @findex REGISTER_MOVE_COST @item REGISTER_MOVE_COST (@var{mode}, @var{from}, @var{to}) A C expression for the cost of moving data of mode @var{mode} from a @@ -5529,6 +5487,41 @@ The hook returns true when all subexpressions of @var{x} have been processed, and false when @code{rtx_cost} should recurse. @end deftypefn +@deftypefn {Target Hook} int TARGET_ADDRESS_COST (rtx @var{address}) +This hook computes the cost of an addressing mode that contains +@var{address}. If not defined, the cost is computed from +the @var{address} expression and the @code{TARGET_RTX_COST} hook. + +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. + +This hook is never called with an invalid address. + +On machines where an address involving more than one register is as +cheap as an address computation involving only one register, defining +@code{TARGET_ADDRESS_COST} to reflect this can cause two registers to +be live over a region of code where only one would have been if +@code{TARGET_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. +@end deftypefn + @node Scheduling @section Adjusting the Instruction Scheduler |