1 // is_a<> support for RTL SSA classes -*- C++ -*-
2 // Copyright (C) 2020-2023 Free Software Foundation, Inc.
4 // This file is part of GCC.
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
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
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/>.
21 struct is_a_helper<rtl_ssa::def_info *>
22 : static_is_a_helper<rtl_ssa::def_info *>
25 test (const rtl_ssa::access_info *ref)
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);
34 struct is_a_helper<rtl_ssa::clobber_info *>
35 : static_is_a_helper<rtl_ssa::clobber_info *>
38 test (const rtl_ssa::access_info *ref)
40 return ref->kind () == rtl_ssa::access_kind::CLOBBER;
45 struct is_a_helper<rtl_ssa::use_info *>
46 : static_is_a_helper<rtl_ssa::use_info *>
49 test (const rtl_ssa::access_info *ref)
51 return ref->kind () == rtl_ssa::access_kind::USE;
56 struct is_a_helper<rtl_ssa::set_info *>
57 : static_is_a_helper<rtl_ssa::set_info *>
60 test (const rtl_ssa::access_info *ref)
62 return (ref->kind () == rtl_ssa::access_kind::SET
63 || ref->kind () == rtl_ssa::access_kind::PHI);
68 struct is_a_helper<rtl_ssa::phi_info *>
69 : static_is_a_helper<rtl_ssa::phi_info *>
72 test (const rtl_ssa::access_info *ref)
74 return ref->kind () == rtl_ssa::access_kind::PHI;
79 struct is_a_helper<rtl_ssa::set_node *>
80 : static_is_a_helper<rtl_ssa::set_node *>
83 test (const rtl_ssa::def_node *node)
85 return node->contains_set ();
90 struct is_a_helper<rtl_ssa::clobber_group *>
91 : static_is_a_helper<rtl_ssa::clobber_group *>
94 test (const rtl_ssa::def_node *node)
96 return node->contains_clobber ();