read-md.h (read_rtx_lineno): Rename to...

gcc/
	* read-md.h (read_rtx_lineno): Rename to...
	(read_md_lineno): ...this.
	(read_rtx_filename): Rename to...
	(read_md_filename): ...this.
	(copy_rtx_ptr_loc): Rename to...
	(copy_md_ptr_loc): ...this.
	(print_rtx_ptr_loc): Rename to...
	(print_md_ptr_loc): ...this.
	* read-md.c: Likewise.  Update references after renaming.
	(string_obstack): Replace RTL with MD in comment.
	(set_rtx_ptr_loc): Rename to...
	(set_md_ptr_loc): ...this.
	(get_rtx_ptr_loc): Rename to...
	(get_md_ptr_loc): ...this.
	* genconditions.c: Update references after renaming.
	* genemit.c: Likewise.
	* genoutput.c: Likewise.
	* genpreds.c: Likewise.
	* gensupport.c: Likewise.
	* read-rtl.c: Likewise.

From-SVN: r160571
This commit is contained in:
Richard Sandiford 2010-06-10 20:21:35 +00:00 committed by Richard Sandiford
parent 1069247787
commit d2a3ce4e33
9 changed files with 94 additions and 71 deletions

View File

@ -1,3 +1,26 @@
2010-06-10 Richard Sandiford <rdsandiford@googlemail.com>
* read-md.h (read_rtx_lineno): Rename to...
(read_md_lineno): ...this.
(read_rtx_filename): Rename to...
(read_md_filename): ...this.
(copy_rtx_ptr_loc): Rename to...
(copy_md_ptr_loc): ...this.
(print_rtx_ptr_loc): Rename to...
(print_md_ptr_loc): ...this.
* read-md.c: Likewise. Update references after renaming.
(string_obstack): Replace RTL with MD in comment.
(set_rtx_ptr_loc): Rename to...
(set_md_ptr_loc): ...this.
(get_rtx_ptr_loc): Rename to...
(get_md_ptr_loc): ...this.
* genconditions.c: Update references after renaming.
* genemit.c: Likewise.
* genoutput.c: Likewise.
* genpreds.c: Likewise.
* gensupport.c: Likewise.
* read-rtl.c: Likewise.
2010-06-10 Richard Sandiford <rdsandiford@googlemail.com>
* Makefile.in (READ_MD_H): New variable.

View File

@ -117,7 +117,7 @@ write_one_condition (void **slot, void * ARG_UNUSED (dummy))
const struct c_test *test = * (const struct c_test **) slot;
const char *p;
print_rtx_ptr_loc (test->expr);
print_md_ptr_loc (test->expr);
fputs (" { \"", stdout);
for (p = test->expr; *p; p++)
{

View File

@ -399,7 +399,7 @@ gen_insn (rtx insn, int lineno)
if (XSTR (insn, 0)[0] == 0 || XSTR (insn, 0)[0] == '*')
return;
printf ("/* %s:%d */\n", read_rtx_filename, lineno);
printf ("/* %s:%d */\n", read_md_filename, lineno);
/* Find out how many operands this function has. */
operands = max_operand_vec (insn, 1);
@ -514,7 +514,7 @@ gen_expand (rtx expand)
/* Output the special code to be executed before the sequence
is generated. */
print_rtx_ptr_loc (XSTR (expand, 3));
print_md_ptr_loc (XSTR (expand, 3));
printf ("%s\n", XSTR (expand, 3));
/* Output code to copy the arguments back out of `operands'
@ -643,7 +643,7 @@ gen_split (rtx split)
if (XSTR (split, 3))
{
print_rtx_ptr_loc (XSTR (split, 3));
print_md_ptr_loc (XSTR (split, 3));
printf ("%s\n", XSTR (split, 3));
}
@ -888,17 +888,17 @@ from the machine description file `md'. */\n\n");
break;
case DEFINE_EXPAND:
printf ("/* %s:%d */\n", read_rtx_filename, line_no);
printf ("/* %s:%d */\n", read_md_filename, line_no);
gen_expand (desc);
break;
case DEFINE_SPLIT:
printf ("/* %s:%d */\n", read_rtx_filename, line_no);
printf ("/* %s:%d */\n", read_md_filename, line_no);
gen_split (desc);
break;
case DEFINE_PEEPHOLE2:
printf ("/* %s:%d */\n", read_rtx_filename, line_no);
printf ("/* %s:%d */\n", read_md_filename, line_no);
gen_split (desc);
break;

View File

@ -673,7 +673,7 @@ process_template (struct data *d, const char *template_code)
printf ("output_%d (rtx *operands ATTRIBUTE_UNUSED, rtx insn ATTRIBUTE_UNUSED)\n",
d->code_number);
puts ("{");
print_rtx_ptr_loc (template_code);
print_md_ptr_loc (template_code);
puts (template_code + 1);
puts ("}");
}
@ -861,7 +861,7 @@ gen_insn (rtx insn, int lineno)
d->code_number = next_code_number;
d->index_number = next_index_number;
d->filename = read_rtx_filename;
d->filename = read_md_filename;
d->lineno = lineno;
if (XSTR (insn, 0)[0])
d->name = XSTR (insn, 0);
@ -906,7 +906,7 @@ gen_peephole (rtx peep, int lineno)
d->code_number = next_code_number;
d->index_number = next_index_number;
d->filename = read_rtx_filename;
d->filename = read_md_filename;
d->lineno = lineno;
d->name = 0;
@ -945,7 +945,7 @@ gen_expand (rtx insn, int lineno)
d->code_number = next_code_number;
d->index_number = next_index_number;
d->filename = read_rtx_filename;
d->filename = read_md_filename;
d->lineno = lineno;
if (XSTR (insn, 0)[0])
d->name = XSTR (insn, 0);
@ -990,7 +990,7 @@ gen_split (rtx split, int lineno)
d->code_number = next_code_number;
d->index_number = next_index_number;
d->filename = read_rtx_filename;
d->filename = read_md_filename;
d->lineno = lineno;
d->name = 0;

