From 38dcfe5de49fbc500b4f0d729a1a51e936c22abf Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Thu, 7 Apr 2016 06:52:53 -0400 Subject: [PATCH 26/91] FIXME: make read_name return start location --- gcc/read-md.c | 16 +++++++++++----- gcc/read-md.h | 6 +++--- gcc/read-rtl.c | 3 +-- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/gcc/read-md.c b/gcc/read-md.c index f5722ee..2943c52 100644 --- a/gcc/read-md.c +++ b/gcc/read-md.c @@ -416,7 +416,7 @@ read_skip_spaces (void) punctuation chars of rtx printed syntax. */ static bool -read_name_1 (struct md_name *name) +read_name_1 (struct md_name *name, file_location *out_loc) { int c; size_t i; @@ -424,6 +424,8 @@ read_name_1 (struct md_name *name) c = read_skip_spaces (); + *out_loc = rtx_reader_ptr->get_current_location (); + i = 0; angle_bracket_depth = 0; while (1) @@ -483,17 +485,20 @@ read_name_1 (struct md_name *name) /* Read an rtx code name into NAME. It is terminated by any of the punctuation chars of rtx printed syntax. */ -void +file_location read_name (struct md_name *name) { - if (!read_name_1 (name)) + file_location loc; + if (!read_name_1 (name, &loc)) fatal_with_file_and_line ("missing name or number"); + return loc; } -void +file_location read_name_or_nil (struct md_name *name) { - if (!read_name_1 (name)) + file_location loc; + if (!read_name_1 (name, &loc)) { file_location loc = rtx_reader_ptr->get_current_location (); read_skip_construct (0, loc); @@ -502,6 +507,7 @@ read_name_or_nil (struct md_name *name) name->buffer[0] = 0; name->string = name->buffer; } + return loc; } /* Subroutine of the string readers. Handles backslash escapes. diff --git a/gcc/read-md.h b/gcc/read-md.h index 31e6f05..3a5d2b9 100644 --- a/gcc/read-md.h +++ b/gcc/read-md.h @@ -140,7 +140,7 @@ read_char (void) if (ch == '\n') { read_md_lineno++; - read_md_colno = 1; + read_md_colno = 0; } else read_md_colno++; @@ -179,8 +179,8 @@ extern void fatal_with_file_and_line (const char *, ...) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN; extern void fatal_expected_char (int, int) ATTRIBUTE_NORETURN; extern int read_skip_spaces (void); -extern void read_name (struct md_name *); -extern void read_name_or_nil (struct md_name *); +extern file_location read_name (struct md_name *); +extern file_location read_name_or_nil (struct md_name *); extern char *read_quoted_string (void); extern char *read_string (int); extern int n_comma_elts (const char *); diff --git a/gcc/read-rtl.c b/gcc/read-rtl.c index 68994b3..cee03ee 100644 --- a/gcc/read-rtl.c +++ b/gcc/read-rtl.c @@ -1321,8 +1321,7 @@ read_rtx_code (const char *code_name) /* The RTL file recorded the ID of an insn (or 0 for NULL); we must store this as a pointer, but the insn might not have been loaded yet. Store the ID away for now. */ - file_location loc = rtx_reader_ptr->get_current_location (); - read_name (&name); + file_location loc = read_name (&name); int insn_id = atoi (name.string); if (insn_id) { -- 1.8.5.3