diff options
author | Matthew Malcomson <matthew.malcomson@arm.com> | 2019-11-15 14:18:14 +0000 |
---|---|---|
committer | Matthew Malcomson <matmal01@gcc.gnu.org> | 2019-11-15 14:18:14 +0000 |
commit | 63841daf70b8f5d9ab3014956ea2c0f22488660e (patch) | |
tree | ca26305073ac7b9b715b37dc248ac9891b6034b1 /gcc/read-rtl-function.c | |
parent | b9f71c51cd578c6ab6ad2986edb80ba48aa477bc (diff) | |
download | gcc-63841daf70b8f5d9ab3014956ea2c0f22488660e.zip gcc-63841daf70b8f5d9ab3014956ea2c0f22488660e.tar.gz gcc-63841daf70b8f5d9ab3014956ea2c0f22488660e.tar.bz2 |
[mid-end][__RTL] Account for column numbers in __RTL functions
The documentation for __RTL tests (see "(gccint) RTL Tests" info node) has the
following snippet.
```
The parser expects the RTL body to be in the format emitted by this
dumping function:
DEBUG_FUNCTION void
print_rtx_function (FILE *outfile, function *fn, bool compact);
when "compact" is true. So you can capture RTL in the correct format
from the debugger using:
(gdb) print_rtx_function (stderr, cfun, true);
and copy and paste the output into the body of the C function.
```
Since r264944 print_rtx_function prints column number information, which the
__RTL function parsing does not handle.
This patch handles column number information optionally, so pre-existing __RTL
functions still work, and the above documentation quote still holds.
Note: If people would prefer to require column information I could make a
slightly neater code and update existing tests.
I guess this would be OK since the intended use for __RTL functions is in these
testcases so there is no worry about other existing code.
bootstrapped and regtested on aarch64
bootstrapped and regtested on x86_64
Ok for trunk?
Cheers,
Matthew
gcc/ChangeLog:
2019-11-15 Matthew Malcomson <matthew.malcomson@arm.com>
* read-rtl-function.c
(function_reader::add_fixup_source_location): Take additional
parameter of a column.
(function_reader::maybe_read_location): Optionally parse column
information and pass to add_fixup_source_location.
gcc/testsuite/ChangeLog:
2019-11-15 Matthew Malcomson <matthew.malcomson@arm.com>
* gcc.dg/rtl/aarch64/rtl-handle-column-numbers.c: New test.
From-SVN: r278294
Diffstat (limited to 'gcc/read-rtl-function.c')
-rw-r--r-- | gcc/read-rtl-function.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/gcc/read-rtl-function.c b/gcc/read-rtl-function.c index b87ea30..47dc66e 100644 --- a/gcc/read-rtl-function.c +++ b/gcc/read-rtl-function.c @@ -115,7 +115,7 @@ class function_reader : public rtx_reader int operand_idx, int bb_idx); void add_fixup_source_location (file_location loc, rtx_insn *insn, - const char *filename, int lineno); + const char *filename, int lineno, int colno); void add_fixup_expr (file_location loc, rtx x, const char *desc); @@ -1371,7 +1371,7 @@ function_reader::add_fixup_note_insn_basic_block (file_location loc, rtx insn, void function_reader::add_fixup_source_location (file_location, rtx_insn *, - const char *, int) + const char *, int, int) { } @@ -1557,7 +1557,20 @@ function_reader::maybe_read_location (rtx_insn *insn) require_char (':'); struct md_name line_num; read_name (&line_num); - add_fixup_source_location (loc, insn, filename, atoi (line_num.string)); + + int column = 0; + int ch = read_char (); + if (ch == ':') + { + struct md_name column_num; + read_name (&column_num); + column = atoi (column_num.string); + } + else + unread_char (ch); + add_fixup_source_location (loc, insn, filename, + atoi (line_num.string), + column); } else unread_char (ch); |