Mercurial > hg > CbC > CbC_gcc
comparison gcc/tree-ssa-ifcombine.c @ 36:855418dad1a3
gcc-4.4-20091020
author | e075725 |
---|---|
date | Tue, 22 Dec 2009 21:19:31 +0900 |
parents | a06113de4d67 |
children | 77e2b8dfacca |
comparison
equal
deleted
inserted
replaced
19:58ad6c70ea60 | 36:855418dad1a3 |
---|---|
149 if (TREE_CODE (candidate) == SSA_NAME | 149 if (TREE_CODE (candidate) == SSA_NAME |
150 && has_single_use (candidate)) | 150 && has_single_use (candidate)) |
151 { | 151 { |
152 gimple def_stmt = SSA_NAME_DEF_STMT (candidate); | 152 gimple def_stmt = SSA_NAME_DEF_STMT (candidate); |
153 if (is_gimple_assign (def_stmt) | 153 if (is_gimple_assign (def_stmt) |
154 && gimple_assign_cast_p (def_stmt)) | 154 && CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (def_stmt))) |
155 { | 155 { |
156 if (TYPE_PRECISION (TREE_TYPE (candidate)) | 156 if (TYPE_PRECISION (TREE_TYPE (candidate)) |
157 <= TYPE_PRECISION (TREE_TYPE (gimple_assign_rhs1 (def_stmt)))) | 157 <= TYPE_PRECISION (TREE_TYPE (gimple_assign_rhs1 (def_stmt)))) |
158 return gimple_assign_rhs1 (def_stmt); | 158 return gimple_assign_rhs1 (def_stmt); |
159 } | 159 } |
160 } | 160 } |
161 | 161 |
162 return candidate; | 162 return candidate; |
163 } | |
164 | |
165 /* Helpers for recognize_single_bit_test defined mainly for source code | |
166 formating. */ | |
167 | |
168 static int | |
169 operand_precision (tree t) | |
170 { | |
171 return TYPE_PRECISION (TREE_TYPE (t)); | |
172 } | |
173 | |
174 static bool | |
175 integral_operand_p (tree t) | |
176 { | |
177 return INTEGRAL_TYPE_P (TREE_TYPE (t)); | |
178 } | 163 } |
179 | 164 |
180 /* Recognize a single bit test pattern in GIMPLE_COND and its defining | 165 /* Recognize a single bit test pattern in GIMPLE_COND and its defining |
181 statements. Store the name being tested in *NAME and the bit | 166 statements. Store the name being tested in *NAME and the bit |
182 in *BIT. The GIMPLE_COND computes *NAME & (1 << *BIT). | 167 in *BIT. The GIMPLE_COND computes *NAME & (1 << *BIT). |
210 /* Look through copies and conversions to eventually | 195 /* Look through copies and conversions to eventually |
211 find the stmt that computes the shift. */ | 196 find the stmt that computes the shift. */ |
212 stmt = SSA_NAME_DEF_STMT (orig_name); | 197 stmt = SSA_NAME_DEF_STMT (orig_name); |
213 | 198 |
214 while (is_gimple_assign (stmt) | 199 while (is_gimple_assign (stmt) |
215 && (gimple_assign_ssa_name_copy_p (stmt) | 200 && ((CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (stmt)) |
216 || (gimple_assign_cast_p (stmt) | 201 && (TYPE_PRECISION (TREE_TYPE (gimple_assign_lhs (stmt))) |
217 && integral_operand_p (gimple_assign_lhs (stmt)) | 202 <= TYPE_PRECISION (TREE_TYPE (gimple_assign_rhs1 (stmt))))) |
218 && integral_operand_p (gimple_assign_rhs1 (stmt)) | 203 || gimple_assign_ssa_name_copy_p (stmt))) |
219 && (operand_precision (gimple_assign_lhs (stmt)) | 204 stmt = SSA_NAME_DEF_STMT (gimple_assign_rhs1 (stmt)); |
220 <= operand_precision (gimple_assign_rhs1 (stmt)))))) | |
221 { | |
222 stmt = SSA_NAME_DEF_STMT (gimple_assign_rhs1 (stmt)); | |
223 } | |
224 | 205 |
225 /* If we found such, decompose it. */ | 206 /* If we found such, decompose it. */ |
226 if (is_gimple_assign (stmt) | 207 if (is_gimple_assign (stmt) |
227 && gimple_assign_rhs_code (stmt) == RSHIFT_EXPR) | 208 && gimple_assign_rhs_code (stmt) == RSHIFT_EXPR) |
228 { | 209 { |