[02/12] remove some ifdef HAVE_cc0
diff mbox

Message ID 1429622658-9034-3-git-send-email-tbsaunde+gcc@tbsaunde.org
State New
Headers show

Commit Message

tbsaunde+gcc@tbsaunde.org April 21, 2015, 1:24 p.m. UTC
From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

gcc/ChangeLog:

2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* conditions.h: Define macros even if HAVE_cc0 is undefined.
	* emit-rtl.c: Define functions even if HAVE_cc0 is undefined.
	* final.c: Likewise.
	* jump.c: Likewise.
	* recog.c: Likewise.
	* recog.h: Declare functions even when HAVE_cc0 is undefined.
	* sched-deps.c (sched_analyze_2): Always compile case for cc0.
---
 gcc/conditions.h | 6 ------
 gcc/emit-rtl.c   | 2 --
 gcc/final.c      | 2 --
 gcc/jump.c       | 3 ---
 gcc/recog.c      | 2 --
 gcc/recog.h      | 2 --
 gcc/sched-deps.c | 5 +++--
 7 files changed, 3 insertions(+), 19 deletions(-)

Comments

Jeff Law April 21, 2015, 1:47 p.m. UTC | #1
On 04/21/2015 07:24 AM, tbsaunde+gcc@tbsaunde.org wrote:
> From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
>
> gcc/ChangeLog:
>
> 2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
>
> 	* conditions.h: Define macros even if HAVE_cc0 is undefined.
> 	* emit-rtl.c: Define functions even if HAVE_cc0 is undefined.
> 	* final.c: Likewise.
> 	* jump.c: Likewise.
> 	* recog.c: Likewise.
> 	* recog.h: Declare functions even when HAVE_cc0 is undefined.
> 	* sched-deps.c (sched_analyze_2): Always compile case for cc0.
OK.  Note for anyone else reading at home, some of the functions being 
unconditionally compiled now already had unconditional prototypes in the 
header files. So not everything needed a .h file change.

