[PATCH 5/8] always define HAVE_simple_return and HAVE_return

Mike Stump mikestump@comcast.net
Wed May 6 01:13:00 GMT 2015


On Apr 26, 2015, at 10:55 PM, tbsaunde+gcc@tbsaunde.org wrote:
> From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
> 
> gcc/ChangeLog:
> 
> 2015-04-27  Trevor Saunders  <tbsaunde+gcc@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.


More information about the Gcc-patches mailing list