diff options
author | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-01-23 15:15:12 +0000 |
---|---|---|
committer | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-01-23 15:15:12 +0000 |
commit | 343695df238d8e043fe83c8b0cce11b73f2e2cba (patch) | |
tree | 04e7c2430e813b518ab2f021d422bd49f8d865ec /gcc | |
parent | af908c02d4c893024a3ccfa73244b96a10caeb2f (diff) | |
download | gcc-343695df238d8e043fe83c8b0cce11b73f2e2cba.tar.gz |
r110124@banpei: zack | 2006-01-22 14:45:55 -0800
* gensupport.c: Define get_insn_name and record_insn_name here.
(read_md_rtx): Call record_insn_name as appropriate.
* genattr.c, genattrtab.c, gencodes.c, genconfig.c, genemit.c
* genextract.c, genflags.c, genopinit.c, genoutput.c, genpeep.c
* genpreds.c, genrecog.c: Don't define get_insn_name nor
record_insn_name.
* Makefile.in (BUILD_SUPPORT, BUILD_PRINT): Fold into BUILD_RTL.
(BUILD_VARRAY): Delete.
(genprognormal): Rename genprogmd. Fold in all programs from
genprognoprint; also attrtab.
(build/genattrtab): Just mention genautomata.o and varray.o.
Reorganize a bit, add comments to make the categories clearer.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@110120 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 15 | ||||
-rw-r--r-- | gcc/Makefile.in | 33 | ||||
-rw-r--r-- | gcc/genattr.c | 7 | ||||
-rw-r--r-- | gcc/genattrtab.c | 7 | ||||
-rw-r--r-- | gcc/gencodes.c | 8 | ||||
-rw-r--r-- | gcc/genconfig.c | 7 | ||||
-rw-r--r-- | gcc/genemit.c | 7 | ||||
-rw-r--r-- | gcc/genextract.c | 52 | ||||
-rw-r--r-- | gcc/genflags.c | 7 | ||||
-rw-r--r-- | gcc/genopinit.c | 7 | ||||
-rw-r--r-- | gcc/genoutput.c | 22 | ||||
-rw-r--r-- | gcc/genpeep.c | 7 | ||||
-rw-r--r-- | gcc/genpreds.c | 7 | ||||
-rw-r--r-- | gcc/genrecog.c | 52 | ||||
-rw-r--r-- | gcc/gensupport.c | 52 |
15 files changed, 79 insertions, 211 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6b723cc965b..b67c0339b6c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,20 @@ 2006-01-22 Zack Weinberg <zackw@panix.com> + * gensupport.c: Define get_insn_name and record_insn_name here. + (read_md_rtx): Call record_insn_name as appropriate. + * genattr.c, genattrtab.c, gencodes.c, genconfig.c, genemit.c + * genextract.c, genflags.c, genopinit.c, genoutput.c, genpeep.c + * genpreds.c, genrecog.c: Don't define get_insn_name nor + record_insn_name. + * Makefile.in (BUILD_SUPPORT, BUILD_PRINT): Fold into BUILD_RTL. + (BUILD_VARRAY): Delete. + (genprognormal): Rename genprogmd. Fold in all programs from + genprognoprint; also attrtab. + (build/genattrtab): Just mention genautomata.o and varray.o. + Reorganize a bit, add comments to make the categories clearer. + +2006-01-22 Zack Weinberg <zackw@panix.com> + * genconditions.c (condition_table, add_condition): Delete. (write_conditions): Don't emit n_insn_conditions nor insn_elision_unavailable. Issue the gcc version #ifdef here, diff --git a/gcc/Makefile.in b/gcc/Makefile.in index c6eec9832c1..6d25f9001c1 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -839,11 +839,8 @@ LDEXP_LIB = @LDEXP_LIB@ BUILD_LIBS = $(BUILD_LIBIBERTY) BUILD_RTL = build/rtl.o build/read-rtl.o build/ggc-none.o \ - build/min-insn-modes.o -BUILD_SUPPORT = build/gensupport.o -BUILD_PRINT = build/print-rtl.o + build/min-insn-modes.o build/gensupport.o build/print-rtl.o BUILD_ERRORS = build/errors.o -BUILD_VARRAY = build/varray.o # Specify the directories to be searched for header files. # Both . and srcdir are used, in that order, @@ -2964,29 +2961,19 @@ build/gen%$(build_exeext): build/gen%.o $(BUILD_LIBDEPS) $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o $@ \ $(filter-out $(BUILD_LIBDEPS), $^) $(BUILD_LIBS) -# All these programs have the same additional dependency set. -genprognormal = attr codes config emit extract flags opinit output peep recog \ - preds -$(genprognormal:%=build/gen%$(build_exeext)): $(BUILD_RTL) $(BUILD_SUPPORT) \ - $(BUILD_PRINT) $(BUILD_ERRORS) - -# These don't have the glue to link with print-rtl.o. -genprognoprint = mddeps constants conditions -$(genprognoprint:%=build/gen%$(build_exeext)): $(BUILD_RTL) $(BUILD_SUPPORT) \ - $(BUILD_ERRORS) +# All these programs use the MD reader ($(BUILD_RTL)). +genprogmd = attr attrtab codes conditions config constants emit extract \ + flags mddeps opinit output peep preds recog +$(genprogmd:%=build/gen%$(build_exeext)): $(BUILD_RTL) $(BUILD_ERRORS) +# These programs need files over and above what they get from the above list. +build/genextract$(build_exeext) : build/vec.o +build/genattrtab$(build_exeext) : build/genautomata.o build/varray.o +build/genattrtab$(build_exeext) : BUILD_LIBS += -lm +# These programs are not linked with the MD reader. build/gengenrtl$(build_exeext) : $(BUILD_ERRORS) build/genmodes$(build_exeext) : $(BUILD_ERRORS) -build/genextract$(build_exeext): build/vec.o - -# These programs are made from more than one source file. -# The primary source file comes from the pattern rule above. -build/genattrtab$(build_exeext) : build/genautomata.o \ - $(BUILD_RTL) $(BUILD_SUPPORT) $(BUILD_PRINT) $(BUILD_ERRORS) \ - $(BUILD_VARRAY) -build/genattrtab$(build_exeext) : BUILD_LIBS += -lm - build/gengtype$(build_exeext) : build/gengtype-lex.o \ build/gengtype-yacc.o $(BUILD_ERRORS) diff --git a/gcc/genattr.c b/gcc/genattr.c index 0e039e7a4b2..7d6d50fffb0 100644 --- a/gcc/genattr.c +++ b/gcc/genattr.c @@ -286,10 +286,3 @@ main (int argc, char **argv) return SUCCESS_EXIT_CODE; } - -/* Define this so we can link with print-rtl.o to get debug_rtx function. */ -const char * -get_insn_name (int code ATTRIBUTE_UNUSED) -{ - return NULL; -} diff --git a/gcc/genattrtab.c b/gcc/genattrtab.c index 359ddddae10..41dda6bb5da 100644 --- a/gcc/genattrtab.c +++ b/gcc/genattrtab.c @@ -4626,10 +4626,3 @@ from the machine description file `md'. */\n\n"); fflush (stdout); return (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE); } - -/* Define this so we can link with print-rtl.o to get debug_rtx function. */ -const char * -get_insn_name (int code ATTRIBUTE_UNUSED) -{ - return NULL; -} diff --git a/gcc/gencodes.c b/gcc/gencodes.c index adfca88e94f..27a68ad4a26 100644 --- a/gcc/gencodes.c +++ b/gcc/gencodes.c @@ -96,11 +96,3 @@ enum insn_code {"); return SUCCESS_EXIT_CODE; } - -/* Define this so we can link with print-rtl.o to get debug_rtx function. */ - -const char * -get_insn_name (int code ATTRIBUTE_UNUSED) -{ - return NULL; -} diff --git a/gcc/genconfig.c b/gcc/genconfig.c index b92cd2fed9f..93913151084 100644 --- a/gcc/genconfig.c +++ b/gcc/genconfig.c @@ -364,10 +364,3 @@ main (int argc, char **argv) return SUCCESS_EXIT_CODE; } - -/* Define this so we can link with print-rtl.o to get debug_rtx function. */ -const char * -get_insn_name (int ARG_UNUSED (code)) -{ - return NULL; -} diff --git a/gcc/genemit.c b/gcc/genemit.c index 691e42c5dd1..e9773082f9e 100644 --- a/gcc/genemit.c +++ b/gcc/genemit.c @@ -894,10 +894,3 @@ from the machine description file `md'. */\n\n"); fflush (stdout); return (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE); } - -/* Define this so we can link with print-rtl.o to get debug_rtx function. */ -const char * -get_insn_name (int code ATTRIBUTE_UNUSED) -{ - return NULL; -} diff --git a/gcc/genextract.c b/gcc/genextract.c index 1fd684228cf..319a0b0bfa9 100644 --- a/gcc/genextract.c +++ b/gcc/genextract.c @@ -86,7 +86,6 @@ struct accum_extract /* Forward declarations. */ static void walk_rtx (rtx, struct accum_extract *); -static void record_insn_name (int, const char *); static void gen_insn (rtx insn, int insn_code_number) @@ -416,10 +415,7 @@ main (int argc, char **argv) while ((desc = read_md_rtx (&line_no, &insn_code_number)) != NULL) { if (GET_CODE (desc) == DEFINE_INSN) - { - record_insn_name (insn_code_number, XSTR (desc, 0)); - gen_insn (desc, insn_code_number); - } + gen_insn (desc, insn_code_number); else if (GET_CODE (desc) == DEFINE_PEEPHOLE) { @@ -493,49 +489,3 @@ main (int argc, char **argv) fflush (stdout); return (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE); } - -/* Define this so we can link with print-rtl.o to get debug_rtx function. */ - -/* Holds an array of names indexed by insn_code_number. */ -static char **insn_name_ptr = 0; -static int insn_name_ptr_size = 0; - -const char * -get_insn_name (int code ATTRIBUTE_UNUSED) -{ - if (code < insn_name_ptr_size) - return insn_name_ptr[code]; - else - return NULL; -} - -static void -record_insn_name (int code, const char *name) -{ - static const char *last_real_name = "insn"; - static int last_real_code = 0; - char *new; - - if (insn_name_ptr_size <= code) - { - int new_size; - new_size = (insn_name_ptr_size ? insn_name_ptr_size * 2 : 512); - insn_name_ptr = xrealloc (insn_name_ptr, sizeof(char *) * new_size); - memset (insn_name_ptr + insn_name_ptr_size, 0, - sizeof(char *) * (new_size - insn_name_ptr_size)); - insn_name_ptr_size = new_size; - } - - if (!name || name[0] == '\0') - { - new = xmalloc (strlen (last_real_name) + 10); - sprintf (new, "%s+%d", last_real_name, code - last_real_code); - } - else - { - last_real_name = new = xstrdup (name); - last_real_code = code; - } - - insn_name_ptr[code] = new; -} diff --git a/gcc/genflags.c b/gcc/genflags.c index 075a355ee72..30e9c7e103a 100644 --- a/gcc/genflags.c +++ b/gcc/genflags.c @@ -279,10 +279,3 @@ main (int argc, char **argv) return SUCCESS_EXIT_CODE; } - -/* Define this so we can link with print-rtl.o to get debug_rtx function. */ -const char * -get_insn_name (int ARG_UNUSED (code)) -{ - return NULL; -} diff --git a/gcc/genopinit.c b/gcc/genopinit.c index d9582202b3b..c9cea085852 100644 --- a/gcc/genopinit.c +++ b/gcc/genopinit.c @@ -453,10 +453,3 @@ from the machine description file `md'. */\n\n"); fflush (stdout); return (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE); } - -/* Define this so we can link with print-rtl.o to get debug_rtx function. */ -const char * -get_insn_name (int code ATTRIBUTE_UNUSED) -{ - return NULL; -} diff --git a/gcc/genoutput.c b/gcc/genoutput.c index e94e20f3d16..4a739042599 100644 --- a/gcc/genoutput.c +++ b/gcc/genoutput.c @@ -192,28 +192,6 @@ static void gen_split (rtx, int); static void check_constraint_len (void); static int constraint_len (const char *, int); -const char * -get_insn_name (int index) -{ - static char buf[100]; - - struct data *i, *last_named = NULL; - for (i = idata; i ; i = i->next) - { - if (i->index_number == index) - return i->name; - if (i->name) - last_named = i; - } - - if (last_named) - sprintf(buf, "%s+%d", last_named->name, index - last_named->index_number); - else - sprintf(buf, "insn %d", index); - - return buf; -} - static void output_prologue (void) { diff --git a/gcc/genpeep.c b/gcc/genpeep.c index 89da38f1b3b..ad4b5a11351 100644 --- a/gcc/genpeep.c +++ b/gcc/genpeep.c @@ -426,10 +426,3 @@ from the machine description file `md'. */\n\n"); fflush (stdout); return (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE); } - -/* Define this so we can link with print-rtl.o to get debug_rtx function. */ -const char * -get_insn_name (int code ATTRIBUTE_UNUSED) -{ - return NULL; -} diff --git a/gcc/genpreds.c b/gcc/genpreds.c index dd044f771e4..6dbe7d4b920 100644 --- a/gcc/genpreds.c +++ b/gcc/genpreds.c @@ -492,10 +492,3 @@ main (int argc, char **argv) return SUCCESS_EXIT_CODE; } - -/* Dummy for debugging purposes. */ -const char * -get_insn_name (int code ATTRIBUTE_UNUSED) -{ - return 0; -} diff --git a/gcc/genrecog.c b/gcc/genrecog.c index 82248482de0..cb86849e936 100644 --- a/gcc/genrecog.c +++ b/gcc/genrecog.c @@ -61,10 +61,6 @@ #define OUTPUT_LABEL(INDENT_STRING, LABEL_NUMBER) \ printf("%sL%d: ATTRIBUTE_UNUSED_LABEL\n", (INDENT_STRING), (LABEL_NUMBER)) -/* Holds an array of names indexed by insn_code_number. */ -static char **insn_name_ptr = 0; -static int insn_name_ptr_size = 0; - /* A listhead of decision trees. The alternatives to a node are kept in a doubly-linked list so we can easily add nodes to the proper place when merging. */ @@ -473,9 +469,6 @@ static struct decision_head make_insn_sequence static void process_tree (struct decision_head *, enum routine_type); -static void record_insn_name - (int, const char *); - static void debug_decision_0 (struct decision *, int, int); static void debug_decision_1 @@ -2189,7 +2182,7 @@ write_action (struct decision *p, struct decision_test *test, indent, test->u.insn.num_clobbers_to_add); printf ("%sreturn %d; /* %s */\n", indent, test->u.insn.code_number, - insn_name_ptr[test->u.insn.code_number]); + get_insn_name (test->u.insn.code_number)); break; case SPLIT: @@ -2548,8 +2541,6 @@ make_insn_sequence (rtx insn, enum routine_type type) /* We should never see an insn whose C test is false at compile time. */ gcc_assert (truth); - record_insn_name (next_insn_code, (type == RECOG ? XSTR (insn, 0) : NULL)); - c_test_pos[0] = '\0'; if (type == PEEPHOLE2) { @@ -2798,47 +2789,6 @@ main (int argc, char **argv) return (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE); } -/* Define this so we can link with print-rtl.o to get debug_rtx function. */ -const char * -get_insn_name (int code) -{ - if (code < insn_name_ptr_size) - return insn_name_ptr[code]; - else - return NULL; -} - -static void -record_insn_name (int code, const char *name) -{ - static const char *last_real_name = "insn"; - static int last_real_code = 0; - char *new; - - if (insn_name_ptr_size <= code) - { - int new_size; - new_size = (insn_name_ptr_size ? insn_name_ptr_size * 2 : 512); - insn_name_ptr = xrealloc (insn_name_ptr, sizeof(char *) * new_size); - memset (insn_name_ptr + insn_name_ptr_size, 0, - sizeof(char *) * (new_size - insn_name_ptr_size)); - insn_name_ptr_size = new_size; - } - - if (!name || name[0] == '\0') - { - new = xmalloc (strlen (last_real_name) + 10); - sprintf (new, "%s+%d", last_real_name, code - last_real_code); - } - else - { - last_real_name = new = xstrdup (name); - last_real_code = code; - } - - insn_name_ptr[code] = new; -} - static void debug_decision_2 (struct decision_test *test) { diff --git a/gcc/gensupport.c b/gcc/gensupport.c index 94d27aca975..bbac33a2c88 100644 --- a/gcc/gensupport.c +++ b/gcc/gensupport.c @@ -118,6 +118,7 @@ static void process_define_cond_exec (void); static void process_include (rtx, int); static char *save_string (const char *, int); static void init_predicate_table (void); +static void record_insn_name (int, const char *); void message_with_line (int lineno, const char *msg, ...) @@ -1104,6 +1105,10 @@ read_md_rtx (int *lineno, int *seqnr) sequence_num++; else if (insn_elision) goto discard; + + /* *seqnr is used here so the name table will match caller's + idea of insn numbering, whether or not elision is active. */ + record_insn_name (*seqnr, XSTR (desc, 0)); break; case DEFINE_SPLIT: @@ -1373,3 +1378,50 @@ init_predicate_table (void) add_predicate (pred); } } + +/* These functions allow linkage with print-rtl.c. Also, some generators + like to annotate their output with insn names. */ + +/* Holds an array of names indexed by insn_code_number. */ +static char **insn_name_ptr = 0; +static int insn_name_ptr_size = 0; + +const char * +get_insn_name (int code) +{ + if (code < insn_name_ptr_size) + return insn_name_ptr[code]; + else + return NULL; +} + +static void +record_insn_name (int code, const char *name) +{ + static const char *last_real_name = "insn"; + static int last_real_code = 0; + char *new; + + if (insn_name_ptr_size <= code) + { + int new_size; + new_size = (insn_name_ptr_size ? insn_name_ptr_size * 2 : 512); + insn_name_ptr = xrealloc (insn_name_ptr, sizeof(char *) * new_size); + memset (insn_name_ptr + insn_name_ptr_size, 0, + sizeof(char *) * (new_size - insn_name_ptr_size)); + insn_name_ptr_size = new_size; + } + + if (!name || name[0] == '\0') + { + new = xmalloc (strlen (last_real_name) + 10); + sprintf (new, "%s+%d", last_real_name, code - last_real_code); + } + else + { + last_real_name = new = xstrdup (name); + last_real_code = code; + } + + insn_name_ptr[code] = new; +} |