From f2aabfb65e14f0d3f8bcac15ba874ce81b204148 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Tue, 22 Mar 2016 18:59:58 -0400 Subject: [PATCH 008/117] FIXME: enough hacks to read the first note insn in the test --- gcc/read-rtl.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/gcc/read-rtl.c b/gcc/read-rtl.c index 46bd8e1..7549a91 100644 --- a/gcc/read-rtl.c +++ b/gcc/read-rtl.c @@ -1119,6 +1119,18 @@ one_time_initialization (void) } } +#ifndef GENERATOR_FILE +static int +parse_note_insn_name (const char *string) +{ + for (int i = 0; i < NOTE_INSN_MAX; i++) + if (0 == strcmp (string, GET_NOTE_INSN_NAME (i))) + return i; + fatal_with_file_and_line ("unrecognized NOTE_INSN name: `%s'", string); +} +#endif /* #ifndef GENERATOR_FILE */ + + /* Subroutine of read_rtx and read_nested_rtx. CODE_NAME is the name of either an rtx code or a code iterator. Parse the rest of the rtx and return it. */ @@ -1191,8 +1203,24 @@ read_rtx_code (const char *code_name) break; case 'e': + XEXP (return_rtx, i) = read_nested_rtx (); + break; + case 'u': +#ifdef GENERATOR_FILE XEXP (return_rtx, i) = read_nested_rtx (); +#else + { + /* The RTL file recorded the ID of an insn; we must store this + as a pointer, but the insn might not have been loaded yet. + Store this away for now. */ + read_name (&name); + int insn_id = atoi (name.string); + fprintf (stderr, + "FIXME: would store insn %i into field %i of %s %p\n", + insn_id, i, code_name, (void *)return_rtx); + } +#endif break; case 'V': @@ -1350,10 +1378,40 @@ read_rtx_code (const char *code_name) case 'i': case 'n': +#ifdef GENERATOR_FILE /* Can be an iterator or an integer constant. */ read_name (&name); record_potential_iterator_use (&ints, &XINT (return_rtx, i), name.string); +#else + + { + // FIXME: print_rtx only writes out operand 5 for notes if: + /* if (NOTE_KIND (in_rtx) == NOTE_INSN_DELETED_LABEL + || NOTE_KIND (in_rtx) == NOTE_INSN_DELETED_DEBUG_LABEL) + */ + if (i == 5 && NOTE_P (return_rtx)) + break; + + read_name (&name); + int value; + if (format_ptr[i] == 'n') + value = parse_note_insn_name (name.string); + // generated by: + // fprintf (outfile, " %s", GET_NOTE_INSN_NAME (XINT (in_rtx, i))); + else + value = atoi (name.string); + XINT (return_rtx, i) = value; + } +#endif + break; + + case 'B': + { + read_name (&name); + fprintf (stderr, "FIXME: do something with basic block ID: %s\n", + name.string); + } break; case 'r': -- 1.8.5.3