jeff
Richard Biener April 21, 2015, 2:14 p.m. UTC | #2
On Tue, Apr 21, 2015 at 3:24 PM,  <tbsaunde+gcc@tbsaunde.org> wrote:
> From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
>
> gcc/ChangeLog:
>
> 2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
>
>         * conditions.h: Define macros even if HAVE_cc0 is undefined.
>         * emit-rtl.c: Define functions even if HAVE_cc0 is undefined.
>         * final.c: Likewise.
>         * jump.c: Likewise.
>         * recog.c: Likewise.
>         * recog.h: Declare functions even when HAVE_cc0 is undefined.
>         * sched-deps.c (sched_analyze_2): Always compile case for cc0.
> ---
>  gcc/conditions.h | 6 ------
>  gcc/emit-rtl.c   | 2 --
>  gcc/final.c      | 2 --
>  gcc/jump.c       | 3 ---
>  gcc/recog.c      | 2 --
>  gcc/recog.h      | 2 --
>  gcc/sched-deps.c | 5 +++--
>  7 files changed, 3 insertions(+), 19 deletions(-)
>
> diff --git a/gcc/conditions.h b/gcc/conditions.h
> index 2308bfc..7cd1e1c 100644
> --- a/gcc/conditions.h
> +++ b/gcc/conditions.h
> @@ -20,10 +20,6 @@ along with GCC; see the file COPYING3.  If not see
>  #ifndef GCC_CONDITIONS_H
>  #define GCC_CONDITIONS_H
>
> -/* None of the things in the files exist if we don't use CC0.  */
> -
> -#ifdef HAVE_cc0
> -
>  /* The variable cc_status says how to interpret the condition code.
>     It is set by output routines for an instruction that sets the cc's
>     and examined by output routines for jump instructions.
> @@ -117,6 +113,4 @@ extern CC_STATUS cc_status;
>   (cc_status.flags = 0, cc_status.value1 = 0, cc_status.value2 = 0,  \
>    CC_STATUS_MDEP_INIT)
>
> -#endif
> -
>  #endif /* GCC_CONDITIONS_H */
> diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
> index 483eacb..c1974bb 100644
> --- a/gcc/emit-rtl.c
> +++ b/gcc/emit-rtl.c
> @@ -3541,7 +3541,6 @@ prev_active_insn (rtx uncast_insn)
>    return insn;
>  }
>
> -#ifdef HAVE_cc0
>  /* Return the next insn that uses CC0 after INSN, which is assumed to
>     set it.  This is the inverse of prev_cc0_setter (i.e., prev_cc0_setter
>     applied to the result of this function should yield INSN).
> @@ -3589,7 +3588,6 @@ prev_cc0_setter (rtx uncast_insn)
>
>    return insn;
>  }
> -#endif
>
>  #ifdef AUTO_INC_DEC
>  /* Find a RTX_AUTOINC class rtx which matches DATA.  */
> diff --git a/gcc/final.c b/gcc/final.c
> index 1fa93d9..41f6bd9 100644
> --- a/gcc/final.c
> +++ b/gcc/final.c
> @@ -191,7 +191,6 @@ static rtx last_ignored_compare = 0;
>
>  static int insn_counter = 0;
>
> -#ifdef HAVE_cc0
>  /* This variable contains machine-dependent flags (defined in tm.h)
>     set and examined by output routines
>     that describe how to interpret the condition codes properly.  */
> @@ -202,7 +201,6 @@ CC_STATUS cc_status;
>     from before the insn.  */
>
>  CC_STATUS cc_prev_status;
> -#endif
>
>  /* Number of unmatched NOTE_INSN_BLOCK_BEG notes we have seen.  */
>
> diff --git a/gcc/jump.c b/gcc/jump.c
> index 34b3b7b..bc91550 100644
> --- a/gcc/jump.c
> +++ b/gcc/jump.c
> @@ -1044,8 +1044,6 @@ jump_to_label_p (const rtx_insn *insn)
>           && JUMP_LABEL (insn) != NULL && !ANY_RETURN_P (JUMP_LABEL (insn)));
>  }
>
> -#ifdef HAVE_cc0
> -
>  /* Return nonzero if X is an RTX that only sets the condition codes
>     and has no side effects.  */
>
> @@ -1094,7 +1092,6 @@ sets_cc0_p (const_rtx x)
>      }
>    return 0;
>  }
> -#endif
>
>  /* Find all CODE_LABELs referred to in X, and increment their use
>     counts.  If INSN is a JUMP_INSN and there is at least one
> diff --git a/gcc/recog.c b/gcc/recog.c
> index a9d3b1f..c3ad86f 100644
> --- a/gcc/recog.c
> +++ b/gcc/recog.c
> @@ -971,7 +971,6 @@ validate_simplify_insn (rtx insn)
>    return ((num_changes_pending () > 0) && (apply_change_group () > 0));
>  }
>
> -#ifdef HAVE_cc0
>  /* Return 1 if the insn using CC0 set by INSN does not contain
>     any ordered tests applied to the condition codes.
>     EQ and NE tests do not count.  */
> @@ -988,7 +987,6 @@ next_insn_tests_no_inequality (rtx insn)
>    return (INSN_P (next)
>           && ! inequality_comparisons_p (PATTERN (next)));
>  }
> -#endif
>
>  /* Return 1 if OP is a valid general operand for machine mode MODE.
>     This is either a register reference, a memory reference,
> diff --git a/gcc/recog.h b/gcc/recog.h
> index 45ea671..8a38b26 100644
> --- a/gcc/recog.h
> +++ b/gcc/recog.h
> @@ -112,9 +112,7 @@ extern void validate_replace_rtx_group (rtx, rtx, rtx);
>  extern void validate_replace_src_group (rtx, rtx, rtx);
>  extern bool validate_simplify_insn (rtx insn);
>  extern int num_changes_pending (void);
> -#ifdef HAVE_cc0
>  extern int next_insn_tests_no_inequality (rtx);
> -#endif
>  extern bool reg_fits_class_p (const_rtx, reg_class_t, int, machine_mode);
>
>  extern int offsettable_memref_p (rtx);
> diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c
> index 5434831..31de6be 100644
> --- a/gcc/sched-deps.c
> +++ b/gcc/sched-deps.c
> @@ -2608,8 +2608,10 @@ sched_analyze_2 (struct deps_desc *deps, rtx x, rtx_insn *insn)
>
>        return;
>
> -#ifdef HAVE_cc0
>      case CC0:
> +#ifdef HAVE_cc0

#ifndef ?

> +      gcc_unreachable ();
> +#endif
>        /* User of CC0 depends on immediately preceding insn.  */
>        SCHED_GROUP_P (insn) = 1;
>         /* Don't move CC0 setter to another block (it can set up the
> @@ -2620,7 +2622,6 @@ sched_analyze_2 (struct deps_desc *deps, rtx x, rtx_insn *insn)
>         sched_deps_info->finish_rhs ();
>
>        return;
> -#endif
>
>      case REG:
>        {
> --
> 2.3.0.80.g18d0fec.dirty
>
Trevor Saunders April 21, 2015, 3:24 p.m. UTC | #3
On Tue, Apr 21, 2015 at 04:14:01PM +0200, Richard Biener wrote:
> On Tue, Apr 21, 2015 at 3:24 PM,  <tbsaunde+gcc@tbsaunde.org> wrote:
> > From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
> >
> > gcc/ChangeLog:
> >
> > 2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
> >
> >         * conditions.h: Define macros even if HAVE_cc0 is undefined.
> >         * emit-rtl.c: Define functions even if HAVE_cc0 is undefined.
> >         * final.c: Likewise.
> >         * jump.c: Likewise.
> >         * recog.c: Likewise.
> >         * recog.h: Declare functions even when HAVE_cc0 is undefined.
> >         * sched-deps.c (sched_analyze_2): Always compile case for cc0.
> > ---
> >  gcc/conditions.h | 6 ------
> >  gcc/emit-rtl.c   | 2 --
> >  gcc/final.c      | 2 --
> >  gcc/jump.c       | 3 ---
> >  gcc/recog.c      | 2 --
> >  gcc/recog.h      | 2 --
> >  gcc/sched-deps.c | 5 +++--
> >  7 files changed, 3 insertions(+), 19 deletions(-)
> >
> > diff --git a/gcc/conditions.h b/gcc/conditions.h
> > index 2308bfc..7cd1e1c 100644
> > --- a/gcc/conditions.h
> > +++ b/gcc/conditions.h
> > @@ -20,10 +20,6 @@ along with GCC; see the file COPYING3.  If not see
> >  #ifndef GCC_CONDITIONS_H
> >  #define GCC_CONDITIONS_H
> >
> > -/* None of the things in the files exist if we don't use CC0.  */
> > -
> > -#ifdef HAVE_cc0
> > -
> >  /* The variable cc_status says how to interpret the condition code.
> >     It is set by output routines for an instruction that sets the cc's
> >     and examined by output routines for jump instructions.
> > @@ -117,6 +113,4 @@ extern CC_STATUS cc_status;
> >   (cc_status.flags = 0, cc_status.value1 = 0, cc_status.value2 = 0,  \
> >    CC_STATUS_MDEP_INIT)
> >
> > -#endif
> > -
> >  #endif /* GCC_CONDITIONS_H */
> > diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
> > index 483eacb..c1974bb 100644
> > --- a/gcc/emit-rtl.c
> > +++ b/gcc/emit-rtl.c
> > @@ -3541,7 +3541,6 @@ prev_active_insn (rtx uncast_insn)
> >    return insn;
> >  }
> >
> > -#ifdef HAVE_cc0
> >  /* Return the next insn that uses CC0 after INSN, which is assumed to
> >     set it.  This is the inverse of prev_cc0_setter (i.e., prev_cc0_setter
> >     applied to the result of this function should yield INSN).
> > @@ -3589,7 +3588,6 @@ prev_cc0_setter (rtx uncast_insn)
> >
> >    return insn;
> >  }
> > -#endif
> >
> >  #ifdef AUTO_INC_DEC
> >  /* Find a RTX_AUTOINC class rtx which matches DATA.  */
> > diff --git a/gcc/final.c b/gcc/final.c
> > index 1fa93d9..41f6bd9 100644
> > --- a/gcc/final.c
> > +++ b/gcc/final.c
> > @@ -191,7 +191,6 @@ static rtx last_ignored_compare = 0;
> >
> >  static int insn_counter = 0;
> >
> > -#ifdef HAVE_cc0
> >  /* This variable contains machine-dependent flags (defined in tm.h)
> >     set and examined by output routines
> >     that describe how to interpret the condition codes properly.  */
> > @@ -202,7 +201,6 @@ CC_STATUS cc_status;
> >     from before the insn.  */
> >
> >  CC_STATUS cc_prev_status;
> > -#endif
> >
> >  /* Number of unmatched NOTE_INSN_BLOCK_BEG notes we have seen.  */
> >
> > diff --git a/gcc/jump.c b/gcc/jump.c
> > index 34b3b7b..bc91550 100644
> > --- a/gcc/jump.c
> > +++ b/gcc/jump.c
> > @@ -1044,8 +1044,6 @@ jump_to_label_p (const rtx_insn *insn)
> >           && JUMP_LABEL (insn) != NULL && !ANY_RETURN_P (JUMP_LABEL (insn)));
> >  }
> >
> > -#ifdef HAVE_cc0
> > -
> >  /* Return nonzero if X is an RTX that only sets the condition codes
> >     and has no side effects.  */
> >
> > @@ -1094,7 +1092,6 @@ sets_cc0_p (const_rtx x)
> >      }
> >    return 0;
> >  }
> > -#endif
> >
> >  /* Find all CODE_LABELs referred to in X, and increment their use
> >     counts.  If INSN is a JUMP_INSN and there is at least one
> > diff --git a/gcc/recog.c b/gcc/recog.c
> > index a9d3b1f..c3ad86f 100644
> > --- a/gcc/recog.c
> > +++ b/gcc/recog.c
> > @@ -971,7 +971,6 @@ validate_simplify_insn (rtx insn)
> >    return ((num_changes_pending () > 0) && (apply_change_group () > 0));
> >  }
> >
> > -#ifdef HAVE_cc0
> >  /* Return 1 if the insn using CC0 set by INSN does not contain
> >     any ordered tests applied to the condition codes.
> >     EQ and NE tests do not count.  */
> > @@ -988,7 +987,6 @@ next_insn_tests_no_inequality (rtx insn)
> >    return (INSN_P (next)
> >           && ! inequality_comparisons_p (PATTERN (next)));
> >  }
> > -#endif
> >
> >  /* Return 1 if OP is a valid general operand for machine mode MODE.
> >     This is either a register reference, a memory reference,
> > diff --git a/gcc/recog.h b/gcc/recog.h
> > index 45ea671..8a38b26 100644
> > --- a/gcc/recog.h
> > +++ b/gcc/recog.h
> > @@ -112,9 +112,7 @@ extern void validate_replace_rtx_group (rtx, rtx, rtx);
> >  extern void validate_replace_src_group (rtx, rtx, rtx);
> >  extern bool validate_simplify_insn (rtx insn);
> >  extern int num_changes_pending (void);
> > -#ifdef HAVE_cc0
> >  extern int next_insn_tests_no_inequality (rtx);
> > -#endif
> >  extern bool reg_fits_class_p (const_rtx, reg_class_t, int, machine_mode);
> >
> >  extern int offsettable_memref_p (rtx);
> > diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c
> > index 5434831..31de6be 100644
> > --- a/gcc/sched-deps.c
> > +++ b/gcc/sched-deps.c
> > @@ -2608,8 +2608,10 @@ sched_analyze_2 (struct deps_desc *deps, rtx x, rtx_insn *insn)
> >
> >        return;
> >
> > -#ifdef HAVE_cc0
> >      case CC0:
> > +#ifdef HAVE_cc0
> 
> #ifndef ?

yeah, good catch thanks!

Trev

> 
> > +      gcc_unreachable ();
> > +#endif
> >        /* User of CC0 depends on immediately preceding insn.  */
> >        SCHED_GROUP_P (insn) = 1;
> >         /* Don't move CC0 setter to another block (it can set up the
> > @@ -2620,7 +2622,6 @@ sched_analyze_2 (struct deps_desc *deps, rtx x, rtx_insn *insn)
> >         sched_deps_info->finish_rhs ();
> >
> >        return;
> > -#endif
> >
> >      case REG:
> >        {
> > --
> > 2.3.0.80.g18d0fec.dirty
> >
James Greenhalgh April 23, 2015, 3:27 a.m. UTC | #4
On Tue, Apr 21, 2015 at 04:24:44PM +0100, Trevor Saunders wrote:
> On Tue, Apr 21, 2015 at 04:14:01PM +0200, Richard Biener wrote:
> > On Tue, Apr 21, 2015 at 3:24 PM,  <tbsaunde+gcc@tbsaunde.org> wrote:
> > > From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
> > >
> > > gcc/ChangeLog:
> > >
> > > 2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
> > >
> > >         * conditions.h: Define macros even if HAVE_cc0 is undefined.
> > >         * emit-rtl.c: Define functions even if HAVE_cc0 is undefined.
> > >         * final.c: Likewise.
> > >         * jump.c: Likewise.
> > >         * recog.c: Likewise.
> > >         * recog.h: Declare functions even when HAVE_cc0 is undefined.
> > >         * sched-deps.c (sched_analyze_2): Always compile case for cc0.

If I've counted right after the git bisect, this patch seems to break
the ARM buildi (arm-none-linux-gnueabihf):

  In file included from insn-output.c:40:0:
  ..../gcc-src/gcc/conditions.h:112:0: error: "CC_STATUS_INIT" redefined [-Werror]
   #define CC_STATUS_INIT  \
   ^
  In file included from tm.h:35:0,
                   from insn-output.c:7:
  ..../gcc-src/gcc/config/arm/arm.h:2159:0: note: this is the location of the previous definition
   #define CC_STATUS_INIT \
   ^

I guess the conditions.h definition wants wrapping in #ifndef - though a
quick grep suggests that ARM is the only target defining CC_STATUS_INIT
so lets CC the ARM maintainers and see what their preference is...

Thanks,
James
Trevor Saunders April 23, 2015, 4:54 a.m. UTC | #5
On Thu, Apr 23, 2015 at 04:27:59AM +0100, James Greenhalgh wrote:
> On Tue, Apr 21, 2015 at 04:24:44PM +0100, Trevor Saunders wrote:
> > On Tue, Apr 21, 2015 at 04:14:01PM +0200, Richard Biener wrote:
> > > On Tue, Apr 21, 2015 at 3:24 PM,  <tbsaunde+gcc@tbsaunde.org> wrote:
> > > > From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
> > > >
> > > > gcc/ChangeLog:
> > > >
> > > > 2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
> > > >
> > > >         * conditions.h: Define macros even if HAVE_cc0 is undefined.
> > > >         * emit-rtl.c: Define functions even if HAVE_cc0 is undefined.
> > > >         * final.c: Likewise.
> > > >         * jump.c: Likewise.
> > > >         * recog.c: Likewise.
> > > >         * recog.h: Declare functions even when HAVE_cc0 is undefined.
> > > >         * sched-deps.c (sched_analyze_2): Always compile case for cc0.
> 
> If I've counted right after the git bisect, this patch seems to break
> the ARM buildi (arm-none-linux-gnueabihf):
> 
>   In file included from insn-output.c:40:0:
>   ..../gcc-src/gcc/conditions.h:112:0: error: "CC_STATUS_INIT" redefined [-Werror]
>    #define CC_STATUS_INIT  \
>    ^
>   In file included from tm.h:35:0,
>                    from insn-output.c:7:
>   ..../gcc-src/gcc/config/arm/arm.h:2159:0: note: this is the location of the previous definition
>    #define CC_STATUS_INIT \
>    ^
> 
> I guess the conditions.h definition wants wrapping in #ifndef - though a
> quick grep suggests that ARM is the only target defining CC_STATUS_INIT
> so lets CC the ARM maintainers and see what their preference is...

Well, that seems pretty weird, but it looks intentional arm does this
see http://gcc.gnu.org/ml/gcc-patches/2010-07/msg00437.html

Of course I now see final.c also defines a fall back, so maybe the right
thing to do is wrap the conditions.h definition in #if HAVE_cc0, or
maybe the final.c definition can go away? Right now I'm to tired to make
a good decision about that.

sorry about the bustage!

Trev

 
> 
> Thanks,
> James
Richard Biener April 23, 2015, 8:35 a.m. UTC | #6
On Thu, Apr 23, 2015 at 6:54 AM, Trevor Saunders <tbsaunde@tbsaunde.org> wrote:
> On Thu, Apr 23, 2015 at 04:27:59AM +0100, James Greenhalgh wrote:
>> On Tue, Apr 21, 2015 at 04:24:44PM +0100, Trevor Saunders wrote:
>> > On Tue, Apr 21, 2015 at 04:14:01PM +0200, Richard Biener wrote:
>> > > On Tue, Apr 21, 2015 at 3:24 PM,  <tbsaunde+gcc@tbsaunde.org> wrote:
>> > > > From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
>> > > >
>> > > > gcc/ChangeLog:
>> > > >
>> > > > 2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
>> > > >
>> > > >         * conditions.h: Define macros even if HAVE_cc0 is undefined.
>> > > >         * emit-rtl.c: Define functions even if HAVE_cc0 is undefined.
>> > > >         * final.c: Likewise.
>> > > >         * jump.c: Likewise.
>> > > >         * recog.c: Likewise.
>> > > >         * recog.h: Declare functions even when HAVE_cc0 is undefined.
>> > > >         * sched-deps.c (sched_analyze_2): Always compile case for cc0.
>>
>> If I've counted right after the git bisect, this patch seems to break
>> the ARM buildi (arm-none-linux-gnueabihf):
>>
>>   In file included from insn-output.c:40:0:
>>   ..../gcc-src/gcc/conditions.h:112:0: error: "CC_STATUS_INIT" redefined [-Werror]
>>    #define CC_STATUS_INIT  \
>>    ^
>>   In file included from tm.h:35:0,
>>                    from insn-output.c:7:
>>   ..../gcc-src/gcc/config/arm/arm.h:2159:0: note: this is the location of the previous definition
>>    #define CC_STATUS_INIT \
>>    ^
>>
>> I guess the conditions.h definition wants wrapping in #ifndef - though a
>> quick grep suggests that ARM is the only target defining CC_STATUS_INIT
>> so lets CC the ARM maintainers and see what their preference is...
>
> Well, that seems pretty weird, but it looks intentional arm does this
> see http://gcc.gnu.org/ml/gcc-patches/2010-07/msg00437.html
>
> Of course I now see final.c also defines a fall back, so maybe the right
> thing to do is wrap the conditions.h definition in #if HAVE_cc0, or
> maybe the final.c definition can go away? Right now I'm to tired to make
> a good decision about that.
>
> sorry about the bustage!

Looks like the best thing is to turn this into a target hook then?  Or move the
fallback/default to defaults.h

Richard.

> Trev
>
>
>>
>> Thanks,
>> James
Kyrylo Tkachov April 23, 2015, 8:41 a.m. UTC | #7
On 23/04/15 09:35, Richard Biener wrote:
> On Thu, Apr 23, 2015 at 6:54 AM, Trevor Saunders <tbsaunde@tbsaunde.org> wrote:
>> On Thu, Apr 23, 2015 at 04:27:59AM +0100, James Greenhalgh wrote:
>>> On Tue, Apr 21, 2015 at 04:24:44PM +0100, Trevor Saunders wrote:
>>>> On Tue, Apr 21, 2015 at 04:14:01PM +0200, Richard Biener wrote:
>>>>> On Tue, Apr 21, 2015 at 3:24 PM,  <tbsaunde+gcc@tbsaunde.org> wrote:
>>>>>> From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
>>>>>>
>>>>>> gcc/ChangeLog:
>>>>>>
>>>>>> 2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
>>>>>>
>>>>>>          * conditions.h: Define macros even if HAVE_cc0 is undefined.
>>>>>>          * emit-rtl.c: Define functions even if HAVE_cc0 is undefined.
>>>>>>          * final.c: Likewise.
>>>>>>          * jump.c: Likewise.
>>>>>>          * recog.c: Likewise.
>>>>>>          * recog.h: Declare functions even when HAVE_cc0 is undefined.
>>>>>>          * sched-deps.c (sched_analyze_2): Always compile case for cc0.
>>> If I've counted right after the git bisect, this patch seems to break
>>> the ARM buildi (arm-none-linux-gnueabihf):
>>>
>>>    In file included from insn-output.c:40:0:
>>>    ..../gcc-src/gcc/conditions.h:112:0: error: "CC_STATUS_INIT" redefined [-Werror]
>>>     #define CC_STATUS_INIT  \

This is a warning-to-error from -Werror, so this came out during bootstrap
rather than a cross-build, right?


>>>     ^
>>>    In file included from tm.h:35:0,
>>>                     from insn-output.c:7:
>>>    ..../gcc-src/gcc/config/arm/arm.h:2159:0: note: this is the location of the previous definition
>>>     #define CC_STATUS_INIT \
>>>     ^
>>>
>>> I guess the conditions.h definition wants wrapping in #ifndef - though a
>>> quick grep suggests that ARM is the only target defining CC_STATUS_INIT
>>> so lets CC the ARM maintainers and see what their preference is...
>> Well, that seems pretty weird, but it looks intentional arm does this
>> see http://gcc.gnu.org/ml/gcc-patches/2010-07/msg00437.html
>>
>> Of course I now see final.c also defines a fall back, so maybe the right
>> thing to do is wrap the conditions.h definition in #if HAVE_cc0, or
>> maybe the final.c definition can go away? Right now I'm to tired to make
>> a good decision about that.
>>
>> sorry about the bustage!
> Looks like the best thing is to turn this into a target hook then?  Or move the
> fallback/default to defaults.h

Shall we revert this patch for now then to restore bootstrap?

Kyrill

>
> Richard.
>
>> Trev
>>
>>
>>> Thanks,
>>> James
Richard Earnshaw April 23, 2015, 9:08 a.m. UTC | #8
On 23/04/15 09:41, Kyrill Tkachov wrote:
> 
> On 23/04/15 09:35, Richard Biener wrote:
>> On Thu, Apr 23, 2015 at 6:54 AM, Trevor Saunders <tbsaunde@tbsaunde.org> wrote:
>>> On Thu, Apr 23, 2015 at 04:27:59AM +0100, James Greenhalgh wrote:
>>>> On Tue, Apr 21, 2015 at 04:24:44PM +0100, Trevor Saunders wrote:
>>>>> On Tue, Apr 21, 2015 at 04:14:01PM +0200, Richard Biener wrote:
>>>>>> On Tue, Apr 21, 2015 at 3:24 PM,  <tbsaunde+gcc@tbsaunde.org> wrote:
>>>>>>> From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
>>>>>>>
>>>>>>> gcc/ChangeLog:
>>>>>>>
>>>>>>> 2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
>>>>>>>
>>>>>>>          * conditions.h: Define macros even if HAVE_cc0 is undefined.
>>>>>>>          * emit-rtl.c: Define functions even if HAVE_cc0 is undefined.
>>>>>>>          * final.c: Likewise.
>>>>>>>          * jump.c: Likewise.
>>>>>>>          * recog.c: Likewise.
>>>>>>>          * recog.h: Declare functions even when HAVE_cc0 is undefined.
>>>>>>>          * sched-deps.c (sched_analyze_2): Always compile case for cc0.
>>>> If I've counted right after the git bisect, this patch seems to break
>>>> the ARM buildi (arm-none-linux-gnueabihf):
>>>>
>>>>    In file included from insn-output.c:40:0:
>>>>    ..../gcc-src/gcc/conditions.h:112:0: error: "CC_STATUS_INIT" redefined [-Werror]
>>>>     #define CC_STATUS_INIT  \
> 
> This is a warning-to-error from -Werror, so this came out during bootstrap
> rather than a cross-build, right?
> 
> 
>>>>     ^
>>>>    In file included from tm.h:35:0,
>>>>                     from insn-output.c:7:
>>>>    ..../gcc-src/gcc/config/arm/arm.h:2159:0: note: this is the location of the previous definition
>>>>     #define CC_STATUS_INIT \
>>>>     ^
>>>>
>>>> I guess the conditions.h definition wants wrapping in #ifndef - though a
>>>> quick grep suggests that ARM is the only target defining CC_STATUS_INIT
>>>> so lets CC the ARM maintainers and see what their preference is...
>>> Well, that seems pretty weird, but it looks intentional arm does this
>>> see http://gcc.gnu.org/ml/gcc-patches/2010-07/msg00437.html
>>>
>>> Of course I now see final.c also defines a fall back, so maybe the right
>>> thing to do is wrap the conditions.h definition in #if HAVE_cc0, or
>>> maybe the final.c definition can go away? Right now I'm to tired to make
>>> a good decision about that.
>>>
>>> sorry about the bustage!
>> Looks like the best thing is to turn this into a target hook then?  Or move the
>> fallback/default to defaults.h
> 
> Shall we revert this patch for now then to restore bootstrap?
> 

Isn't the most constructive temporary fix to just wrap the definition in
conditions.h with #ifndef CC_STATUS_INIT?

R.

> Kyrill
> 
>>
>> Richard.
>>
>>> Trev
>>>
>>>
>>>> Thanks,
>>>> James
>

Patch
diff mbox

diff --git a/gcc/conditions.h b/gcc/conditions.h
index 2308bfc..7cd1e1c 100644
--- a/gcc/conditions.h
+++ b/gcc/conditions.h
@@ -20,10 +20,6 @@  along with GCC; see the file COPYING3.  If not see
 #ifndef GCC_CONDITIONS_H
 #define GCC_CONDITIONS_H
 
-/* None of the things in the files exist if we don't use CC0.  */
-
-#ifdef HAVE_cc0
-
 /* The variable cc_status says how to interpret the condition code.
    It is set by output routines for an instruction that sets the cc's
    and examined by output routines for jump instructions.
@@ -117,6 +113,4 @@  extern CC_STATUS cc_status;
  (cc_status.flags = 0, cc_status.value1 = 0, cc_status.value2 = 0,  \
   CC_STATUS_MDEP_INIT)
 
-#endif
-
 #endif /* GCC_CONDITIONS_H */
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 483eacb..c1974bb 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -3541,7 +3541,6 @@  prev_active_insn (rtx uncast_insn)
   return insn;
 }
 
