r110124@banpei: zack | 2006-01-22 14:45:55 -0800

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.

From-SVN: r110120
This commit is contained in:
Zack Weinberg 2006-01-23 15:15:12 +00:00 committed by Zack Weinberg
parent 1c7352cde8
commit 0458fe77b8
15 changed files with 80 additions and 212 deletions

View File

@ -1,3 +1,18 @@
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.

View File

@ -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)
# 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 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)
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)
# 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/gengtype$(build_exeext) : build/gengtype-lex.o \
build/gengtype-yacc.o $(BUILD_ERRORS)

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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)
{

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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)
{

View File

@ -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;
}