diff options
author | rsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-07-16 13:52:22 +0000 |
---|---|---|
committer | rsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-07-16 13:52:22 +0000 |
commit | c04601c11c49d37df11fc0e8b598a5ceb9a8d922 (patch) | |
tree | 9d8586f4a5e07a89b18a2e4fb2c2f801fafb90b8 /gcc/genemit.c | |
parent | 5d1f193229bf236d8a87f17ae23b02c0dd066a22 (diff) | |
download | gcc-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/genemit.c')
-rw-r--r-- | gcc/genemit.c | 99 |
1 files changed, 44 insertions, 55 deletions
diff --git a/gcc/genemit.c b/gcc/genemit.c index 288b8bddd3c..2d2fb629023 100644 --- a/gcc/genemit.c +++ b/gcc/genemit.c @@ -28,9 +28,6 @@ along with GCC; see the file COPYING3. If not see #include "gensupport.h" -static int insn_code_number; -static int insn_index_number; - /* Data structure for recording the patterns of insns that have CLOBBERs. We use this to output a function that adds these CLOBBERs to a previously-allocated PARALLEL expression. */ @@ -299,7 +296,7 @@ gen_emit_seq (rtvec vec, char *used) /* Generate the `gen_...' function for a DEFINE_INSN. */ static void -gen_insn (rtx insn, int lineno) +gen_insn (md_rtx_info *info) { struct pattern_stats stats; int i; @@ -308,6 +305,7 @@ gen_insn (rtx insn, int lineno) registers or MATCH_SCRATCHes. If so, store away the information for later. */ + rtx insn = info->def; if (XVEC (insn, 1)) { int has_hard_reg = 0; @@ -329,7 +327,7 @@ gen_insn (rtx insn, int lineno) struct clobber_ent *link = XNEW (struct clobber_ent); int j; - link->code_number = insn_code_number; + link->code_number = info->index; /* See if any previous CLOBBER_LIST entry is the same as this one. */ @@ -383,12 +381,12 @@ gen_insn (rtx insn, int lineno) if (XSTR (insn, 0)[0] == 0 || XSTR (insn, 0)[0] == '*') return; - printf ("/* %s:%d */\n", read_md_filename, lineno); + printf ("/* %s:%d */\n", info->loc.filename, info->loc.lineno); /* Find out how many operands this function has. */ get_pattern_stats (&stats, XVEC (insn, 1)); if (stats.max_dup_opno > stats.max_opno) - fatal ("match_dup operand number has no match_operand"); + fatal_at (info->loc, "match_dup operand number has no match_operand"); /* Output the function name and argument declarations. */ printf ("rtx\ngen_%s (", XSTR (insn, 0)); @@ -419,16 +417,18 @@ gen_insn (rtx insn, int lineno) /* Generate the `gen_...' function for a DEFINE_EXPAND. */ static void -gen_expand (rtx expand) +gen_expand (md_rtx_info *info) { struct pattern_stats stats; int i; char *used; + rtx expand = info->def; if (strlen (XSTR (expand, 0)) == 0) - fatal ("define_expand lacks a name"); + fatal_at (info->loc, "define_expand lacks a name"); if (XVEC (expand, 1) == 0) - fatal ("define_expand for %s lacks a pattern", XSTR (expand, 0)); + fatal_at (info->loc, "define_expand for %s lacks a pattern", + XSTR (expand, 0)); /* Find out how many operands this function has. */ get_pattern_stats (&stats, XVEC (expand, 1)); @@ -517,21 +517,22 @@ gen_expand (rtx expand) /* Like gen_expand, but generates insns resulting from splitting SPLIT. */ static void -gen_split (rtx split) +gen_split (md_rtx_info *info) { struct pattern_stats stats; int i; + rtx split = info->def; const char *const name = ((GET_CODE (split) == DEFINE_PEEPHOLE2) ? "peephole2" : "split"); const char *unused; char *used; if (XVEC (split, 0) == 0) - fatal ("define_%s (definition %d) lacks a pattern", name, - insn_index_number); + fatal_at (info->loc, "%s lacks a pattern", + GET_RTX_NAME (GET_CODE (split))); else if (XVEC (split, 2) == 0) - fatal ("define_%s (definition %d) lacks a replacement pattern", name, - insn_index_number); + fatal_at (info->loc, "%s lacks a replacement pattern", + GET_RTX_NAME (GET_CODE (split))); /* Find out how many operands this function has. */ @@ -543,17 +544,18 @@ gen_split (rtx split) if (GET_CODE (split) == DEFINE_PEEPHOLE2) { printf ("extern rtx_insn *gen_%s_%d (rtx_insn *, rtx *);\n", - name, insn_code_number); - printf ("rtx_insn *\ngen_%s_%d (rtx_insn *curr_insn ATTRIBUTE_UNUSED, rtx *operands%s)\n", - name, insn_code_number, unused); + name, info->index); + printf ("rtx_insn *\ngen_%s_%d (rtx_insn *curr_insn ATTRIBUTE_UNUSED," + " rtx *operands%s)\n", + name, info->index, unused); } else { printf ("extern rtx_insn *gen_split_%d (rtx_insn *, rtx *);\n", - insn_code_number); + info->index); printf ("rtx_insn *\ngen_split_%d " "(rtx_insn *curr_insn ATTRIBUTE_UNUSED, rtx *operands%s)\n", - insn_code_number, unused); + info->index, unused); } printf ("{\n"); @@ -567,7 +569,7 @@ gen_split (rtx split) printf (" if (dump_file)\n"); printf (" fprintf (dump_file, \"Splitting with gen_%s_%d\\n\");\n", - name, insn_code_number); + name, info->index); printf (" start_sequence ();\n"); @@ -725,8 +727,6 @@ output_peephole2_scratches (rtx split) int main (int argc, char **argv) { - rtx desc; - progname = "genemit"; if (!init_rtx_reader_args (argc, argv)) @@ -735,9 +735,6 @@ main (int argc, char **argv) /* Assign sequential codes to all entries in the machine description in parallel with the tables in insn-output.c. */ - insn_code_number = 0; - insn_index_number = 0; - printf ("/* Generated automatically by the program `genemit'\n\ from the machine description file `md'. */\n\n"); @@ -780,40 +777,32 @@ from the machine description file `md'. */\n\n"); /* Read the machine description. */ - while (1) - { - int line_no; - - 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: + gen_insn (&info); break; - switch (GET_CODE (desc)) - { - case DEFINE_INSN: - gen_insn (desc, line_no); - break; - - case DEFINE_EXPAND: - printf ("/* %s:%d */\n", read_md_filename, line_no); - gen_expand (desc); - break; + case DEFINE_EXPAND: + printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno); + gen_expand (&info); + break; - case DEFINE_SPLIT: - printf ("/* %s:%d */\n", read_md_filename, line_no); - gen_split (desc); - break; + case DEFINE_SPLIT: + printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno); + gen_split (&info); + break; - case DEFINE_PEEPHOLE2: - printf ("/* %s:%d */\n", read_md_filename, line_no); - gen_split (desc); - break; + case DEFINE_PEEPHOLE2: + printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno); + gen_split (&info); + break; - default: - break; - } - ++insn_index_number; - } + default: + break; + } /* Write out the routines to add CLOBBERs to a pattern and say whether they clobber a hard reg. */ |