summaryrefslogtreecommitdiff
path: root/gcc/rtl-tests.c
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2016-11-04 17:05:38 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2016-11-04 17:05:38 +0000
commit40af58948573d619b5dfceff3ba5463771a48d50 (patch)
treef0c2a3dd53e078735d3c7fce70972ff6c1f0ac97 /gcc/rtl-tests.c
parentd7d2e7b46753eea479159d23b6451c341f6e8f94 (diff)
downloadgcc-40af58948573d619b5dfceff3ba5463771a48d50.tar.gz
Start adding target-specific selftests
gcc/ChangeLog: * config/i386/i386.c: Include "selftest.h" and "selftest-rtl.h". (selftest::ix86_test_dumping_hard_regs): New function. (selftest::ix86_run_selftests): New function. (TARGET_RUN_TARGET_SELFTESTS): When CHECKING_P, wire this up to selftest::ix86_run_selftests. * doc/tm.texi.in (TARGET_RUN_TARGET_SELFTESTS): New. * doc/tm.texi: Regenerate * selftest-rtl.h: New file. * rtl-tests.c: Include "selftest-rtl.h". (selftest::assert_rtl_dump_eq): Make non-static. (ASSERT_RTL_DUMP_EQ): Move to selftest-rtl.h. (selftest::test_dumping_regs): Update comment. * selftest-run-tests.c: Include "target.h". (selftest::run_tests): If non-NULL, call targetm.run_target_selftests. * target.def (run_target_selftests): New hook. From-SVN: r241851
Diffstat (limited to 'gcc/rtl-tests.c')
-rw-r--r--gcc/rtl-tests.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/gcc/rtl-tests.c b/gcc/rtl-tests.c
index 4e534b2316f..cf5239f92f9 100644
--- a/gcc/rtl-tests.c
+++ b/gcc/rtl-tests.c
@@ -38,6 +38,7 @@ along with GCC; see the file COPYING3. If not see
#include "cfgbuild.h"
#include "print-rtl.h"
#include "selftest.h"
+#include "selftest-rtl.h"
#include "function.h"
#include "memmodel.h"
#include "emit-rtl.h"
@@ -60,7 +61,7 @@ verify_print_pattern (const char *expected, rtx pat)
/* Verify that X is dumped as EXPECTED_DUMP, using compact mode.
Use LOC as the effective location when reporting errors. */
-static void
+void
assert_rtl_dump_eq (const location &loc, const char *expected_dump, rtx x)
{
named_temp_file tmp_out (".rtl");
@@ -74,18 +75,13 @@ assert_rtl_dump_eq (const location &loc, const char *expected_dump, rtx x)
free (dump);
}
-/* Verify that RTX is dumped as EXPECTED_DUMP, using compact mode. */
-
-#define ASSERT_RTL_DUMP_EQ(EXPECTED_DUMP, RTX) \
- assert_rtl_dump_eq (SELFTEST_LOCATION, (EXPECTED_DUMP), (RTX))
-
/* Verify that regs are dumped as expected (in compact mode). */
static void
test_dumping_regs ()
{
/* Dumps of hard regs contain a target-specific name, so we don't test
- it here. */
+ it here; this can be tested in target-specific selftests. */
/* Test dumping of virtual regs. The various virtual regs are inited as
Pmode, so this is target-specific. The tests below assume DImode, so