On Tue, May 05, 2015 at 06:12:50PM -0700, Mike Stump wrote:
> On Apr 26, 2015, at 10:55 PM, tbsaunde+...@tbsaunde.org wrote:
> > From: Trevor Saunders <tbsaunde+...@tbsaunde.org>
> > 
> > gcc/ChangeLog:
> > 
> > 2015-04-27  Trevor Saunders  <tbsaunde+...@tbsaunde.org>
> > 
> >     * bb-reorder.c (HAVE_return): Don't check if its undefined.
> >     * defaults.h (gen_simple_return): New function.
> >     (gen_simple_return): Likewise.
> >     (HAVE_return): Add default definition to false.
> >     (HAVE_simple_return): Likewise.
> >     * cfgrtl.c (force_nonfallthru_and_redirect): Remove checks if
> >     HAVE_return and HAVE_simple_return are defined.
> >     * function.c (gen_return_pattern): Likewise.
> >     (convert_jumps_to_returns): Likewise.
> >     (thread_prologue_and_epilogue_insns): Likewise.
> >     * reorg.c (find_end_label): Likewise.
> >     (dbr_schedule): Likewise.
> >     * shrink-wrap.c: Likewise.
> >     * shrink-wrap.h: Likewise.
> 
> I’m seeing:
> 
> In file included from ./tm.h:30:0,
>                  from ../../gcc/gcc/c-family/c-semantics.c:24:
> ../../gcc/gcc/defaults.h: In function ‘rtx_def* gen_simple_return()’:
> ../../gcc/gcc/defaults.h:1422:1: error: redefinition of ‘rtx_def* 
> gen_simple_return()’
>  gen_simple_return ()
>  ^
> In file included from ./tm.h:22:0,
>                  from ../../gcc/gcc/c-family/c-semantics.c:24:
> ./insn-flags.h:1744:1: error: ‘rtx_def* gen_simple_return()’ previously 
> defined here
>  gen_simple_return(void)
>  ^
> 
> in my port.
> 
> I have a simple_return and a return that is “0” enabled.
> 
> defaults.h has:
> 
> #ifndef HAVE_simple_return
> #define HAVE_simple_return 0
> static inline rtx
> gen_simple_return ()
> {
>   gcc_unreachable ();
>   return NULL;
> }
> #endif
> 
> and insn-flags.h has:
> 
> static inline rtx gen_simple_return                                      
> (void);
> static inline rtx
> gen_simple_return(void)
> {
>   return 0;
> }
> 
> If I change the enable to “1” or “” then it compiles better.  Also, I can 
> delete the pattern or change the name of the pattern and it works ok as well.
> 
> If they both did #ifndef HAVE_simple_return, and then insn-flags did #define 
> HAVE_simple_return 0, I think it might work better.  I’ve not thought about 
> it much.

hrm, I didn't realize you could sometimes get a dummy function in
insn-flags.h (especially without it defining the macro that seems kind
of broken on genflags' part).  What I think we could actually do is
change genflags to #define HAVE_x 0 if it is going to emit the static
function and some how have a list of insns that always get emited so you
don't need the define_insn with enabled = 0 in every target's md file.
The one big trick with this is that all the #ifdef HAVE_foo need to be
updated so it'll take a little time.

Trev

Reply via email to