diff mbox

[bfin] Avoid genrecog warning

Message ID 87eh686edu.fsf@talisman.default
State New
Headers show

Commit Message

Richard Sandiford Nov. 22, 2013, 8:15 a.m. UTC
I have a patch to upgrade most genrecog warnings into errors.  This patch
fixes one for bfin about {push,pop}_multiple_operation not being defined
at the .md level.

Tested by building bfin-elf with the warnings turned to errors, and by
comparing the before and after assembly output at -O2 for gcc.c-torture,
gcc.dg and g++.dg.  OK to install?

Thanks,
Richard


gcc/
	* config/bfin/bfin-protos.h (push_multiple_operation): Delete.
	(pop_multiple_operation): Delete.
	(push_multiple_operation_p, pop_multiple_operation_p): Declare.
	* config/bfin/bfin.c (push_multiple_operation): Rename to...
	(push_multiple_operation_p): ...this and remove mode argument.
	(pop_multiple_operation): Rename to...
	(pop_multiple_operation_p): ...this and remove mode argument.
	* config/bfin/predicates.md (push_multiple_operation): Define.
	(pop_multiple_operation): Likewise.

Comments

Bernd Schmidt Nov. 22, 2013, 10:32 a.m. UTC | #1
On 11/22/2013 09:15 AM, Richard Sandiford wrote:
> I have a patch to upgrade most genrecog warnings into errors.  This patch
> fixes one for bfin about {push,pop}_multiple_operation not being defined
> at the .md level.
> 
> Tested by building bfin-elf with the warnings turned to errors, and by
> comparing the before and after assembly output at -O2 for gcc.c-torture,
> gcc.dg and g++.dg.  OK to install?

> +extern int push_multiple_operation_p (rtx);
> +extern int pop_multiple_operation_p (rtx);

I was once told that functions with side effects shouldn't be called _p,
and these ones set up some global variables. But you can check it in
either this way or with a different name.


Bernd
Richard Sandiford Nov. 22, 2013, 11:50 a.m. UTC | #2
Bernd Schmidt <bernds@codesourcery.com> writes:
> On 11/22/2013 09:15 AM, Richard Sandiford wrote:
>> I have a patch to upgrade most genrecog warnings into errors.  This patch
>> fixes one for bfin about {push,pop}_multiple_operation not being defined
>> at the .md level.
>> 
>> Tested by building bfin-elf with the warnings turned to errors, and by
>> comparing the before and after assembly output at -O2 for gcc.c-torture,
>> gcc.dg and g++.dg.  OK to install?
>
>> +extern int push_multiple_operation_p (rtx);
>> +extern int pop_multiple_operation_p (rtx);
>
> I was once told that functions with side effects shouldn't be called _p,
> and these ones set up some global variables. But you can check it in
> either this way or with a different name.

Thanks.  How about analyze_*_multiple_operation?

Richard
Bernd Schmidt Nov. 22, 2013, 11:52 a.m. UTC | #3
On 11/22/2013 12:50 PM, Richard Sandiford wrote:
> Bernd Schmidt <bernds@codesourcery.com> writes:
>> On 11/22/2013 09:15 AM, Richard Sandiford wrote:
>>> +extern int push_multiple_operation_p (rtx);
>>> +extern int pop_multiple_operation_p (rtx);
>>
>> I was once told that functions with side effects shouldn't be called _p,
>> and these ones set up some global variables. But you can check it in
>> either this way or with a different name.
> 
> Thanks.  How about analyze_*_multiple_operation?

Sounds fine.


Bernd
diff mbox

Patch

Index: gcc/config/bfin/bfin-protos.h
===================================================================
--- gcc/config/bfin/bfin-protos.h	2013-11-16 21:52:15.083787117 +0000
+++ gcc/config/bfin/bfin-protos.h	2013-11-16 21:58:55.616017138 +0000
@@ -105,8 +105,8 @@  extern rtx bfin_va_arg (tree, tree);
 
 extern void bfin_expand_prologue (void);
 extern void bfin_expand_epilogue (int, int, bool);
-extern int push_multiple_operation (rtx, enum machine_mode);
-extern int pop_multiple_operation (rtx, enum machine_mode);
+extern int push_multiple_operation_p (rtx);
+extern int pop_multiple_operation_p (rtx);
 extern void output_push_multiple (rtx, rtx *);
 extern void output_pop_multiple (rtx, rtx *);
 extern int bfin_hard_regno_rename_ok (unsigned int, unsigned int);
Index: gcc/config/bfin/bfin.c
===================================================================
--- gcc/config/bfin/bfin.c	2013-11-16 21:52:15.083787117 +0000
+++ gcc/config/bfin/bfin.c	2013-11-16 21:58:55.616017138 +0000
@@ -2990,7 +2990,7 @@  bfin_rtx_costs (rtx x, int code_i, int o
 static int n_regs_to_save;
 
 int
-push_multiple_operation (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
+push_multiple_operation_p (rtx op)
 {
   int lastdreg = 8, lastpreg = 6;
   int i, group;
@@ -3061,7 +3061,7 @@  push_multiple_operation (rtx op, enum ma
 }
 
 int
-pop_multiple_operation (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
+pop_multiple_operation_p (rtx op)
 {
   int lastdreg = 8, lastpreg = 6;
   int i, group;
@@ -3130,7 +3130,7 @@  output_push_multiple (rtx insn, rtx *ope
   int ok;
   
   /* Validate the insn again, and compute first_[dp]reg_to_save. */
-  ok = push_multiple_operation (PATTERN (insn), VOIDmode);
+  ok = push_multiple_operation_p (PATTERN (insn));
   gcc_assert (ok);
   
   if (first_dreg_to_save == 8)
@@ -3154,7 +3154,7 @@  output_pop_multiple (rtx insn, rtx *oper
   int ok;
   
   /* Validate the insn again, and compute first_[dp]reg_to_save. */
-  ok = pop_multiple_operation (PATTERN (insn), VOIDmode);
+  ok = pop_multiple_operation_p (PATTERN (insn));
   gcc_assert (ok);
 
   if (first_dreg_to_save == 8)
@@ -4134,8 +4134,8 @@  workaround_rts_anomaly (void)
 
 	  if (GET_CODE (pat) == PARALLEL)
 	    {
-	      if (push_multiple_operation (pat, VOIDmode)
-		  || pop_multiple_operation (pat, VOIDmode))
+	      if (push_multiple_operation_p (pat)
+		  || pop_multiple_operation_p (pat))
 		this_cycles = n_regs_to_save;
 	    }
 	  else
Index: gcc/config/bfin/predicates.md
===================================================================
--- gcc/config/bfin/predicates.md	2013-11-16 21:52:15.083787117 +0000
+++ gcc/config/bfin/predicates.md	2013-11-16 21:58:55.617017146 +0000
@@ -239,3 +239,11 @@  (define_predicate "mem_i_address_operand
   gcc_assert (REG_P (op));
   return IREG_P (op);
 })
+
+(define_predicate "push_multiple_operation"
+  (and (match_code "parallel")
+       (match_test "push_multiple_operation_p (op)")))
+
+(define_predicate "pop_multiple_operation"
+  (and (match_code "parallel")
+       (match_test "pop_multiple_operation_p (op)")))