This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [SH] PR 51244 - Add CANONICALIZE_COMPARISON macro
- From: Kaz Kojima <kkojima at rr dot iij4u dot or dot jp>
- To: oleg dot endo at t-online dot de
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 03 Sep 2012 18:18:15 +0900 (JST)
- Subject: Re: [SH] PR 51244 - Add CANONICALIZE_COMPARISON macro
- References: <1346659967.2200.68.camel@yam-132-YW-E178-FTW>
Oleg Endo <oleg.endo@t-online.de> wrote:
> --- gcc/config/sh/sh.c (revision 190840)
> +++ gcc/config/sh/sh.c (working copy)
> @@ -21,6 +21,12 @@
> along with GCC; see the file COPYING3. If not see
> <http://www.gnu.org/licenses/>. */
>
> +/* FIXME: This is a temporary hack, so that we can include <algorithm>
> + below. <algorithm> will try to include <cstdlib> which will reference
> + malloc & co, which are poisoned by "system.h". The proper solution is
> + to include <cstdlib> in "system.h" instead of <stdlib.h>. */
> +#include <cstdlib>
> +
> #include "config.h"
> #include "system.h"
> #include "coretypes.h"
[snip]
> @@ -1791,65 +1798,124 @@
> }
> }
>
> -enum rtx_code
> -prepare_cbranch_operands (rtx *operands, enum machine_mode mode,
> - enum rtx_code comparison)
> +// Implement the CANONICALIZE_COMPARISON macro for the combine pass.
> +// This function is also re-used to canonicalize comparisons in cbranch
> +// pattern expanders.
> +void
> +sh_canonicalize_comparison (enum rtx_code& cmp, rtx& op0, rtx& op1,
> + enum machine_mode mode)
> {
> - rtx op1;
> - rtx scratch = NULL_RTX;
> + // When invoked from within the combine pass the mode is not specified,
> + // so try to get it from one of the operands.
> + if (mode == VOIDmode)
> + mode = GET_MODE (op0);
I'm not sure that the mixture of C and C++ style long comments
in one .c file is OK with the current gcc coding style. Could
you point me to a reference for that?
Regards,
kaz