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]

Re: Prevent extraneous errors from returnjump_p with rtl checking


Hi Zack,


: > + #if ENABLE_RTL_CHECKING
: > +   if (GET_CODE (insn) != INSN
: > +       && GET_CODE (insn) != JUMP_INSN
: > +       && GET_CODE (insn) != CALL_INSN)
: > +     return 0;
: > + #endif
: 
: Don't you want to do this all the time, not just if RTL checking is on?

Well it is not really necessray all the time, since returnjump_p_1()
can handle being passed a NULL rtx.

: Can RETURN ever appear in an INSN or CALL_INSN?

Yes.  Although this indicates a bug in the code generation.  I
recently added code to emit-rtl.c to check for just this case.

: If not, you should only let JUMP_INSNs through to for_each_rtx.  If
: it can, you should test for RTX class 'i' instead of each code
: individually.

Hmm, that sounds reasonable.  How about this version of the patch
instead ?  Any objections anyone ?

Cheers
	Nick


2000-01-25  Nick Clifton  <nickc@redhat.com>

	* jump.c (returnjump_p): Do not examine insns which do not have
	a pattern (if RTL checking is enabled).

Index: jump.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/jump.c,v
retrieving revision 1.101
diff -p -r1.101 jump.c
*** jump.c	2000/01/24 20:10:01	1.101
--- jump.c	2000/01/26 00:41:48
*************** int
*** 3754,3759 ****
--- 3754,3764 ----
  returnjump_p (insn)
       rtx insn;
  {
+ #if ENABLE_RTL_CHECKING
+   /* PATTERN(insn) will fail for non machine insns if RTL checking is enabled.  */
+   if (GET_RTX_CLASS (insn) != 'i')
+     return 0;
+ #endif
    return for_each_rtx (&PATTERN (insn), returnjump_p_1, NULL);
  }
  



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