This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [SH] PR 51244 - Add CANONICALIZE_COMPARISON macro


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]