Commit 821e35ba by Richard Henderson

genemit.c (gen_insn): Print file:lineno comment before function.

        * 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.

From-SVN: r53811
parent 0f1ffa23
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> 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> 2002-05-23 Richard Henderson <rth@redhat.com>
......
...@@ -59,7 +59,7 @@ static void max_operand_1 PARAMS ((rtx)); ...@@ -59,7 +59,7 @@ static void max_operand_1 PARAMS ((rtx));
static int max_operand_vec PARAMS ((rtx, int)); static int max_operand_vec PARAMS ((rtx, int));
static void print_code PARAMS ((RTX_CODE)); static void print_code PARAMS ((RTX_CODE));
static void gen_exp PARAMS ((rtx, enum rtx_code, char *)); 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_expand PARAMS ((rtx));
static void gen_split PARAMS ((rtx)); static void gen_split PARAMS ((rtx));
static void output_add_clobbers PARAMS ((void)); static void output_add_clobbers PARAMS ((void));
...@@ -297,8 +297,9 @@ gen_exp (x, subroutine_type, used) ...@@ -297,8 +297,9 @@ gen_exp (x, subroutine_type, used)
/* Generate the `gen_...' function for a DEFINE_INSN. */ /* Generate the `gen_...' function for a DEFINE_INSN. */
static void static void
gen_insn (insn) gen_insn (insn, lineno)
rtx insn; rtx insn;
int lineno;
{ {
int operands; int operands;
int i; int i;
...@@ -383,6 +384,8 @@ gen_insn (insn) ...@@ -383,6 +384,8 @@ gen_insn (insn)
if (XSTR (insn, 0)[0] == 0 || XSTR (insn, 0)[0] == '*') if (XSTR (insn, 0)[0] == 0 || XSTR (insn, 0)[0] == '*')
return; return;
printf ("/* %s:%d */\n", read_rtx_filename, lineno);
/* Find out how many operands this function has, /* Find out how many operands this function has,
and also whether any of them have register constraints. */ and also whether any of them have register constraints. */
register_constraints = 0; register_constraints = 0;
...@@ -838,7 +841,7 @@ from the machine description file `md'. */\n\n"); ...@@ -838,7 +841,7 @@ from the machine description file `md'. */\n\n");
printf ("#include \"toplev.h\"\n"); printf ("#include \"toplev.h\"\n");
printf ("#include \"ggc.h\"\n\n"); printf ("#include \"ggc.h\"\n\n");
printf ("#define FAIL return (end_sequence (), _val)\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. */ /* Read the machine description. */
...@@ -852,25 +855,28 @@ from the machine description file `md'. */\n\n"); ...@@ -852,25 +855,28 @@ from the machine description file `md'. */\n\n");
switch (GET_CODE (desc)) switch (GET_CODE (desc))
{ {
case DEFINE_INSN: case DEFINE_INSN:
gen_insn (desc); gen_insn (desc, line_no);
break; break;
case DEFINE_EXPAND: case DEFINE_EXPAND:
gen_expand (desc); printf ("/* %s:%d */\n", read_rtx_filename, line_no);
break; gen_expand (desc);
break;
case DEFINE_SPLIT:
gen_split (desc); case DEFINE_SPLIT:
break; printf ("/* %s:%d */\n", read_rtx_filename, line_no);
gen_split (desc);
case DEFINE_PEEPHOLE2: break;
gen_split (desc);
break; case DEFINE_PEEPHOLE2:
printf ("/* %s:%d */\n", read_rtx_filename, line_no);
default: gen_split (desc);
break; break;
}
default:
break;
}
++insn_index_number; ++insn_index_number;
} }
......
...@@ -50,6 +50,7 @@ static char *base_dir = NULL; ...@@ -50,6 +50,7 @@ static char *base_dir = NULL;
struct queue_elem struct queue_elem
{ {
rtx data; rtx data;
const char *filename;
int lineno; int lineno;
struct queue_elem *next; struct queue_elem *next;
}; };
...@@ -63,7 +64,8 @@ static struct queue_elem **define_cond_exec_tail = &define_cond_exec_queue; ...@@ -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_queue;
static struct queue_elem **other_tail = &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 /* Current maximum length of directory names in the search path
for include files. (Altered as we get more of them.) */ for include files. (Altered as we get more of them.) */
...@@ -131,13 +133,15 @@ gen_rtx_CONST_INT (mode, arg) ...@@ -131,13 +133,15 @@ gen_rtx_CONST_INT (mode, arg)
/* Queue PATTERN on LIST_TAIL. */ /* Queue PATTERN on LIST_TAIL. */
static void static void
queue_pattern (pattern, list_tail, lineno) queue_pattern (pattern, list_tail, filename, lineno)
rtx pattern; rtx pattern;
struct queue_elem ***list_tail; struct queue_elem ***list_tail;
const char *filename;
int lineno; int lineno;
{ {
struct queue_elem *e = (struct queue_elem *) xmalloc (sizeof (*e)); struct queue_elem *e = (struct queue_elem *) xmalloc (sizeof (*e));
e->data = pattern; e->data = pattern;
e->filename = filename;
e->lineno = lineno; e->lineno = lineno;
e->next = NULL; e->next = NULL;
**list_tail = e; **list_tail = e;
...@@ -248,11 +252,13 @@ process_include (desc, lineno) ...@@ -248,11 +252,13 @@ process_include (desc, lineno)
process_rtx (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_filename = old_filename;
read_rtx_lineno = old_lineno; read_rtx_lineno = old_lineno;
fclose (input_file); fclose (input_file);
free (pathname);
} }
/* Process a top level rtx in some way, queueing as appropriate. */ /* Process a top level rtx in some way, queueing as appropriate. */
...@@ -265,15 +271,15 @@ process_rtx (desc, lineno) ...@@ -265,15 +271,15 @@ process_rtx (desc, lineno)
switch (GET_CODE (desc)) switch (GET_CODE (desc))
{ {
case DEFINE_INSN: case DEFINE_INSN:
queue_pattern (desc, &define_insn_tail, lineno); queue_pattern (desc, &define_insn_tail, read_rtx_filename, lineno);
break; break;
case DEFINE_COND_EXEC: case DEFINE_COND_EXEC:
queue_pattern (desc, &define_cond_exec_tail, lineno); queue_pattern (desc, &define_cond_exec_tail, read_rtx_filename, lineno);
break; break;
case DEFINE_ATTR: case DEFINE_ATTR:
queue_pattern (desc, &define_attr_tail, lineno); queue_pattern (desc, &define_attr_tail, read_rtx_filename, lineno);
break; break;
case INCLUDE: case INCLUDE:
...@@ -324,13 +330,13 @@ process_rtx (desc, lineno) ...@@ -324,13 +330,13 @@ process_rtx (desc, lineno)
XVEC (desc, 4) = attr; XVEC (desc, 4) = attr;
/* Queue them. */ /* Queue them. */
queue_pattern (desc, &define_insn_tail, lineno); queue_pattern (desc, &define_insn_tail, read_rtx_filename, lineno);
queue_pattern (split, &other_tail, lineno); queue_pattern (split, &other_tail, read_rtx_filename, lineno);
break; break;
} }
default: default:
queue_pattern (desc, &other_tail, lineno); queue_pattern (desc, &other_tail, read_rtx_filename, lineno);
break; break;
} }
} }
...@@ -850,7 +856,8 @@ process_one_cond_exec (ce_elem) ...@@ -850,7 +856,8 @@ process_one_cond_exec (ce_elem)
patterns into the define_insn chain just after their generator patterns into the define_insn chain just after their generator
is something we'll have to experiment with. */ 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) ...@@ -1011,6 +1018,7 @@ read_md_rtx (lineno, seqnr)
elem = *queue; elem = *queue;
*queue = elem->next; *queue = elem->next;
desc = elem->data; desc = elem->data;
read_rtx_filename = elem->filename;
*lineno = elem->lineno; *lineno = elem->lineno;
*seqnr = sequence_num; *seqnr = sequence_num;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment