Fix gnat.dg/opt39.adb on hppa.
[official-gcc.git] / gcc / rtl-ssa / is-a.inl
blob1b57ce6eb6d0d07419adff2edaa09ad2ea73c8dd
1 // is_a<> support for RTL SSA classes                               -*- C++ -*-
2 // Copyright (C) 2020-2023 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.
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.
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/>.
20 template<>
21 struct is_a_helper<rtl_ssa::def_info *>
22   : static_is_a_helper<rtl_ssa::def_info *>
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   }
33 template<>
34 struct is_a_helper<rtl_ssa::clobber_info *>
35   : static_is_a_helper<rtl_ssa::clobber_info *>
37   static inline bool
38   test (const rtl_ssa::access_info *ref)
39   {
40     return ref->kind () == rtl_ssa::access_kind::CLOBBER;
41   }
44 template<>
45 struct is_a_helper<rtl_ssa::use_info *>
46   : static_is_a_helper<rtl_ssa::use_info *>
48   static inline bool
49   test (const rtl_ssa::access_info *ref)
50   {
51     return ref->kind () == rtl_ssa::access_kind::USE;
52   }
55 template<>
56 struct is_a_helper<rtl_ssa::set_info *>
57   : static_is_a_helper<rtl_ssa::set_info *>
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   }
67 template<>
68 struct is_a_helper<rtl_ssa::phi_info *>
69   : static_is_a_helper<rtl_ssa::phi_info *>
71   static inline bool
72   test (const rtl_ssa::access_info *ref)
73   {
74     return ref->kind () == rtl_ssa::access_kind::PHI;
75   }
78 template<>
79 struct is_a_helper<rtl_ssa::set_node *>
80   : static_is_a_helper<rtl_ssa::set_node *>
82   static inline bool
83   test (const rtl_ssa::def_node *node)
84   {
85     return node->contains_set ();
86   }
89 template<>
90 struct is_a_helper<rtl_ssa::clobber_group *>
91   : static_is_a_helper<rtl_ssa::clobber_group *>
93   static inline bool
94   test (const rtl_ssa::def_node *node)
95   {
96     return node->contains_clobber ();
97   }