Mercurial > hg > CbC > CbC_gcc
comparison gcc/cfg.h @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children | 1830386684a0 |
comparison
equal
deleted
inserted
replaced
111:04ced10e8804 | 131:84e7813d76e9 |
---|---|
1 /* Control flow graph manipulation code header file. | 1 /* Control flow graph manipulation code header file. |
2 Copyright (C) 2014-2017 Free Software Foundation, Inc. | 2 Copyright (C) 2014-2018 Free Software Foundation, Inc. |
3 | 3 |
4 This file is part of GCC. | 4 This file is part of GCC. |
5 | 5 |
6 GCC is free software; you can redistribute it and/or modify it under | 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 | 7 the terms of the GNU General Public License as published by the Free |
69 unsigned x_n_bbs_in_dom_tree[2]; | 69 unsigned x_n_bbs_in_dom_tree[2]; |
70 | 70 |
71 /* Maximal number of entities in the single jumptable. Used to estimate | 71 /* Maximal number of entities in the single jumptable. Used to estimate |
72 final flowgraph size. */ | 72 final flowgraph size. */ |
73 int max_jumptable_ents; | 73 int max_jumptable_ents; |
74 | |
75 /* Maximal count of BB in function. */ | |
76 profile_count count_max; | |
77 | |
78 /* Dynamically allocated edge/bb flags. */ | |
79 int edge_flags_allocated; | |
80 int bb_flags_allocated; | |
74 }; | 81 }; |
75 | 82 |
76 | 83 |
77 extern void init_flow (function *); | 84 extern void init_flow (function *); |
78 extern void clear_edges (function *); | 85 extern void clear_edges (function *); |
101 extern void free_aux_for_edges (void); | 108 extern void free_aux_for_edges (void); |
102 extern void debug_bb (basic_block); | 109 extern void debug_bb (basic_block); |
103 extern basic_block debug_bb_n (int); | 110 extern basic_block debug_bb_n (int); |
104 extern void dump_bb_info (FILE *, basic_block, int, dump_flags_t, bool, bool); | 111 extern void dump_bb_info (FILE *, basic_block, int, dump_flags_t, bool, bool); |
105 extern void brief_dump_cfg (FILE *, dump_flags_t); | 112 extern void brief_dump_cfg (FILE *, dump_flags_t); |
106 extern void update_bb_profile_for_threading (basic_block, int, profile_count, edge); | 113 extern void update_bb_profile_for_threading (basic_block, profile_count, edge); |
107 extern void scale_bbs_frequencies_int (basic_block *, int, int, int); | |
108 extern void scale_bbs_frequencies_gcov_type (basic_block *, int, gcov_type, | |
109 gcov_type); | |
110 extern void scale_bbs_frequencies_profile_count (basic_block *, int, | 114 extern void scale_bbs_frequencies_profile_count (basic_block *, int, |
111 profile_count, profile_count); | 115 profile_count, profile_count); |
112 extern void scale_bbs_frequencies (basic_block *, int, profile_probability); | 116 extern void scale_bbs_frequencies (basic_block *, int, profile_probability); |
113 extern void initialize_original_copy_tables (void); | 117 extern void initialize_original_copy_tables (void); |
114 extern void reset_original_copy_tables (void); | 118 extern void reset_original_copy_tables (void); |
119 extern void set_bb_copy (basic_block, basic_block); | 123 extern void set_bb_copy (basic_block, basic_block); |
120 extern basic_block get_bb_copy (basic_block); | 124 extern basic_block get_bb_copy (basic_block); |
121 void set_loop_copy (struct loop *, struct loop *); | 125 void set_loop_copy (struct loop *, struct loop *); |
122 struct loop *get_loop_copy (struct loop *); | 126 struct loop *get_loop_copy (struct loop *); |
123 | 127 |
128 /* Generic RAII class to allocate a bit from storage of integer type T. | |
129 The allocated bit is accessible as mask with the single bit set | |
130 via the conversion operator to T. */ | |
131 | |
132 template <class T> | |
133 class auto_flag | |
134 { | |
135 public: | |
136 /* static assert T is integer type of max HOST_WIDE_INT precision. */ | |
137 auto_flag (T *sptr) | |
138 { | |
139 m_sptr = sptr; | |
140 int free_bit = ffs_hwi (~*sptr); | |
141 /* If there are no unset bits... */ | |
142 if (free_bit == 0) | |
143 gcc_unreachable (); | |
144 m_flag = HOST_WIDE_INT_1U << (free_bit - 1); | |
145 /* ...or if T is signed and thus the complement is sign-extended, | |
146 check if we ran out of bits. We could spare us this bit | |
147 if we could use C++11 std::make_unsigned<T>::type to pass | |
148 ~*sptr to ffs_hwi. */ | |
149 if (m_flag == 0) | |
150 gcc_unreachable (); | |
151 gcc_checking_assert ((*sptr & m_flag) == 0); | |
152 *sptr |= m_flag; | |
153 } | |
154 ~auto_flag () | |
155 { | |
156 gcc_checking_assert ((*m_sptr & m_flag) == m_flag); | |
157 *m_sptr &= ~m_flag; | |
158 } | |
159 operator T () const { return m_flag; } | |
160 private: | |
161 T *m_sptr; | |
162 T m_flag; | |
163 }; | |
164 | |
165 /* RAII class to allocate an edge flag for temporary use. You have | |
166 to clear the flag from all edges when you are finished using it. */ | |
167 | |
168 class auto_edge_flag : public auto_flag<int> | |
169 { | |
170 public: | |
171 auto_edge_flag (function *fun) | |
172 : auto_flag<int> (&fun->cfg->edge_flags_allocated) {} | |
173 }; | |
174 | |
175 /* RAII class to allocate a bb flag for temporary use. You have | |
176 to clear the flag from all edges when you are finished using it. */ | |
177 class auto_bb_flag : public auto_flag<int> | |
178 { | |
179 public: | |
180 auto_bb_flag (function *fun) | |
181 : auto_flag<int> (&fun->cfg->bb_flags_allocated) {} | |
182 }; | |
183 | |
124 #endif /* GCC_CFG_H */ | 184 #endif /* GCC_CFG_H */ |