summaryrefslogtreecommitdiff
path: root/gcc/gencodes.c
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2015-07-16 13:52:22 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2015-07-16 13:52:22 +0000
commitc04601c11c49d37df11fc0e8b598a5ceb9a8d922 (patch)
tree9d8586f4a5e07a89b18a2e4fb2c2f801fafb90b8 /gcc/gencodes.c
parent5d1f193229bf236d8a87f17ae23b02c0dd066a22 (diff)
downloadgcc-c04601c11c49d37df11fc0e8b598a5ceb9a8d922.tar.gz
gcc/
* read-md.h (message_with_line, error_with_line): Delete. * read-md.c (message_with_line, error_with_line): Delete. * gensupport.h: Include read-md.h. (md_rtx_info): New structure. (read_md_rtx): Use it. Return a bool success value. * gensupport.c (read_md_rtx): Likewise. * genattr-common.c (gen_attr): Take an md_rtx_info rather than an rtx. (main): Update after interface changes. * genattr.c (gen_attr): Take an md_rtx_info rather than an rtx. (main): Update after interface changes. * genattrtab.c (insn_code_number): Delete. (optimize_attrs): Add a max_insn_code parameter and use it instead of insn_code_number. (gen_attr): Take an md_rtx_info rather than an rtx and lineno. Use *_at rather than *_with_line functions. (gen_insn): Likewise. (gen_delay): Likewise. (gen_insn_reserv): Likewise. (gen_bypass): Take an md_rtx_info rather than an rtx. (main): Update after interface changes. Use a local max_insn_code variable instead of insn_code_number. * genautomata.c (gen_cpu_unit): Take an md_rtx_info rather than an rtx. Use fatal_at rather than fatal. (gen_query_cpu_unit, gen_bypass, gen_excl_set) (gen_presence_absence_set, gen_presence_set, gen_final_presence_set) (gen_absence_set, gen_final_absence_set, gen_automaton) (gen_automata_option, gen_reserv, gen_insn_reserv): Likewise. (main): Update after interface changes. * gencodes.c (gen_insn): Take an md_rtx_info rather than an rtx and code number. (main): Update after interface changes. * genconditions.c (main): Use new read_md_rtx interface. * genconfig.c (gen_insn): Take an md_rtx_info rather than an rtx. (gen_expand, gen_split, gen_peephole, gen_peephole2): Likewise. (main): Update after interface changes. * genemit.c (insn_code_number, insn_index_number): Delete. (gen_insn): Take an md_rtx_info rather than an rtx and lineno. Use fatal_at rather than fatal. (gen_expand): Take an md_rtx_info rather than an rtx. Use fatal_at rather than fatal. (gen_split): Likewise. (main): Update after interface changes. * genextract.c (line_no): Delete. (gen_insn): Take an md_rtx_info rather than an rtx and lineno. Update call to walk_rtx. (VEC_safe_set_locstr): Add an md_rtx_info argument. Use message_at rather than message_with_line. (walk_rtx): Add an md_rtx_info argument. Update call to VEC_safe_set_locstr. (main): Update after interface changes. * genflags.c (gen_insn): Take an md_rtx_info rather than an rtx and lineno. Use error_at rather than separate message_with_line calls and have_error assignments. (main): Update after interface changes. * genmddump.c (main): Use new read_md_rtx interface. * genopinit.c (insn): Take an md_rtx_info rather than an rtx. (main): Update after interface changes. * genoutput.c (next_code_number): Delete. (gen_insn): Take an md_rtx_info rather than an rtx and lineno. (gen_peephole, gen_expand, gen_split): Likewise. (note_constraint): Likewise. Use *_at rather than *_with_line functions. (main): Update after interface changes. * genpeep.c (gen_peephole): Take an md_rtx_info rather than an rtx and lineno. (main): Update after interface changes. * genpreds.c (process_define_predicate): Take an md_rtx_info rather than an rtx and lineno. (process_define_constraint): Likewise. (process_define_register_constraint): Likewise. (main): Update after interface changes. * genrecog.c (next_insn_code, pattern_lineno): Delete. (validate_pattern): Replace top-level rtx with an md_rtx_info. Use *_at rather than *_with_line functions. (match_pattern_2): Likewise. (match_pattern_1, match_pattern): Add an md_rtx_info parameter. (get_peephole2_pattern): Take an md_rtx_info rather than an rtvec. Use *_at rather than *_with_line functions. * gentarget-def.c (add_insn): New function. (main): Use it. Use new read_md_rtx interface. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@225883 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gencodes.c')
-rw-r--r--gcc/gencodes.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/gcc/gencodes.c b/gcc/gencodes.c
index 081b1cd9354..b9d65a2c8bc 100644
--- a/gcc/gencodes.c
+++ b/gcc/gencodes.c
@@ -29,10 +29,10 @@ along with GCC; see the file COPYING3. If not see
#include "gensupport.h"
static void
-gen_insn (rtx insn, int code)
+gen_insn (md_rtx_info *info)
{
- const char *name = XSTR (insn, 0);
- int truth = maybe_eval_c_test (XSTR (insn, 2));
+ const char *name = XSTR (info->def, 0);
+ int truth = maybe_eval_c_test (XSTR (info->def, 2));
/* Don't mention instructions whose names are the null string
or begin with '*'. They are in the machine description just
@@ -42,14 +42,13 @@ gen_insn (rtx insn, int code)
if (truth == 0)
printf ("#define CODE_FOR_%s CODE_FOR_nothing\n", name);
else
- printf (" CODE_FOR_%s = %d,\n", name, code);
+ printf (" CODE_FOR_%s = %d,\n", name, info->index);
}
}
int
main (int argc, char **argv)
{
- rtx desc;
int last = 1;
progname = "gencodes";
@@ -73,20 +72,18 @@ enum insn_code {\n\
/* Read the machine description. */
- while (1)
- {
- int line_no;
- int insn_code_number;
-
- desc = read_md_rtx (&line_no, &insn_code_number);
- if (desc == NULL)
+ md_rtx_info info;
+ while (read_md_rtx (&info))
+ switch (GET_CODE (info.def))
+ {
+ case DEFINE_INSN:
+ case DEFINE_EXPAND:
+ gen_insn (&info);
+ last = info.index + 1;
break;
- if (GET_CODE (desc) == DEFINE_INSN || GET_CODE (desc) == DEFINE_EXPAND)
- {
- gen_insn (desc, insn_code_number);
- last = insn_code_number + 1;
- }
+ default:
+ break;
}
printf (" LAST_INSN_CODE = %d\n\