From c354951b7ef67f8bbbca3db79734db73880d17a2 Mon Sep 17 00:00:00 2001 From: Andreas Krebbel Date: Wed, 19 Dec 2012 12:39:17 +0000 Subject: target.def: Define canonicalize_comparison hook. 2012-12-19 Andreas Krebbel * target.def: Define canonicalize_comparison hook. * targhooks.h (default_canonicalize_comparison): New prototype. * targhooks.c (default_canonicalize_comparison): New function. * doc/tm.texi: Add documentation for the new target hook. * doc/tm.texi.in: Likewise. * combine.c (try_combine): Adjust to use the target hook. * config/alpha/alpha.h (CANONICALIZE_COMPARISON): Remove macro definition. * config/alpha/alpha.c (alpha_canonicalize_comparison): New function. (TARGET_CANONICALIZE_COMPARISON): New macro definition. * config/arm/arm-protos.h (arm_canonicalize_comparison): Remove prototype. * config/arm/arm.c (arm_canonicalize_comparison): Add new parameter. (TARGET_CANONICALIZE_COMPARISON): New macro definition. * config/arm/arm.h (CANONICALIZE_COMPARISON): Remove macro definition. * config/s390/s390-protos.h (s390_canonicalize_comparison): Remove prototype. * config/s390/s390.c (s390_canonicalize_comparison): Add new parameter. (TARGET_CANONICALIZE_COMPARISON): New macro definition. * config/s390/s390.h (CANONICALIZE_COMPARISON): Remove macro definition. * config/sh/sh-protos.h (sh_canonicalize_comparison): Remove prototype. * config/sh/sh.c (sh_canonicalize_comparison): Add new prototype. New function overloading the old one. (TARGET_CANONICALIZE_COMPARISON): New macro definition. * config/sh/sh.h (CANONICALIZE_COMPARISON): Remove macro definition. * config/spu/spu.c (spu_canonicalize_comparison): New function. (TARGET_CANONICALIZE_COMPARISON): New macro definition. * config/spu/spu.h (CANONICALIZE_COMPARISON): Remove macro definition. From-SVN: r194608 --- gcc/doc/tm.texi | 20 +++++++++++--------- gcc/doc/tm.texi.in | 20 +++++++++++--------- 2 files changed, 22 insertions(+), 18 deletions(-) (limited to 'gcc/doc') diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 3ab9987..75aa867 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -6024,25 +6024,27 @@ You should define this macro if and only if you define extra CC modes in @file{@var{machine}-modes.def}. @end defmac -@defmac CANONICALIZE_COMPARISON (@var{code}, @var{op0}, @var{op1}) +@deftypefn {Target Hook} void TARGET_CANONICALIZE_COMPARISON (int *@var{code}, rtx *@var{op0}, rtx *@var{op1}, bool @var{op0_preserve_value}) (@var{code}, @var{op0}, @var{op1}, @var{op0_preserve_value}) On some machines not all possible comparisons are defined, but you can convert an invalid comparison into a valid one. For example, the Alpha does not have a @code{GT} comparison, but you can use an @code{LT} comparison instead and swap the order of the operands. -On such machines, define this macro to be a C statement to do any -required conversions. @var{code} is the initial comparison code -and @var{op0} and @var{op1} are the left and right operands of the -comparison, respectively. You should modify @var{code}, @var{op0}, and -@var{op1} as required. +On such machines, implement this hook to do any required conversions. +@var{code} is the initial comparison code and @var{op0} and @var{op1} +are the left and right operands of the comparison, respectively. If +@var{op0_preserve_value} is @code{true} the implementation is not +allowed to change the value of @var{op0} since the value might be used +in RTXs which aren't comparisons. E.g. the implementation is not +allowed to swap operands in that case. GCC will not assume that the comparison resulting from this macro is valid but will see if the resulting insn matches a pattern in the @file{md} file. -You need not define this macro if it would never change the comparison -code or operands. -@end defmac +You need not to implement this hook if it would never change the +comparison code or operands. +@end deftypefn @defmac REVERSIBLE_CC_MODE (@var{mode}) A C expression whose value is one if it is always safe to reverse a diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index 6d48fe4..95fab18 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -5928,25 +5928,27 @@ You should define this macro if and only if you define extra CC modes in @file{@var{machine}-modes.def}. @end defmac -@defmac CANONICALIZE_COMPARISON (@var{code}, @var{op0}, @var{op1}) +@hook TARGET_CANONICALIZE_COMPARISON (@var{code}, @var{op0}, @var{op1}, @var{op0_preserve_value}) On some machines not all possible comparisons are defined, but you can convert an invalid comparison into a valid one. For example, the Alpha does not have a @code{GT} comparison, but you can use an @code{LT} comparison instead and swap the order of the operands. -On such machines, define this macro to be a C statement to do any -required conversions. @var{code} is the initial comparison code -and @var{op0} and @var{op1} are the left and right operands of the -comparison, respectively. You should modify @var{code}, @var{op0}, and -@var{op1} as required. +On such machines, implement this hook to do any required conversions. +@var{code} is the initial comparison code and @var{op0} and @var{op1} +are the left and right operands of the comparison, respectively. If +@var{op0_preserve_value} is @code{true} the implementation is not +allowed to change the value of @var{op0} since the value might be used +in RTXs which aren't comparisons. E.g. the implementation is not +allowed to swap operands in that case. GCC will not assume that the comparison resulting from this macro is valid but will see if the resulting insn matches a pattern in the @file{md} file. -You need not define this macro if it would never change the comparison -code or operands. -@end defmac +You need not to implement this hook if it would never change the +comparison code or operands. +@end deftypefn @defmac REVERSIBLE_CC_MODE (@var{mode}) A C expression whose value is one if it is always safe to reverse a -- cgit v1.1