-#ifdef HAVE_cc0
 /* Return the next insn that uses CC0 after INSN, which is assumed to
    set it.  This is the inverse of prev_cc0_setter (i.e., prev_cc0_setter
    applied to the result of this function should yield INSN).
@@ -3589,7 +3588,6 @@  prev_cc0_setter (rtx uncast_insn)
 
   return insn;
 }
-#endif
 
 #ifdef AUTO_INC_DEC
 /* Find a RTX_AUTOINC class rtx which matches DATA.  */
diff --git a/gcc/final.c b/gcc/final.c
index 1fa93d9..41f6bd9 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -191,7 +191,6 @@  static rtx last_ignored_compare = 0;
 
 static int insn_counter = 0;
 
-#ifdef HAVE_cc0
 /* This variable contains machine-dependent flags (defined in tm.h)
    set and examined by output routines
    that describe how to interpret the condition codes properly.  */
@@ -202,7 +201,6 @@  CC_STATUS cc_status;
    from before the insn.  */
 
 CC_STATUS cc_prev_status;
-#endif
 
 /* Number of unmatched NOTE_INSN_BLOCK_BEG notes we have seen.  */
 
diff --git a/gcc/jump.c b/gcc/jump.c
index 34b3b7b..bc91550 100644
--- a/gcc/jump.c
+++ b/gcc/jump.c
@@ -1044,8 +1044,6 @@  jump_to_label_p (const rtx_insn *insn)
 	  && JUMP_LABEL (insn) != NULL && !ANY_RETURN_P (JUMP_LABEL (insn)));
 }
 
