summaryrefslogtreecommitdiff
path: root/gcc/combine.c
diff options
context:
space:
mode:
authorkrebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4>2012-12-19 12:39:17 +0000
committerkrebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4>2012-12-19 12:39:17 +0000
commitd5065e6e5546d31ca14bdf7105d94ca845b2a885 (patch)
treeb7f4e93614d364fb2bd6d9376c85d35b25544854 /gcc/combine.c
parent598006de8ec8b8edd22ce29c3def8d871eb52fc8 (diff)
downloadgcc-d5065e6e5546d31ca14bdf7105d94ca845b2a885.tar.gz
2012-12-19 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@194608 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/combine.c')
-rw-r--r--gcc/combine.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index abd67e8ab9c..001025cc36f 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -494,6 +494,17 @@ static rtx gen_lowpart_or_truncate (enum machine_mode, rtx);
static const struct rtl_hooks combine_rtl_hooks = RTL_HOOKS_INITIALIZER;
+/* Convenience wrapper for the canonicalize_comparison target hook.
+ Target hooks cannot use enum rtx_code. */
+static inline void
+target_canonicalize_comparison (enum rtx_code *code, rtx *op0, rtx *op1,
+ bool op0_preserve_value)
+{
+ int code_int = (int)*code;
+ targetm.canonicalize_comparison (&code_int, op0, op1, op0_preserve_value);
+ *code = (enum rtx_code)code_int;
+}
+
/* Try to split PATTERN found in INSN. This returns NULL_RTX if
PATTERN can not be split. Otherwise, it returns an insn sequence.
This is a wrapper around split_insns which ensures that the
@@ -2944,9 +2955,7 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx i0, int *new_direct_jump_p,
compare_code = orig_compare_code = GET_CODE (*cc_use_loc);
compare_code = simplify_compare_const (compare_code,
op0, &op1);
-#ifdef CANONICALIZE_COMPARISON
- CANONICALIZE_COMPARISON (compare_code, op0, op1);
-#endif
+ target_canonicalize_comparison (&compare_code, &op0, &op1, 1);
}
/* Do the rest only if op1 is const0_rtx, which may be the
@@ -11959,11 +11968,9 @@ simplify_comparison (enum rtx_code code, rtx *pop0, rtx *pop1)
}
}
-#ifdef CANONICALIZE_COMPARISON
/* If this machine only supports a subset of valid comparisons, see if we
can convert an unsupported one into a supported one. */
- CANONICALIZE_COMPARISON (code, op0, op1);
-#endif
+ target_canonicalize_comparison (&code, &op0, &op1, 0);
*pop0 = op0;
*pop1 = op1;