+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.
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++)
{
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);
/* 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'
if (XSTR (split, 3))
{
- print_rtx_ptr_loc (XSTR (split, 3));
+ print_md_ptr_loc (XSTR (split, 3));
printf ("%s\n", XSTR (split, 3));
}
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;
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 ("}");
}
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);
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;
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);
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;
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
/* 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);
/* 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);
}
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:
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:
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;
/* 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;
}
}
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);
}
}
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;
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)
{
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))
elem = *queue;
*queue = elem->next;
desc = elem->data;
- read_rtx_filename = elem->filename;
+ read_md_filename = elem->filename;
*lineno = elem->lineno;
*seqnr = sequence_num;
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. */
/* 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;
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. */
/* 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;
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);
}
/* 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);
}
else
{
putc ('\n', stdout);
- print_rtx_ptr_loc (cond);
+ print_md_ptr_loc (cond);
printf ("(%s)", cond);
}
}
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);
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);
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);
switch (c)
{
case '\n':
- read_rtx_lineno++;
+ read_md_lineno++;
break;
case ' ': case '\t': case '\f': case '\r':
do
c = getc (infile);
while (c != '\n' && c != EOF);
- read_rtx_lineno++;
+ read_md_lineno++;
break;
case '/':
while ((c = getc (infile)) && c != EOF)
{
if (c == '\n')
- read_rtx_lineno++;
+ read_md_lineno++;
else if (prevc == '*' && c == '/')
break;
prevc = c;
{
/* Backslash-newline is replaced by nothing, as in C. */
case '\n':
- read_rtx_lineno++;
+ read_md_lineno++;
return;
/* \" \' \\ are replaced by the second character. */
/* 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;
}
{
c = getc (infile); /* Read the string */
if (c == '\n')
- read_rtx_lineno++;
+ read_md_lineno++;
else if (c == '\\')
{
read_escape (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)
c = getc (infile); /* Read the string */
if (c == '\n')
- read_rtx_lineno++;
+ read_md_lineno++;
else if (c == '{')
brace_depth++;
else if (c == '}')
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);
}
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 == '{')
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;
}
#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;
{
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;
if (p == str)
fatal_with_file_and_line (infile, "missing name or number");
if (c == '\n')
- read_rtx_lineno++;
+ read_md_lineno++;
*p = 0;
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)
|| 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 *);
}