View File

@ -184,7 +184,7 @@ write_predicate_subfunction (struct pred_data *p)
printf ("static inline int\n"
"%s_1 (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)\n",
p->name);
print_rtx_ptr_loc (p->c_block);
print_md_ptr_loc (p->c_block);
if (p->c_block[0] == '{')
fputs (p->c_block, stdout);
else

View File

@ -230,11 +230,11 @@ process_include (rtx desc, int lineno)
/* Save old cursor; setup new for the new file. Note that "lineno" the
argument to this function is the beginning of the include statement,
while read_rtx_lineno has already been advanced. */
old_filename = read_rtx_filename;
old_lineno = read_rtx_lineno;
read_rtx_filename = pathname;
read_rtx_lineno = 1;
while read_md_lineno has already been advanced. */
old_filename = read_md_filename;
old_lineno = read_md_lineno;
read_md_filename = pathname;
read_md_lineno = 1;
if (include_callback)
include_callback (pathname);
@ -246,8 +246,8 @@ process_include (rtx desc, int lineno)
/* Do not free pathname. It is attached to the various rtx queue
elements. */
read_rtx_filename = old_filename;
read_rtx_lineno = old_lineno;
read_md_filename = old_filename;
read_md_lineno = old_lineno;
fclose (input_file);
}
@ -260,15 +260,15 @@ process_rtx (rtx desc, int lineno)
switch (GET_CODE (desc))
{
case DEFINE_INSN:
queue_pattern (desc, &define_insn_tail, read_rtx_filename, lineno);
queue_pattern (desc, &define_insn_tail, read_md_filename, lineno);
break;
case DEFINE_COND_EXEC:
queue_pattern (desc, &define_cond_exec_tail, read_rtx_filename, lineno);
queue_pattern (desc, &define_cond_exec_tail, read_md_filename, lineno);
break;
case DEFINE_ATTR:
queue_pattern (desc, &define_attr_tail, read_rtx_filename, lineno);
queue_pattern (desc, &define_attr_tail, read_md_filename, lineno);
break;
case DEFINE_PREDICATE:
@ -277,7 +277,7 @@ process_rtx (rtx desc, int lineno)
case DEFINE_REGISTER_CONSTRAINT:
case DEFINE_MEMORY_CONSTRAINT:
case DEFINE_ADDRESS_CONSTRAINT:
queue_pattern (desc, &define_pred_tail, read_rtx_filename, lineno);
queue_pattern (desc, &define_pred_tail, read_md_filename, lineno);
break;
case INCLUDE:
@ -309,7 +309,7 @@ process_rtx (rtx desc, int lineno)
split_cond = XSTR (desc, 4);
if (split_cond[0] == '&' && split_cond[1] == '&')
{
copy_rtx_ptr_loc (split_cond + 2, split_cond);
copy_md_ptr_loc (split_cond + 2, split_cond);
split_cond = join_c_conditions (XSTR (desc, 2), split_cond + 2);
}
XSTR (split, 1) = split_cond;
@ -323,16 +323,16 @@ process_rtx (rtx desc, int lineno)
/* Queue them. */
insn_elem
= queue_pattern (desc, &define_insn_tail, read_rtx_filename,
= queue_pattern (desc, &define_insn_tail, read_md_filename,
lineno);
split_elem
= queue_pattern (split, &other_tail, read_rtx_filename, lineno);
= queue_pattern (split, &other_tail, read_md_filename, lineno);
insn_elem->split = split_elem;
break;
}
default:
queue_pattern (desc, &other_tail, read_rtx_filename, lineno);
queue_pattern (desc, &other_tail, read_md_filename, lineno);
break;
}
}
@ -865,7 +865,7 @@ process_one_cond_exec (struct queue_elem *ce_elem)
XVECEXP (split, 2, i) = pattern;
}
/* Add the new split to the queue. */
queue_pattern (split, &other_tail, read_rtx_filename,
queue_pattern (split, &other_tail, read_md_filename,
insn_elem->split->lineno);
}
}
@ -988,8 +988,8 @@ init_md_reader_args_cb (int argc, char **argv, bool (*parse_opt)(const char *))
fatal ("cannot read standard input twice");
base_dir = NULL;
read_rtx_filename = in_fname = "<stdin>";
read_rtx_lineno = 1;
read_md_filename = in_fname = "<stdin>";
read_md_lineno = 1;
input_file = stdin;
already_read_stdin = true;
@ -1018,8 +1018,8 @@ init_md_reader_args_cb (int argc, char **argv, bool (*parse_opt)(const char *))
else
base_dir = NULL;
read_rtx_filename = in_fname;
read_rtx_lineno = 1;
read_md_filename = in_fname;
read_md_lineno = 1;
input_file = fopen (in_fname, "r");
if (input_file == 0)
{
@ -1037,8 +1037,8 @@ init_md_reader_args_cb (int argc, char **argv, bool (*parse_opt)(const char *))
if (!in_fname)
{
base_dir = NULL;
read_rtx_filename = in_fname = "<stdin>";
read_rtx_lineno = 1;
read_md_filename = in_fname = "<stdin>";
read_md_lineno = 1;
input_file = stdin;
while (read_rtx (input_file, &desc, &lineno))
@ -1086,7 +1086,7 @@ read_md_rtx (int *lineno, int *seqnr)
elem = *queue;
*queue = elem->next;
desc = elem->data;
read_rtx_filename = elem->filename;
read_md_filename = elem->filename;
*lineno = elem->lineno;
*seqnr = sequence_num;

View File

@ -33,7 +33,7 @@ struct ptr_loc {
int lineno;
};
/* Obstack used for allocating RTL strings. */
/* Obstack used for allocating MD strings. */
struct obstack string_obstack;
/* A table of ptr_locs, hashed on the PTR field. */
@ -45,7 +45,7 @@ static struct obstack ptr_loc_obstack;
/* A hash table of triples (A, B, C), where each of A, B and C is a condition
and A is equivalent to "B && C". This is used to keep track of the source
of conditions that are made up of separate rtx strings (such as the split
of conditions that are made up of separate MD strings (such as the split
condition of a define_insn_and_split). */
static htab_t joined_conditions;
@ -53,10 +53,10 @@ static htab_t joined_conditions;
static struct obstack joined_conditions_obstack;
/* The current line number for the file. */
int read_rtx_lineno = 1;
int read_md_lineno = 1;
/* The filename for error reporting. */
const char *read_rtx_filename = "<unknown>";
const char *read_md_filename = "<unknown>";
/* Return a hash value for the pointer pointed to by DEF. */
@ -77,7 +77,7 @@ leading_ptr_eq_p (const void *def1, const void *def2)
/* Associate PTR with the file position given by FILENAME and LINENO. */
static void
set_rtx_ptr_loc (const void *ptr, const char *filename, int lineno)
set_md_ptr_loc (const void *ptr, const char *filename, int lineno)
{
struct ptr_loc *loc;
@ -93,7 +93,7 @@ set_rtx_ptr_loc (const void *ptr, const char *filename, int lineno)
position was set. */
static const struct ptr_loc *
get_rtx_ptr_loc (const void *ptr)
get_md_ptr_loc (const void *ptr)
{
return (const struct ptr_loc *) htab_find (ptr_locs, &ptr);
}
@ -101,20 +101,20 @@ get_rtx_ptr_loc (const void *ptr)
/* Associate NEW_PTR with the same file position as OLD_PTR. */
void
copy_rtx_ptr_loc (const void *new_ptr, const void *old_ptr)
copy_md_ptr_loc (const void *new_ptr, const void *old_ptr)
{
const struct ptr_loc *loc = get_rtx_ptr_loc (old_ptr);
const struct ptr_loc *loc = get_md_ptr_loc (old_ptr);
if (loc != 0)
set_rtx_ptr_loc (new_ptr, loc->filename, loc->lineno);
set_md_ptr_loc (new_ptr, loc->filename, loc->lineno);
}
/* If PTR is associated with a known file position, print a #line
directive for it. */
void
print_rtx_ptr_loc (const void *ptr)
print_md_ptr_loc (const void *ptr)
{
const struct ptr_loc *loc = get_rtx_ptr_loc (ptr);
const struct ptr_loc *loc = get_md_ptr_loc (ptr);
if (loc != 0)
printf ("#line %d \"%s\"\n", loc->lineno, loc->filename);
}
@ -166,7 +166,7 @@ print_c_condition (const char *cond)
else
{
putc ('\n', stdout);
print_rtx_ptr_loc (cond);
print_md_ptr_loc (cond);
printf ("(%s)", cond);
}
}
@ -181,7 +181,7 @@ message_with_line (int lineno, const char *msg, ...)
va_start (ap, msg);
fprintf (stderr, "%s:%d: ", read_rtx_filename, lineno);
fprintf (stderr, "%s:%d: ", read_md_filename, lineno);
vfprintf (stderr, msg, ap);
fputc ('\n', stderr);
@ -201,7 +201,7 @@ fatal_with_file_and_line (FILE *infile, const char *msg, ...)
va_start (ap, msg);
fprintf (stderr, "%s:%d: ", read_rtx_filename, read_rtx_lineno);
fprintf (stderr, "%s:%d: ", read_md_filename, read_md_lineno);
vfprintf (stderr, msg, ap);
putc ('\n', stderr);
@ -218,7 +218,7 @@ fatal_with_file_and_line (FILE *infile, const char *msg, ...)
context[i] = '\0';
fprintf (stderr, "%s:%d: following context is `%s'\n",
read_rtx_filename, read_rtx_lineno, context);
read_md_filename, read_md_lineno, context);
va_end (ap);
exit (1);
@ -253,7 +253,7 @@ read_skip_spaces (FILE *infile)
switch (c)
{
case '\n':
read_rtx_lineno++;
read_md_lineno++;
break;
case ' ': case '\t': case '\f': case '\r':
@ -263,7 +263,7 @@ read_skip_spaces (FILE *infile)
do
c = getc (infile);
while (c != '\n' && c != EOF);
read_rtx_lineno++;
read_md_lineno++;
break;
case '/':
@ -277,7 +277,7 @@ read_skip_spaces (FILE *infile)
while ((c = getc (infile)) && c != EOF)
{
if (c == '\n')
read_rtx_lineno++;
read_md_lineno++;
else if (prevc == '*' && c == '/')
break;
prevc = c;
@ -303,7 +303,7 @@ read_escape (FILE *infile)
{
/* Backslash-newline is replaced by nothing, as in C. */
case '\n':
read_rtx_lineno++;
read_md_lineno++;
return;
/* \" \' \\ are replaced by the second character. */
@ -336,7 +336,7 @@ read_escape (FILE *infile)
/* pass anything else through, but issue a warning. */
default:
fprintf (stderr, "%s:%d: warning: unrecognized escape \\%c\n",
read_rtx_filename, read_rtx_lineno, c);
read_md_filename, read_md_lineno, c);
obstack_1grow (&string_obstack, '\\');
break;
}
@ -356,7 +356,7 @@ read_quoted_string (FILE *infile)
{
c = getc (infile); /* Read the string */
if (c == '\n')
read_rtx_lineno++;
read_md_lineno++;
else if (c == '\\')
{
read_escape (infile);
@ -381,7 +381,7 @@ read_braced_string (FILE *infile)
{
int c;
int brace_depth = 1; /* caller-processed */
unsigned long starting_read_rtx_lineno = read_rtx_lineno;
unsigned long starting_read_md_lineno = read_md_lineno;
obstack_1grow (&string_obstack, '{');
while (brace_depth)
@ -389,7 +389,7 @@ read_braced_string (FILE *infile)
c = getc (infile); /* Read the string */
if (c == '\n')
read_rtx_lineno++;
read_md_lineno++;
else if (c == '{')
brace_depth++;
else if (c == '}')
@ -402,7 +402,7 @@ read_braced_string (FILE *infile)
else if (c == EOF)
fatal_with_file_and_line
(infile, "missing closing } for opening brace on line %lu",
starting_read_rtx_lineno);
starting_read_md_lineno);
obstack_1grow (&string_obstack, c);
}
@ -429,7 +429,7 @@ read_string (FILE *infile, int star_if_braced)
c = read_skip_spaces (infile);
}
old_lineno = read_rtx_lineno;
old_lineno = read_md_lineno;
if (c == '"')
stringbuf = read_quoted_string (infile);
else if (c == '{')
@ -448,7 +448,7 @@ read_string (FILE *infile, int star_if_braced)
fatal_expected_char (infile, ')', c);
}
set_rtx_ptr_loc (stringbuf, read_rtx_filename, old_lineno);
set_md_ptr_loc (stringbuf, read_md_filename, old_lineno);
return stringbuf;
}

