Mercurial > hg > CbC > CbC_gcc
comparison gcc/tree-chrec.h @ 55:77e2b8dfacca gcc-4.4.5
update it from 4.4.3 to 4.5.0
author | ryoma <e075725@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 12 Feb 2010 23:39:51 +0900 |
parents | 58ad6c70ea60 |
children | f6334be47118 |
comparison
equal
deleted
inserted
replaced
52:c156f1bd5cd9 | 55:77e2b8dfacca |
---|---|
20 <http://www.gnu.org/licenses/>. */ | 20 <http://www.gnu.org/licenses/>. */ |
21 | 21 |
22 #ifndef GCC_TREE_CHREC_H | 22 #ifndef GCC_TREE_CHREC_H |
23 #define GCC_TREE_CHREC_H | 23 #define GCC_TREE_CHREC_H |
24 | 24 |
25 /* The following trees are unique elements. Thus the comparison of another | 25 /* The following trees are unique elements. Thus the comparison of another |
26 element to these elements should be done on the pointer to these trees, | 26 element to these elements should be done on the pointer to these trees, |
27 and not on their value. */ | 27 and not on their value. */ |
28 | 28 |
29 extern tree chrec_not_analyzed_yet; | 29 extern tree chrec_not_analyzed_yet; |
30 extern GTY(()) tree chrec_dont_know; | 30 extern GTY(()) tree chrec_dont_know; |
31 extern GTY(()) tree chrec_known; | 31 extern GTY(()) tree chrec_known; |
84 extern bool evolution_function_is_affine_multivariate_p (const_tree, int); | 84 extern bool evolution_function_is_affine_multivariate_p (const_tree, int); |
85 extern bool evolution_function_is_univariate_p (const_tree); | 85 extern bool evolution_function_is_univariate_p (const_tree); |
86 extern unsigned nb_vars_in_chrec (tree); | 86 extern unsigned nb_vars_in_chrec (tree); |
87 extern bool evolution_function_is_invariant_p (tree, int); | 87 extern bool evolution_function_is_invariant_p (tree, int); |
88 extern bool scev_is_linear_expression (tree); | 88 extern bool scev_is_linear_expression (tree); |
89 extern bool evolution_function_right_is_integer_cst (const_tree); | |
89 | 90 |
90 /* Determines whether CHREC is equal to zero. */ | 91 /* Determines whether CHREC is equal to zero. */ |
91 | 92 |
92 static inline bool | 93 static inline bool |
93 chrec_zerop (const_tree chrec) | 94 chrec_zerop (const_tree chrec) |
94 { | 95 { |
95 if (chrec == NULL_TREE) | 96 if (chrec == NULL_TREE) |
96 return false; | 97 return false; |
97 | 98 |
98 if (TREE_CODE (chrec) == INTEGER_CST) | 99 if (TREE_CODE (chrec) == INTEGER_CST) |
99 return integer_zerop (chrec); | 100 return integer_zerop (chrec); |
100 | 101 |
101 return false; | 102 return false; |
102 } | 103 } |
103 | 104 |
104 /* Determines whether CHREC is a loop invariant with respect to LOOP_NUM. | 105 /* Determines whether CHREC is a loop invariant with respect to LOOP_NUM. |
105 Set the result in RES and return true when the property can be computed. */ | 106 Set the result in RES and return true when the property can be computed. */ |
106 | 107 |
107 static inline bool | 108 static inline bool |
108 no_evolution_in_loop_p (tree chrec, unsigned loop_num, bool *res) | 109 no_evolution_in_loop_p (tree chrec, unsigned loop_num, bool *res) |
109 { | 110 { |
110 tree scev; | 111 tree scev; |
111 | 112 |
112 if (chrec == chrec_not_analyzed_yet | 113 if (chrec == chrec_not_analyzed_yet |
113 || chrec == chrec_dont_know | 114 || chrec == chrec_dont_know |
114 || chrec_contains_symbols_defined_in_loop (chrec, loop_num)) | 115 || chrec_contains_symbols_defined_in_loop (chrec, loop_num)) |
115 return false; | 116 return false; |
116 | 117 |
118 STRIP_NOPS (chrec); | |
117 scev = hide_evolution_in_other_loops_than_loop (chrec, loop_num); | 119 scev = hide_evolution_in_other_loops_than_loop (chrec, loop_num); |
118 *res = !tree_is_chrec (scev); | 120 *res = !tree_is_chrec (scev); |
119 return true; | 121 return true; |
120 } | 122 } |
121 | 123 |
122 /* Build a polynomial chain of recurrence. */ | 124 /* Build a polynomial chain of recurrence. */ |
123 | 125 |
124 static inline tree | 126 static inline tree |
125 build_polynomial_chrec (unsigned loop_num, | 127 build_polynomial_chrec (unsigned loop_num, |
126 tree left, | 128 tree left, |
127 tree right) | 129 tree right) |
128 { | 130 { |
129 bool val; | 131 bool val; |
130 | 132 |
131 if (left == chrec_dont_know | 133 if (left == chrec_dont_know |
147 gcc_assert (TREE_TYPE (left) == TREE_TYPE (right)); | 149 gcc_assert (TREE_TYPE (left) == TREE_TYPE (right)); |
148 | 150 |
149 if (chrec_zerop (right)) | 151 if (chrec_zerop (right)) |
150 return left; | 152 return left; |
151 | 153 |
152 return build3 (POLYNOMIAL_CHREC, TREE_TYPE (left), | 154 return build3 (POLYNOMIAL_CHREC, TREE_TYPE (left), |
153 build_int_cst (NULL_TREE, loop_num), left, right); | 155 build_int_cst (NULL_TREE, loop_num), left, right); |
154 } | 156 } |
155 | 157 |
156 /* Determines whether the expression CHREC is a constant. */ | 158 /* Determines whether the expression CHREC is a constant. */ |
157 | 159 |
158 static inline bool | 160 static inline bool |
159 evolution_function_is_constant_p (const_tree chrec) | 161 evolution_function_is_constant_p (const_tree chrec) |
160 { | 162 { |
161 if (chrec == NULL_TREE) | 163 if (chrec == NULL_TREE) |
162 return false; | 164 return false; |
163 | 165 |
164 switch (TREE_CODE (chrec)) | 166 switch (TREE_CODE (chrec)) |
165 { | 167 { |
166 case INTEGER_CST: | 168 case INTEGER_CST: |
167 case REAL_CST: | 169 case REAL_CST: |
168 return true; | 170 return true; |
169 | 171 |
170 default: | 172 default: |
171 return false; | 173 return false; |
172 } | 174 } |
173 } | 175 } |
174 | 176 |
175 /* Determine whether CHREC is an affine evolution function in LOOPNUM. */ | 177 /* Determine whether CHREC is an affine evolution function in LOOPNUM. */ |
176 | 178 |
177 static inline bool | 179 static inline bool |
178 evolution_function_is_affine_in_loop (const_tree chrec, int loopnum) | 180 evolution_function_is_affine_in_loop (const_tree chrec, int loopnum) |
179 { | 181 { |
180 if (chrec == NULL_TREE) | 182 if (chrec == NULL_TREE) |
181 return false; | 183 return false; |
182 | 184 |
183 switch (TREE_CODE (chrec)) | 185 switch (TREE_CODE (chrec)) |
184 { | 186 { |
185 case POLYNOMIAL_CHREC: | 187 case POLYNOMIAL_CHREC: |
186 if (evolution_function_is_invariant_p (CHREC_LEFT (chrec), loopnum) | 188 if (evolution_function_is_invariant_p (CHREC_LEFT (chrec), loopnum) |
187 && evolution_function_is_invariant_p (CHREC_RIGHT (chrec), loopnum)) | 189 && evolution_function_is_invariant_p (CHREC_RIGHT (chrec), loopnum)) |
188 return true; | 190 return true; |
189 else | 191 else |
190 return false; | 192 return false; |
191 | 193 |
192 default: | 194 default: |
193 return false; | 195 return false; |
194 } | 196 } |
195 } | 197 } |
196 | 198 |
197 /* Determine whether CHREC is an affine evolution function or not. */ | 199 /* Determine whether CHREC is an affine evolution function or not. */ |
198 | 200 |
199 static inline bool | 201 static inline bool |
200 evolution_function_is_affine_p (const_tree chrec) | 202 evolution_function_is_affine_p (const_tree chrec) |
201 { | 203 { |
202 if (chrec == NULL_TREE) | 204 if (chrec == NULL_TREE) |
203 return false; | 205 return false; |
204 | 206 |
205 switch (TREE_CODE (chrec)) | 207 switch (TREE_CODE (chrec)) |
206 { | 208 { |
207 case POLYNOMIAL_CHREC: | 209 case POLYNOMIAL_CHREC: |
208 if (evolution_function_is_invariant_p (CHREC_LEFT (chrec), | 210 if (evolution_function_is_invariant_p (CHREC_LEFT (chrec), |
209 CHREC_VARIABLE (chrec)) | 211 CHREC_VARIABLE (chrec)) |
210 && evolution_function_is_invariant_p (CHREC_RIGHT (chrec), | 212 && evolution_function_is_invariant_p (CHREC_RIGHT (chrec), |
211 CHREC_VARIABLE (chrec))) | 213 CHREC_VARIABLE (chrec))) |
212 return true; | 214 return true; |
213 else | 215 else |
214 return false; | 216 return false; |
215 | 217 |
216 default: | 218 default: |
217 return false; | 219 return false; |
218 } | 220 } |
219 } | 221 } |
220 | 222 |