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]
Other format: [Raw text]

Re: Make sure that all insn codes are in (0, LAST_INSN_CODE)


On Tue, May 27, 2014 at 09:41:08AM +0100, Richard Sandiford wrote:
> 	* gencodes.c (main): Make LAST_INSN_CODE higher than any insn code,
> 	rather than any named insn's code.

Ok.

> --- gcc/gencodes.c	2014-05-27 09:38:02.195506710 +0100
> +++ gcc/gencodes.c	2014-05-27 09:39:16.002188824 +0100
> @@ -50,6 +50,7 @@ gen_insn (rtx insn, int code)
>  main (int argc, char **argv)
>  {
>    rtx desc;
> +  int last = 1;
>  
>    progname = "gencodes";
>  
> @@ -82,13 +83,16 @@ enum insn_code {\n\
>  	break;
>  
>        if (GET_CODE (desc) == DEFINE_INSN || GET_CODE (desc) == DEFINE_EXPAND)
> -	gen_insn (desc, insn_code_number);
> +	{
> +	  gen_insn (desc, insn_code_number);
> +	  last = insn_code_number + 1;
> +	}
>      }
>  
> -  puts ("  LAST_INSN_CODE\n\
> +  printf ("  LAST_INSN_CODE = %d\n\
>  };\n\
>  \n\
> -#endif /* GCC_INSN_CODES_H */");
> +#endif /* GCC_INSN_CODES_H */\n", last);
>  
>    if (ferror (stdout) || fflush (stdout) || fclose (stdout))
>      return FATAL_EXIT_CODE;

	Jakub


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