View File

@ -21,12 +21,12 @@ along with GCC; see the file COPYING3. If not see
#include "obstack.h"
extern int read_rtx_lineno;
extern const char *read_rtx_filename;
extern int read_md_lineno;
extern const char *read_md_filename;
extern struct obstack string_obstack;
extern void copy_rtx_ptr_loc (const void *, const void *);
extern void print_rtx_ptr_loc (const void *);
extern void copy_md_ptr_loc (const void *, const void *);
extern void print_md_ptr_loc (const void *);
extern const char *join_c_conditions (const char *, const char *);
extern void print_c_condition (const char *);
extern void message_with_line (int, const char *, ...) ATTRIBUTE_PRINTF_2;

View File

@ -319,7 +319,7 @@ apply_iterator_to_string (const char *string, struct mapping *iterator, int valu
{
obstack_grow (&string_obstack, base, strlen (base) + 1);
copy = XOBFINISH (&string_obstack, char *);
copy_rtx_ptr_loc (copy, string);
copy_md_ptr_loc (copy, string);
return copy;
}
return string;
@ -647,7 +647,7 @@ read_name (char *str, FILE *infile)
if (p == str)
fatal_with_file_and_line (infile, "missing name or number");
if (c == '\n')
read_rtx_lineno++;
read_md_lineno++;
*p = 0;
@ -999,7 +999,7 @@ read_rtx (FILE *infile, rtx *x, int *lineno)
return false;
ungetc (c, infile);
queue_lineno = read_rtx_lineno;
queue_lineno = read_md_lineno;
mode_maps = 0;
from_file = read_rtx_1 (infile, &mode_maps);
if (from_file == 0)
@ -1229,14 +1229,14 @@ read_rtx_1 (FILE *infile, struct map_value **mode_maps)
|| GET_CODE (return_rtx) == DEFINE_INSN_AND_SPLIT))
{
char line_name[20];
const char *fn = (read_rtx_filename ? read_rtx_filename : "rtx");
const char *fn = (read_md_filename ? read_md_filename : "rtx");
const char *slash;
for (slash = fn; *slash; slash ++)
if (*slash == '/' || *slash == '\\' || *slash == ':')
fn = slash + 1;
obstack_1grow (&string_obstack, '*');
obstack_grow (&string_obstack, fn, strlen (fn));
sprintf (line_name, ":%d", read_rtx_lineno);
sprintf (line_name, ":%d", read_md_lineno);
obstack_grow (&string_obstack, line_name, strlen (line_name)+1);
stringbuf = XOBFINISH (&string_obstack, char *);
}