diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 13 | ||||
-rw-r--r-- | gcc/genemit.c | 50 | ||||
-rw-r--r-- | gcc/gensupport.c | 28 |
3 files changed, 57 insertions, 34 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 41f17dec1f0..7eef475a7ae 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,15 @@ +2002-05-23 Richard Henderson <rth@redhat.com> + + * genemit.c (gen_insn): Print file:lineno comment before function. + (main): likewise. + * gensupport.c (struct queue_elem): Add filename member. + (queue_pattern): Initialize it; update all callers. + (process_include): Don't free filename. + (read_md_rtx): Set read_rtx_filename. + 2002-05-23 Hans Boehm <Hans_Boehm@hp.com> - * config/ia64/linux.h (IA64_GATE_AREA_END): Adjust for 64K - pages. + + * config/ia64/linux.h (IA64_GATE_AREA_END): Adjust for 64K pages. 2002-05-23 Richard Henderson <rth@redhat.com> diff --git a/gcc/genemit.c b/gcc/genemit.c index 5a7f32ae2da..302bda1e214 100644 --- a/gcc/genemit.c +++ b/gcc/genemit.c @@ -59,7 +59,7 @@ static void max_operand_1 PARAMS ((rtx)); static int max_operand_vec PARAMS ((rtx, int)); static void print_code PARAMS ((RTX_CODE)); static void gen_exp PARAMS ((rtx, enum rtx_code, char *)); -static void gen_insn PARAMS ((rtx)); +static void gen_insn PARAMS ((rtx, int)); static void gen_expand PARAMS ((rtx)); static void gen_split PARAMS ((rtx)); static void output_add_clobbers PARAMS ((void)); @@ -297,8 +297,9 @@ gen_exp (x, subroutine_type, used) /* Generate the `gen_...' function for a DEFINE_INSN. */ static void -gen_insn (insn) +gen_insn (insn, lineno) rtx insn; + int lineno; { int operands; int i; @@ -383,6 +384,8 @@ gen_insn (insn) if (XSTR (insn, 0)[0] == 0 || XSTR (insn, 0)[0] == '*') return; + printf ("/* %s:%d */\n", read_rtx_filename, lineno); + /* Find out how many operands this function has, and also whether any of them have register constraints. */ register_constraints = 0; @@ -838,7 +841,7 @@ from the machine description file `md'. */\n\n"); printf ("#include \"toplev.h\"\n"); printf ("#include \"ggc.h\"\n\n"); printf ("#define FAIL return (end_sequence (), _val)\n"); - printf ("#define DONE return (_val = gen_sequence (), end_sequence (), _val)\n"); + printf ("#define DONE return (_val = gen_sequence (), end_sequence (), _val)\n\n"); /* Read the machine description. */ @@ -852,25 +855,28 @@ from the machine description file `md'. */\n\n"); switch (GET_CODE (desc)) { - case DEFINE_INSN: - gen_insn (desc); - break; - - case DEFINE_EXPAND: - gen_expand (desc); - break; - - case DEFINE_SPLIT: - gen_split (desc); - break; - - case DEFINE_PEEPHOLE2: - gen_split (desc); - break; - - default: - break; - } + case DEFINE_INSN: + gen_insn (desc, line_no); + break; + + case DEFINE_EXPAND: + printf ("/* %s:%d */\n", read_rtx_filename, line_no); + gen_expand (desc); + break; + + case DEFINE_SPLIT: + printf ("/* %s:%d */\n", read_rtx_filename, line_no); + gen_split (desc); + break; + + case DEFINE_PEEPHOLE2: + printf ("/* %s:%d */\n", read_rtx_filename, line_no); + gen_split (desc); + break; + + default: + break; + } ++insn_index_number; } diff --git a/gcc/gensupport.c b/gcc/gensupport.c index 8b52eaecab8..251cce995a5 100644 --- a/gcc/gensupport.c +++ b/gcc/gensupport.c @@ -50,6 +50,7 @@ static char *base_dir = NULL; struct queue_elem { rtx data; + const char *filename; int lineno; struct queue_elem *next; }; @@ -63,7 +64,8 @@ static struct queue_elem **define_cond_exec_tail = &define_cond_exec_queue; static struct queue_elem *other_queue; static struct queue_elem **other_tail = &other_queue; -static void queue_pattern PARAMS ((rtx, struct queue_elem ***, int)); +static void queue_pattern PARAMS ((rtx, struct queue_elem ***, + const char *, int)); /* Current maximum length of directory names in the search path for include files. (Altered as we get more of them.) */ @@ -131,13 +133,15 @@ gen_rtx_CONST_INT (mode, arg) /* Queue PATTERN on LIST_TAIL. */ static void -queue_pattern (pattern, list_tail, lineno) +queue_pattern (pattern, list_tail, filename, lineno) rtx pattern; struct queue_elem ***list_tail; + const char *filename; int lineno; { struct queue_elem *e = (struct queue_elem *) xmalloc (sizeof (*e)); e->data = pattern; + e->filename = filename; e->lineno = lineno; e->next = NULL; **list_tail = e; @@ -248,11 +252,13 @@ process_include (desc, lineno) process_rtx (desc, lineno); } + /* Do not free pathname. It is attached to the various rtx queue + elements. */ + read_rtx_filename = old_filename; read_rtx_lineno = old_lineno; fclose (input_file); - free (pathname); } /* Process a top level rtx in some way, queueing as appropriate. */ @@ -265,15 +271,15 @@ process_rtx (desc, lineno) switch (GET_CODE (desc)) { case DEFINE_INSN: - queue_pattern (desc, &define_insn_tail, lineno); + queue_pattern (desc, &define_insn_tail, read_rtx_filename, lineno); break; case DEFINE_COND_EXEC: - queue_pattern (desc, &define_cond_exec_tail, lineno); + queue_pattern (desc, &define_cond_exec_tail, read_rtx_filename, lineno); break; case DEFINE_ATTR: - queue_pattern (desc, &define_attr_tail, lineno); + queue_pattern (desc, &define_attr_tail, read_rtx_filename, lineno); break; case INCLUDE: @@ -324,13 +330,13 @@ process_rtx (desc, lineno) XVEC (desc, 4) = attr; /* Queue them. */ - queue_pattern (desc, &define_insn_tail, lineno); - queue_pattern (split, &other_tail, lineno); + queue_pattern (desc, &define_insn_tail, read_rtx_filename, lineno); + queue_pattern (split, &other_tail, read_rtx_filename, lineno); break; } default: - queue_pattern (desc, &other_tail, lineno); + queue_pattern (desc, &other_tail, read_rtx_filename, lineno); break; } } @@ -850,7 +856,8 @@ process_one_cond_exec (ce_elem) patterns into the define_insn chain just after their generator is something we'll have to experiment with. */ - queue_pattern (insn, &other_tail, insn_elem->lineno); + queue_pattern (insn, &other_tail, insn_elem->filename, + insn_elem->lineno); } } @@ -1011,6 +1018,7 @@ read_md_rtx (lineno, seqnr) elem = *queue; *queue = elem->next; desc = elem->data; + read_rtx_filename = elem->filename; *lineno = elem->lineno; *seqnr = sequence_num; |