On 11/11/2016 10:15 PM, David Malcolm wrote:
+static void +aarch64_test_loading_full_dump () +{ + rtl_dump_test t (SELFTEST_LOCATION, locate_file ("aarch64/times-two.rtl")); + + ASSERT_STREQ ("times_two", IDENTIFIER_POINTER (DECL_NAME (cfun->decl))); + + rtx_insn *insn_1 = get_insn_by_uid (1); + ASSERT_EQ (NOTE, GET_CODE (insn_1)); + + rtx_insn *insn_15 = get_insn_by_uid (15); + ASSERT_EQ (INSN, GET_CODE (insn_15)); + ASSERT_EQ (USE, GET_CODE (PATTERN (insn_15))); + + /* Verify crtl->return_rtx. */ + ASSERT_EQ (REG, GET_CODE (crtl->return_rtx)); + ASSERT_EQ (0, REGNO (crtl->return_rtx)); + ASSERT_EQ (SImode, GET_MODE (crtl->return_rtx)); +}
The problem I'm having with this patch, and why I've not really commented on the latter parts of the series, is that I was hoping the tests would be more self-contained. For transformations I had mentioned the idea of having both before and after dumps.
Having a few test files with C code to verify them is probably not a big deal, but I wonder whether this is going to be the norm rather than the exception, and whether there are better ways of doing it. Maybe there needs to be a way of annotating the input RTL to tell the compiler what kinds of tests to run on it.
Bernd