diff options
author | steven <steven@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-05-04 20:04:47 +0000 |
---|---|---|
committer | steven <steven@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-05-04 20:04:47 +0000 |
commit | 73ed0c67ddfc92eb95afc8d93aab8af7f54bbf76 (patch) | |
tree | 09c8525eb66f16b480d4594d1433120fadc8ad6b /gcc/read-md.c | |
parent | a2159ce7ac74f6743c781451b84f7f2f21ddf288 (diff) | |
download | gcc-73ed0c67ddfc92eb95afc8d93aab8af7f54bbf76.tar.gz |
PR other/29442
* read-md.c (fprint_md_ptr_loc, fprint_c_condition): New functions.
(print_md_ptr_loc, print_c_condition): Use them.
* read-md.h (fprint_md_ptr_loc, fprint_c_condition): New prototypes.
* genattrtab.c (attr_file_name, dfa_file_name, latency_file_name,
attr_file, dfa_file, latency_file): New global variables.
(write_attr_valueq, write_attr_set, write_attr_case, write_attr_value,
write_upcase, write_indent, write_length_unit_log, write_test_expr,
write_attr_get, write_insn_cases, write_eligible_delay,
write_const_num_delay_slots): Accept FILE pointer and toss it around.
Update all callers.
(write_header, open_outfile, handle_arg): New funcions.
(make_automaton_attrs): Write prototypes as extern to the output
files.
(main): Use init_rtx_reader_args_cb with handle_arg to take 3 file
names from the command line. Open the output files and write out
internal functions for DFA functions to dfa_file_name, insn latency
functions to latency_file_name, and everything else to attr_file.
* Makefile.in (OBJS): Add insn-dfatab.o and insn-latencytab.o.
(BACKEND): Build libbackend first.
(MOSTLYCLEANFILES): Add insn-dfatab.c and insn-latencytab.c.
(.PRECIOUS): Likewise.
(insn-dfatab.o): New rule.
(insn-latencytab.o): New rule.
(simple_rtl_generated_c): Do not include insn-attrtab.c.
(s-attrtab): New rule.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@187181 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/read-md.c')
-rw-r--r-- | gcc/read-md.c | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/gcc/read-md.c b/gcc/read-md.c index 4f1933f447a..e5534d75d48 100644 --- a/gcc/read-md.c +++ b/gcc/read-md.c @@ -167,14 +167,21 @@ copy_md_ptr_loc (const void *new_ptr, const void *old_ptr) } /* If PTR is associated with a known file position, print a #line - directive for it. */ + directive for it to OUTF. */ void -print_md_ptr_loc (const void *ptr) +fprint_md_ptr_loc (FILE *outf, const void *ptr) { const struct ptr_loc *loc = get_md_ptr_loc (ptr); if (loc != 0) - printf ("#line %d \"%s\"\n", loc->lineno, loc->filename); + fprintf (outf, "#line %d \"%s\"\n", loc->lineno, loc->filename); +} + +/* Special fprint_md_ptr_loc for writing to STDOUT. */ +void +print_md_ptr_loc (const void *ptr) +{ + fprint_md_ptr_loc (stdout, ptr); } /* Return a condition that satisfies both COND1 and COND2. Either string @@ -204,31 +211,39 @@ join_c_conditions (const char *cond1, const char *cond2) return result; } -/* Print condition COND, wrapped in brackets. If COND was created by - join_c_conditions, recursively invoke this function for the original +/* Print condition COND to OUTF, wrapped in brackets. If COND was created + by join_c_conditions, recursively invoke this function for the original conditions and join the result with "&&". Otherwise print a #line directive for COND if its original file position is known. */ void -print_c_condition (const char *cond) +fprint_c_condition (FILE *outf, const char *cond) { const char **halves = (const char **) htab_find (joined_conditions, &cond); if (halves != 0) { - printf ("("); - print_c_condition (halves[1]); - printf (" && "); - print_c_condition (halves[2]); - printf (")"); + fprintf (outf, "("); + fprint_c_condition (outf, halves[1]); + fprintf (outf, " && "); + fprint_c_condition (outf, halves[2]); + fprintf (outf, ")"); } else { - putc ('\n', stdout); - print_md_ptr_loc (cond); - printf ("(%s)", cond); + fputc ('\n', outf); + fprint_md_ptr_loc (outf, cond); + fprintf (outf, "(%s)", cond); } } +/* Special fprint_c_condition for writing to STDOUT. */ + +void +print_c_condition (const char *cond) +{ + fprint_c_condition (stdout, cond); +} + /* A vfprintf-like function for reporting an error against line LINENO of the current MD file. */ |