[SH] PR 51244 - Add CANONICALIZE_COMPARISON macro

Oleg Endo oleg.endo@t-online.de
Mon Sep 3 09:42:00 GMT 2012


On 3 Sep 2012, at 11:18, Kaz Kojima <kkojima@rr.iij4u.or.jp> wrote:

> 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?

Sorry, I can't.  At least The C++ conventions wiki page doesn't  
mention this.  Maybe somebody else can comment on this, please?

In any case, I have no problem with changing the multi line comments  
to /* ... */.  Just let me know.

Cheers,
Oleg



More information about the Gcc-patches mailing list