-#ifdef HAVE_cc0
-
 /* Return nonzero if X is an RTX that only sets the condition codes
    and has no side effects.  */
 
@@ -1094,7 +1092,6 @@  sets_cc0_p (const_rtx x)
     }
   return 0;
 }
-#endif
 
 /* Find all CODE_LABELs referred to in X, and increment their use
    counts.  If INSN is a JUMP_INSN and there is at least one
diff --git a/gcc/recog.c b/gcc/recog.c
index a9d3b1f..c3ad86f 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -971,7 +971,6 @@  validate_simplify_insn (rtx insn)
   return ((num_changes_pending () > 0) && (apply_change_group () > 0));
 }
 
-#ifdef HAVE_cc0
 /* Return 1 if the insn using CC0 set by INSN does not contain
    any ordered tests applied to the condition codes.
    EQ and NE tests do not count.  */
@@ -988,7 +987,6 @@  next_insn_tests_no_inequality (rtx insn)
   return (INSN_P (next)
 	  && ! inequality_comparisons_p (PATTERN (next)));
 }
-#endif
 
 /* Return 1 if OP is a valid general operand for machine mode MODE.
    This is either a register reference, a memory reference,
diff --git a/gcc/recog.h b/gcc/recog.h
index 45ea671..8a38b26 100644
--- a/gcc/recog.h
+++ b/gcc/recog.h
@@ -112,9 +112,7 @@  extern void validate_replace_rtx_group (rtx, rtx, rtx);
 extern void validate_replace_src_group (rtx, rtx, rtx);
 extern bool validate_simplify_insn (rtx insn);
 extern int num_changes_pending (void);
-#ifdef HAVE_cc0
 extern int next_insn_tests_no_inequality (rtx);
-#endif
 extern bool reg_fits_class_p (const_rtx, reg_class_t, int, machine_mode);
 
 extern int offsettable_memref_p (rtx);
diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c
index 5434831..31de6be 100644
--- a/gcc/sched-deps.c
+++ b/gcc/sched-deps.c
@@ -2608,8 +2608,10 @@  sched_analyze_2 (struct deps_desc *deps, rtx x, rtx_insn *insn)
 
       return;
 
-#ifdef HAVE_cc0
     case CC0:
+#ifdef HAVE_cc0
+      gcc_unreachable ();
+#endif
       /* User of CC0 depends on immediately preceding insn.  */
       SCHED_GROUP_P (insn) = 1;
        /* Don't move CC0 setter to another block (it can set up the
@@ -2620,7 +2622,6 @@  sched_analyze_2 (struct deps_desc *deps, rtx x, rtx_insn *insn)
 	sched_deps_info->finish_rhs ();
 
       return;
-#endif
 
     case REG:
       {