annotate gcc/selftest-rtl.h @ 128:fe568345ddd5

fix CbC-example
author mir3636
date Wed, 11 Apr 2018 19:32:28 +0900
parents 04ced10e8804
children 84e7813d76e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* A self-testing framework, for use by -fself-test.
kono
parents:
diff changeset
2 Copyright (C) 2016-2017 Free Software Foundation, Inc.
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4 This file is part of GCC.
kono
parents:
diff changeset
5
kono
parents:
diff changeset
6 GCC is free software; you can redistribute it and/or modify it under
kono
parents:
diff changeset
7 the terms of the GNU General Public License as published by the Free
kono
parents:
diff changeset
8 Software Foundation; either version 3, or (at your option) any later
kono
parents:
diff changeset
9 version.
kono
parents:
diff changeset
10
kono
parents:
diff changeset
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
kono
parents:
diff changeset
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
kono
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
kono
parents:
diff changeset
14 for more details.
kono
parents:
diff changeset
15
kono
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
kono
parents:
diff changeset
17 along with GCC; see the file COPYING3. If not see
kono
parents:
diff changeset
18 <http://www.gnu.org/licenses/>. */
kono
parents:
diff changeset
19
kono
parents:
diff changeset
20 #ifndef GCC_SELFTEST_RTL_H
kono
parents:
diff changeset
21 #define GCC_SELFTEST_RTL_H
kono
parents:
diff changeset
22
kono
parents:
diff changeset
23 /* The selftest code should entirely disappear in a production
kono
parents:
diff changeset
24 configuration, hence we guard all of it with #if CHECKING_P. */
kono
parents:
diff changeset
25
kono
parents:
diff changeset
26 #if CHECKING_P
kono
parents:
diff changeset
27
kono
parents:
diff changeset
28 class rtx_reuse_manager;
kono
parents:
diff changeset
29
kono
parents:
diff changeset
30 namespace selftest {
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 /* Verify that X is dumped as EXPECTED_DUMP, using compact mode.
kono
parents:
diff changeset
33 Use LOC as the effective location when reporting errors. */
kono
parents:
diff changeset
34
kono
parents:
diff changeset
35 extern void
kono
parents:
diff changeset
36 assert_rtl_dump_eq (const location &loc, const char *expected_dump, rtx x,
kono
parents:
diff changeset
37 rtx_reuse_manager *reuse_manager);
kono
parents:
diff changeset
38
kono
parents:
diff changeset
39 /* Verify that RTX is dumped as EXPECTED_DUMP, using compact mode. */
kono
parents:
diff changeset
40
kono
parents:
diff changeset
41 #define ASSERT_RTL_DUMP_EQ(EXPECTED_DUMP, RTX) \
kono
parents:
diff changeset
42 assert_rtl_dump_eq (SELFTEST_LOCATION, (EXPECTED_DUMP), (RTX), NULL)
kono
parents:
diff changeset
43
kono
parents:
diff changeset
44 /* As above, but using REUSE_MANAGER when dumping. */
kono
parents:
diff changeset
45
kono
parents:
diff changeset
46 #define ASSERT_RTL_DUMP_EQ_WITH_REUSE(EXPECTED_DUMP, RTX, REUSE_MANAGER) \
kono
parents:
diff changeset
47 assert_rtl_dump_eq (SELFTEST_LOCATION, (EXPECTED_DUMP), (RTX), \
kono
parents:
diff changeset
48 (REUSE_MANAGER))
kono
parents:
diff changeset
49
kono
parents:
diff changeset
50 /* Evaluate rtx EXPECTED and ACTUAL and compare them with ==
kono
parents:
diff changeset
51 (i.e. pointer equality), calling ::selftest::pass if they are
kono
parents:
diff changeset
52 equal, aborting if they are non-equal. */
kono
parents:
diff changeset
53
kono
parents:
diff changeset
54 #define ASSERT_RTX_PTR_EQ(EXPECTED, ACTUAL) \
kono
parents:
diff changeset
55 SELFTEST_BEGIN_STMT \
kono
parents:
diff changeset
56 const char *desc = "ASSERT_RTX_PTR_EQ (" #EXPECTED ", " #ACTUAL ")"; \
kono
parents:
diff changeset
57 ::selftest::assert_rtx_ptr_eq_at (SELFTEST_LOCATION, desc, (EXPECTED), \
kono
parents:
diff changeset
58 (ACTUAL)); \
kono
parents:
diff changeset
59 SELFTEST_END_STMT
kono
parents:
diff changeset
60
kono
parents:
diff changeset
61 /* Compare rtx EXPECTED and ACTUAL by pointer equality, calling
kono
parents:
diff changeset
62 ::selftest::pass if they are equal, aborting if they are non-equal.
kono
parents:
diff changeset
63 LOC is the effective location of the assertion, MSG describes it. */
kono
parents:
diff changeset
64
kono
parents:
diff changeset
65 extern void assert_rtx_ptr_eq_at (const location &loc, const char *msg,
kono
parents:
diff changeset
66 rtx expected, rtx actual);
kono
parents:
diff changeset
67
kono
parents:
diff changeset
68 /* A class for testing RTL function dumps. */
kono
parents:
diff changeset
69
kono
parents:
diff changeset
70 class rtl_dump_test
kono
parents:
diff changeset
71 {
kono
parents:
diff changeset
72 public:
kono
parents:
diff changeset
73 /* Takes ownership of PATH. */
kono
parents:
diff changeset
74 rtl_dump_test (const location &loc, char *path);
kono
parents:
diff changeset
75 ~rtl_dump_test ();
kono
parents:
diff changeset
76
kono
parents:
diff changeset
77 private:
kono
parents:
diff changeset
78 char *m_path;
kono
parents:
diff changeset
79 };
kono
parents:
diff changeset
80
kono
parents:
diff changeset
81 /* Get the insn with the given uid, or NULL if not found. */
kono
parents:
diff changeset
82
kono
parents:
diff changeset
83 extern rtx_insn *get_insn_by_uid (int uid);
kono
parents:
diff changeset
84
kono
parents:
diff changeset
85 extern void verify_three_block_rtl_cfg (function *fun);
kono
parents:
diff changeset
86
kono
parents:
diff changeset
87 } /* end of namespace selftest. */
kono
parents:
diff changeset
88
kono
parents:
diff changeset
89 #endif /* #if CHECKING_P */
kono
parents:
diff changeset
90
kono
parents:
diff changeset
91 #endif /* GCC_SELFTEST_RTL_H */