1 | // is_a<> support for RTL SSA classes -*- C++ -*- |
---|---|
2 | // Copyright (C) 2020-2024 Free Software Foundation, Inc. |
3 | // |
4 | // This file is part of GCC. |
5 | // |
6 | // GCC is free software; you can redistribute it and/or modify it under |
7 | // the terms of the GNU General Public License as published by the Free |
8 | // Software Foundation; either version 3, or (at your option) any later |
9 | // version. |
10 | // |
11 | // GCC is distributed in the hope that it will be useful, but WITHOUT ANY |
12 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or |
13 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
14 | // for more details. |
15 | // |
16 | // You should have received a copy of the GNU General Public License |
17 | // along with GCC; see the file COPYING3. If not see |
18 | // <http://www.gnu.org/licenses/>. |
19 | |
20 | template<> |
21 | struct is_a_helper<rtl_ssa::def_info *> |
22 | : static_is_a_helper<rtl_ssa::def_info *> |
23 | { |
24 | static inline bool |
25 | test (const rtl_ssa::access_info *ref) |
26 | { |
27 | return (ref->kind () == rtl_ssa::access_kind::SET |
28 | || ref->kind () == rtl_ssa::access_kind::PHI |
29 | || ref->kind () == rtl_ssa::access_kind::CLOBBER); |
30 | } |
31 | }; |
32 | |
33 | template<> |
34 | struct is_a_helper<rtl_ssa::clobber_info *> |
35 | : static_is_a_helper<rtl_ssa::clobber_info *> |
36 | { |
37 | static inline bool |
38 | test (const rtl_ssa::access_info *ref) |
39 | { |
40 | return ref->kind () == rtl_ssa::access_kind::CLOBBER; |
41 | } |
42 | }; |
43 | |
44 | template<> |
45 | struct is_a_helper<rtl_ssa::use_info *> |
46 | : static_is_a_helper<rtl_ssa::use_info *> |
47 | { |
48 | static inline bool |
49 | test (const rtl_ssa::access_info *ref) |
50 | { |
51 | return ref->kind () == rtl_ssa::access_kind::USE; |
52 | } |
53 | }; |
54 | |
55 | template<> |
56 | struct is_a_helper<rtl_ssa::set_info *> |
57 | : static_is_a_helper<rtl_ssa::set_info *> |
58 | { |
59 | static inline bool |
60 | test (const rtl_ssa::access_info *ref) |
61 | { |
62 | return (ref->kind () == rtl_ssa::access_kind::SET |
63 | || ref->kind () == rtl_ssa::access_kind::PHI); |
64 | } |
65 | }; |
66 | |
67 | template<> |
68 | struct is_a_helper<rtl_ssa::phi_info *> |
69 | : static_is_a_helper<rtl_ssa::phi_info *> |
70 | { |
71 | static inline bool |
72 | test (const rtl_ssa::access_info *ref) |
73 | { |
74 | return ref->kind () == rtl_ssa::access_kind::PHI; |
75 | } |
76 | }; |
77 | |
78 | template<> |
79 | struct is_a_helper<rtl_ssa::set_node *> |
80 | : static_is_a_helper<rtl_ssa::set_node *> |
81 | { |
82 | static inline bool |
83 | test (const rtl_ssa::def_node *node) |
84 | { |
85 | return node->contains_set (); |
86 | } |
87 | }; |
88 | |
89 | template<> |
90 | struct is_a_helper<rtl_ssa::clobber_group *> |
91 | : static_is_a_helper<rtl_ssa::clobber_group *> |
92 | { |
93 | static inline bool |
94 | test (const rtl_ssa::def_node *node) |
95 | { |
96 | return node->contains_clobber (); |
97 | } |
98 | }; |
99 |