Mercurial > hg > CbC > CbC_gcc
annotate gcc/tree-ssa-math-opts.c @ 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 | 3bfb6c00c1e0 |
children | b7f97abdc517 |
rev | line source |
---|---|
0 | 1 /* Global, SSA-based optimizations using mathematical identities. |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
2 Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
3 |
0 | 4 This file is part of GCC. |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
5 |
0 | 6 GCC is free software; you can redistribute it and/or modify it |
7 under the terms of the GNU General Public License as published by the | |
8 Free Software Foundation; either version 3, or (at your option) any | |
9 later version. | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
10 |
0 | 11 GCC is distributed in the hope that it will be useful, but WITHOUT |
12 ANY 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. | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
15 |
0 | 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/>. */ | |
19 | |
20 /* Currently, the only mini-pass in this file tries to CSE reciprocal | |
21 operations. These are common in sequences such as this one: | |
22 | |
23 modulus = sqrt(x*x + y*y + z*z); | |
24 x = x / modulus; | |
25 y = y / modulus; | |
26 z = z / modulus; | |
27 | |
28 that can be optimized to | |
29 | |
30 modulus = sqrt(x*x + y*y + z*z); | |
31 rmodulus = 1.0 / modulus; | |
32 x = x * rmodulus; | |
33 y = y * rmodulus; | |
34 z = z * rmodulus; | |
35 | |
36 We do this for loop invariant divisors, and with this pass whenever | |
37 we notice that a division has the same divisor multiple times. | |
38 | |
39 Of course, like in PRE, we don't insert a division if a dominator | |
40 already has one. However, this cannot be done as an extension of | |
41 PRE for several reasons. | |
42 | |
43 First of all, with some experiments it was found out that the | |
44 transformation is not always useful if there are only two divisions | |
45 hy the same divisor. This is probably because modern processors | |
46 can pipeline the divisions; on older, in-order processors it should | |
47 still be effective to optimize two divisions by the same number. | |
48 We make this a param, and it shall be called N in the remainder of | |
49 this comment. | |
50 | |
51 Second, if trapping math is active, we have less freedom on where | |
52 to insert divisions: we can only do so in basic blocks that already | |
53 contain one. (If divisions don't trap, instead, we can insert | |
54 divisions elsewhere, which will be in blocks that are common dominators | |
55 of those that have the division). | |
56 | |
57 We really don't want to compute the reciprocal unless a division will | |
58 be found. To do this, we won't insert the division in a basic block | |
59 that has less than N divisions *post-dominating* it. | |
60 | |
61 The algorithm constructs a subset of the dominator tree, holding the | |
62 blocks containing the divisions and the common dominators to them, | |
63 and walk it twice. The first walk is in post-order, and it annotates | |
64 each block with the number of divisions that post-dominate it: this | |
65 gives information on where divisions can be inserted profitably. | |
66 The second walk is in pre-order, and it inserts divisions as explained | |
67 above, and replaces divisions by multiplications. | |
68 | |
69 In the best case, the cost of the pass is O(n_statements). In the | |
70 worst-case, the cost is due to creating the dominator tree subset, | |
71 with a cost of O(n_basic_blocks ^ 2); however this can only happen | |
72 for n_statements / n_basic_blocks statements. So, the amortized cost | |
73 of creating the dominator tree subset is O(n_basic_blocks) and the | |
74 worst-case cost of the pass is O(n_statements * n_basic_blocks). | |
75 | |
76 More practically, the cost will be small because there are few | |
77 divisions, and they tend to be in the same basic block, so insert_bb | |
78 is called very few times. | |
79 | |
80 If we did this using domwalk.c, an efficient implementation would have | |
81 to work on all the variables in a single pass, because we could not | |
82 work on just a subset of the dominator tree, as we do now, and the | |
83 cost would also be something like O(n_statements * n_basic_blocks). | |
84 The data structures would be more complex in order to work on all the | |
85 variables in a single pass. */ | |
86 | |
87 #include "config.h" | |
88 #include "system.h" | |
89 #include "coretypes.h" | |
90 #include "tm.h" | |
91 #include "flags.h" | |
92 #include "tree.h" | |
93 #include "tree-flow.h" | |
94 #include "real.h" | |
95 #include "timevar.h" | |
96 #include "tree-pass.h" | |
97 #include "alloc-pool.h" | |
98 #include "basic-block.h" | |
99 #include "target.h" | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
100 #include "diagnostic.h" |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
101 #include "rtl.h" |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
102 #include "expr.h" |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
103 #include "optabs.h" |
0 | 104 |
105 /* This structure represents one basic block that either computes a | |
106 division, or is a common dominator for basic block that compute a | |
107 division. */ | |
108 struct occurrence { | |
109 /* The basic block represented by this structure. */ | |
110 basic_block bb; | |
111 | |
112 /* If non-NULL, the SSA_NAME holding the definition for a reciprocal | |
113 inserted in BB. */ | |
114 tree recip_def; | |
115 | |
116 /* If non-NULL, the GIMPLE_ASSIGN for a reciprocal computation that | |
117 was inserted in BB. */ | |
118 gimple recip_def_stmt; | |
119 | |
120 /* Pointer to a list of "struct occurrence"s for blocks dominated | |
121 by BB. */ | |
122 struct occurrence *children; | |
123 | |
124 /* Pointer to the next "struct occurrence"s in the list of blocks | |
125 sharing a common dominator. */ | |
126 struct occurrence *next; | |
127 | |
128 /* The number of divisions that are in BB before compute_merit. The | |
129 number of divisions that are in BB or post-dominate it after | |
130 compute_merit. */ | |
131 int num_divisions; | |
132 | |
133 /* True if the basic block has a division, false if it is a common | |
134 dominator for basic blocks that do. If it is false and trapping | |
135 math is active, BB is not a candidate for inserting a reciprocal. */ | |
136 bool bb_has_division; | |
137 }; | |
138 | |
139 | |
140 /* The instance of "struct occurrence" representing the highest | |
141 interesting block in the dominator tree. */ | |
142 static struct occurrence *occ_head; | |
143 | |
144 /* Allocation pool for getting instances of "struct occurrence". */ | |
145 static alloc_pool occ_pool; | |
146 | |
147 | |
148 | |
149 /* Allocate and return a new struct occurrence for basic block BB, and | |
150 whose children list is headed by CHILDREN. */ | |
151 static struct occurrence * | |
152 occ_new (basic_block bb, struct occurrence *children) | |
153 { | |
154 struct occurrence *occ; | |
155 | |
156 bb->aux = occ = (struct occurrence *) pool_alloc (occ_pool); | |
157 memset (occ, 0, sizeof (struct occurrence)); | |
158 | |
159 occ->bb = bb; | |
160 occ->children = children; | |
161 return occ; | |
162 } | |
163 | |
164 | |
165 /* Insert NEW_OCC into our subset of the dominator tree. P_HEAD points to a | |
166 list of "struct occurrence"s, one per basic block, having IDOM as | |
167 their common dominator. | |
168 | |
169 We try to insert NEW_OCC as deep as possible in the tree, and we also | |
170 insert any other block that is a common dominator for BB and one | |
171 block already in the tree. */ | |
172 | |
173 static void | |
174 insert_bb (struct occurrence *new_occ, basic_block idom, | |
175 struct occurrence **p_head) | |
176 { | |
177 struct occurrence *occ, **p_occ; | |
178 | |
179 for (p_occ = p_head; (occ = *p_occ) != NULL; ) | |
180 { | |
181 basic_block bb = new_occ->bb, occ_bb = occ->bb; | |
182 basic_block dom = nearest_common_dominator (CDI_DOMINATORS, occ_bb, bb); | |
183 if (dom == bb) | |
184 { | |
185 /* BB dominates OCC_BB. OCC becomes NEW_OCC's child: remove OCC | |
186 from its list. */ | |
187 *p_occ = occ->next; | |
188 occ->next = new_occ->children; | |
189 new_occ->children = occ; | |
190 | |
191 /* Try the next block (it may as well be dominated by BB). */ | |
192 } | |
193 | |
194 else if (dom == occ_bb) | |
195 { | |
196 /* OCC_BB dominates BB. Tail recurse to look deeper. */ | |
197 insert_bb (new_occ, dom, &occ->children); | |
198 return; | |
199 } | |
200 | |
201 else if (dom != idom) | |
202 { | |
203 gcc_assert (!dom->aux); | |
204 | |
205 /* There is a dominator between IDOM and BB, add it and make | |
206 two children out of NEW_OCC and OCC. First, remove OCC from | |
207 its list. */ | |
208 *p_occ = occ->next; | |
209 new_occ->next = occ; | |
210 occ->next = NULL; | |
211 | |
212 /* None of the previous blocks has DOM as a dominator: if we tail | |
213 recursed, we would reexamine them uselessly. Just switch BB with | |
214 DOM, and go on looking for blocks dominated by DOM. */ | |
215 new_occ = occ_new (dom, new_occ); | |
216 } | |
217 | |
218 else | |
219 { | |
220 /* Nothing special, go on with the next element. */ | |
221 p_occ = &occ->next; | |
222 } | |
223 } | |
224 | |
225 /* No place was found as a child of IDOM. Make BB a sibling of IDOM. */ | |
226 new_occ->next = *p_head; | |
227 *p_head = new_occ; | |
228 } | |
229 | |
230 /* Register that we found a division in BB. */ | |
231 | |
232 static inline void | |
233 register_division_in (basic_block bb) | |
234 { | |
235 struct occurrence *occ; | |
236 | |
237 occ = (struct occurrence *) bb->aux; | |
238 if (!occ) | |
239 { | |
240 occ = occ_new (bb, NULL); | |
241 insert_bb (occ, ENTRY_BLOCK_PTR, &occ_head); | |
242 } | |
243 | |
244 occ->bb_has_division = true; | |
245 occ->num_divisions++; | |
246 } | |
247 | |
248 | |
249 /* Compute the number of divisions that postdominate each block in OCC and | |
250 its children. */ | |
251 | |
252 static void | |
253 compute_merit (struct occurrence *occ) | |
254 { | |
255 struct occurrence *occ_child; | |
256 basic_block dom = occ->bb; | |
257 | |
258 for (occ_child = occ->children; occ_child; occ_child = occ_child->next) | |
259 { | |
260 basic_block bb; | |
261 if (occ_child->children) | |
262 compute_merit (occ_child); | |
263 | |
264 if (flag_exceptions) | |
265 bb = single_noncomplex_succ (dom); | |
266 else | |
267 bb = dom; | |
268 | |
269 if (dominated_by_p (CDI_POST_DOMINATORS, bb, occ_child->bb)) | |
270 occ->num_divisions += occ_child->num_divisions; | |
271 } | |
272 } | |
273 | |
274 | |
275 /* Return whether USE_STMT is a floating-point division by DEF. */ | |
276 static inline bool | |
277 is_division_by (gimple use_stmt, tree def) | |
278 { | |
279 return is_gimple_assign (use_stmt) | |
280 && gimple_assign_rhs_code (use_stmt) == RDIV_EXPR | |
281 && gimple_assign_rhs2 (use_stmt) == def | |
282 /* Do not recognize x / x as valid division, as we are getting | |
283 confused later by replacing all immediate uses x in such | |
284 a stmt. */ | |
285 && gimple_assign_rhs1 (use_stmt) != def; | |
286 } | |
287 | |
288 /* Walk the subset of the dominator tree rooted at OCC, setting the | |
289 RECIP_DEF field to a definition of 1.0 / DEF that can be used in | |
290 the given basic block. The field may be left NULL, of course, | |
291 if it is not possible or profitable to do the optimization. | |
292 | |
293 DEF_BSI is an iterator pointing at the statement defining DEF. | |
294 If RECIP_DEF is set, a dominator already has a computation that can | |
295 be used. */ | |
296 | |
297 static void | |
298 insert_reciprocals (gimple_stmt_iterator *def_gsi, struct occurrence *occ, | |
299 tree def, tree recip_def, int threshold) | |
300 { | |
301 tree type; | |
302 gimple new_stmt; | |
303 gimple_stmt_iterator gsi; | |
304 struct occurrence *occ_child; | |
305 | |
306 if (!recip_def | |
307 && (occ->bb_has_division || !flag_trapping_math) | |
308 && occ->num_divisions >= threshold) | |
309 { | |
310 /* Make a variable with the replacement and substitute it. */ | |
311 type = TREE_TYPE (def); | |
312 recip_def = make_rename_temp (type, "reciptmp"); | |
313 new_stmt = gimple_build_assign_with_ops (RDIV_EXPR, recip_def, | |
314 build_one_cst (type), def); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
315 |
0 | 316 if (occ->bb_has_division) |
317 { | |
318 /* Case 1: insert before an existing division. */ | |
319 gsi = gsi_after_labels (occ->bb); | |
320 while (!gsi_end_p (gsi) && !is_division_by (gsi_stmt (gsi), def)) | |
321 gsi_next (&gsi); | |
322 | |
323 gsi_insert_before (&gsi, new_stmt, GSI_SAME_STMT); | |
324 } | |
325 else if (def_gsi && occ->bb == def_gsi->bb) | |
326 { | |
327 /* Case 2: insert right after the definition. Note that this will | |
328 never happen if the definition statement can throw, because in | |
329 that case the sole successor of the statement's basic block will | |
330 dominate all the uses as well. */ | |
331 gsi_insert_after (def_gsi, new_stmt, GSI_NEW_STMT); | |
332 } | |
333 else | |
334 { | |
335 /* Case 3: insert in a basic block not containing defs/uses. */ | |
336 gsi = gsi_after_labels (occ->bb); | |
337 gsi_insert_before (&gsi, new_stmt, GSI_SAME_STMT); | |
338 } | |
339 | |
340 occ->recip_def_stmt = new_stmt; | |
341 } | |
342 | |
343 occ->recip_def = recip_def; | |
344 for (occ_child = occ->children; occ_child; occ_child = occ_child->next) | |
345 insert_reciprocals (def_gsi, occ_child, def, recip_def, threshold); | |
346 } | |
347 | |
348 | |
349 /* Replace the division at USE_P with a multiplication by the reciprocal, if | |
350 possible. */ | |
351 | |
352 static inline void | |
353 replace_reciprocal (use_operand_p use_p) | |
354 { | |
355 gimple use_stmt = USE_STMT (use_p); | |
356 basic_block bb = gimple_bb (use_stmt); | |
357 struct occurrence *occ = (struct occurrence *) bb->aux; | |
358 | |
359 if (optimize_bb_for_speed_p (bb) | |
360 && occ->recip_def && use_stmt != occ->recip_def_stmt) | |
361 { | |
362 gimple_assign_set_rhs_code (use_stmt, MULT_EXPR); | |
363 SET_USE (use_p, occ->recip_def); | |
364 fold_stmt_inplace (use_stmt); | |
365 update_stmt (use_stmt); | |
366 } | |
367 } | |
368 | |
369 | |
370 /* Free OCC and return one more "struct occurrence" to be freed. */ | |
371 | |
372 static struct occurrence * | |
373 free_bb (struct occurrence *occ) | |
374 { | |
375 struct occurrence *child, *next; | |
376 | |
377 /* First get the two pointers hanging off OCC. */ | |
378 next = occ->next; | |
379 child = occ->children; | |
380 occ->bb->aux = NULL; | |
381 pool_free (occ_pool, occ); | |
382 | |
383 /* Now ensure that we don't recurse unless it is necessary. */ | |
384 if (!child) | |
385 return next; | |
386 else | |
387 { | |
388 while (next) | |
389 next = free_bb (next); | |
390 | |
391 return child; | |
392 } | |
393 } | |
394 | |
395 | |
396 /* Look for floating-point divisions among DEF's uses, and try to | |
397 replace them by multiplications with the reciprocal. Add | |
398 as many statements computing the reciprocal as needed. | |
399 | |
400 DEF must be a GIMPLE register of a floating-point type. */ | |
401 | |
402 static void | |
403 execute_cse_reciprocals_1 (gimple_stmt_iterator *def_gsi, tree def) | |
404 { | |
405 use_operand_p use_p; | |
406 imm_use_iterator use_iter; | |
407 struct occurrence *occ; | |
408 int count = 0, threshold; | |
409 | |
410 gcc_assert (FLOAT_TYPE_P (TREE_TYPE (def)) && is_gimple_reg (def)); | |
411 | |
412 FOR_EACH_IMM_USE_FAST (use_p, use_iter, def) | |
413 { | |
414 gimple use_stmt = USE_STMT (use_p); | |
415 if (is_division_by (use_stmt, def)) | |
416 { | |
417 register_division_in (gimple_bb (use_stmt)); | |
418 count++; | |
419 } | |
420 } | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
421 |
0 | 422 /* Do the expensive part only if we can hope to optimize something. */ |
423 threshold = targetm.min_divisions_for_recip_mul (TYPE_MODE (TREE_TYPE (def))); | |
424 if (count >= threshold) | |
425 { | |
426 gimple use_stmt; | |
427 for (occ = occ_head; occ; occ = occ->next) | |
428 { | |
429 compute_merit (occ); | |
430 insert_reciprocals (def_gsi, occ, def, NULL, threshold); | |
431 } | |
432 | |
433 FOR_EACH_IMM_USE_STMT (use_stmt, use_iter, def) | |
434 { | |
435 if (is_division_by (use_stmt, def)) | |
436 { | |
437 FOR_EACH_IMM_USE_ON_STMT (use_p, use_iter) | |
438 replace_reciprocal (use_p); | |
439 } | |
440 } | |
441 } | |
442 | |
443 for (occ = occ_head; occ; ) | |
444 occ = free_bb (occ); | |
445 | |
446 occ_head = NULL; | |
447 } | |
448 | |
449 static bool | |
450 gate_cse_reciprocals (void) | |
451 { | |
452 return optimize && flag_reciprocal_math; | |
453 } | |
454 | |
455 /* Go through all the floating-point SSA_NAMEs, and call | |
456 execute_cse_reciprocals_1 on each of them. */ | |
457 static unsigned int | |
458 execute_cse_reciprocals (void) | |
459 { | |
460 basic_block bb; | |
461 tree arg; | |
462 | |
463 occ_pool = create_alloc_pool ("dominators for recip", | |
464 sizeof (struct occurrence), | |
465 n_basic_blocks / 3 + 1); | |
466 | |
467 calculate_dominance_info (CDI_DOMINATORS); | |
468 calculate_dominance_info (CDI_POST_DOMINATORS); | |
469 | |
470 #ifdef ENABLE_CHECKING | |
471 FOR_EACH_BB (bb) | |
472 gcc_assert (!bb->aux); | |
473 #endif | |
474 | |
475 for (arg = DECL_ARGUMENTS (cfun->decl); arg; arg = TREE_CHAIN (arg)) | |
476 if (gimple_default_def (cfun, arg) | |
477 && FLOAT_TYPE_P (TREE_TYPE (arg)) | |
478 && is_gimple_reg (arg)) | |
479 execute_cse_reciprocals_1 (NULL, gimple_default_def (cfun, arg)); | |
480 | |
481 FOR_EACH_BB (bb) | |
482 { | |
483 gimple_stmt_iterator gsi; | |
484 gimple phi; | |
485 tree def; | |
486 | |
487 for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi)) | |
488 { | |
489 phi = gsi_stmt (gsi); | |
490 def = PHI_RESULT (phi); | |
491 if (FLOAT_TYPE_P (TREE_TYPE (def)) | |
492 && is_gimple_reg (def)) | |
493 execute_cse_reciprocals_1 (NULL, def); | |
494 } | |
495 | |
496 for (gsi = gsi_after_labels (bb); !gsi_end_p (gsi); gsi_next (&gsi)) | |
497 { | |
498 gimple stmt = gsi_stmt (gsi); | |
499 | |
500 if (gimple_has_lhs (stmt) | |
501 && (def = SINGLE_SSA_TREE_OPERAND (stmt, SSA_OP_DEF)) != NULL | |
502 && FLOAT_TYPE_P (TREE_TYPE (def)) | |
503 && TREE_CODE (def) == SSA_NAME) | |
504 execute_cse_reciprocals_1 (&gsi, def); | |
505 } | |
506 | |
507 if (optimize_bb_for_size_p (bb)) | |
508 continue; | |
509 | |
510 /* Scan for a/func(b) and convert it to reciprocal a*rfunc(b). */ | |
511 for (gsi = gsi_after_labels (bb); !gsi_end_p (gsi); gsi_next (&gsi)) | |
512 { | |
513 gimple stmt = gsi_stmt (gsi); | |
514 tree fndecl; | |
515 | |
516 if (is_gimple_assign (stmt) | |
517 && gimple_assign_rhs_code (stmt) == RDIV_EXPR) | |
518 { | |
519 tree arg1 = gimple_assign_rhs2 (stmt); | |
520 gimple stmt1; | |
521 | |
522 if (TREE_CODE (arg1) != SSA_NAME) | |
523 continue; | |
524 | |
525 stmt1 = SSA_NAME_DEF_STMT (arg1); | |
526 | |
527 if (is_gimple_call (stmt1) | |
528 && gimple_call_lhs (stmt1) | |
529 && (fndecl = gimple_call_fndecl (stmt1)) | |
530 && (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL | |
531 || DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_MD)) | |
532 { | |
533 enum built_in_function code; | |
47
3bfb6c00c1e0
update it from 4.4.2 to 4.4.3.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
534 bool md_code, fail; |
3bfb6c00c1e0
update it from 4.4.2 to 4.4.3.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
535 imm_use_iterator ui; |
3bfb6c00c1e0
update it from 4.4.2 to 4.4.3.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
536 use_operand_p use_p; |
0 | 537 |
538 code = DECL_FUNCTION_CODE (fndecl); | |
539 md_code = DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_MD; | |
540 | |
541 fndecl = targetm.builtin_reciprocal (code, md_code, false); | |
542 if (!fndecl) | |
543 continue; | |
544 | |
47
3bfb6c00c1e0
update it from 4.4.2 to 4.4.3.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
545 /* Check that all uses of the SSA name are divisions, |
3bfb6c00c1e0
update it from 4.4.2 to 4.4.3.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
546 otherwise replacing the defining statement will do |
3bfb6c00c1e0
update it from 4.4.2 to 4.4.3.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
547 the wrong thing. */ |
3bfb6c00c1e0
update it from 4.4.2 to 4.4.3.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
548 fail = false; |
3bfb6c00c1e0
update it from 4.4.2 to 4.4.3.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
549 FOR_EACH_IMM_USE_FAST (use_p, ui, arg1) |
3bfb6c00c1e0
update it from 4.4.2 to 4.4.3.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
550 { |
3bfb6c00c1e0
update it from 4.4.2 to 4.4.3.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
551 gimple stmt2 = USE_STMT (use_p); |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
552 if (is_gimple_debug (stmt2)) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
553 continue; |
47
3bfb6c00c1e0
update it from 4.4.2 to 4.4.3.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
554 if (!is_gimple_assign (stmt2) |
3bfb6c00c1e0
update it from 4.4.2 to 4.4.3.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
555 || gimple_assign_rhs_code (stmt2) != RDIV_EXPR |
3bfb6c00c1e0
update it from 4.4.2 to 4.4.3.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
556 || gimple_assign_rhs1 (stmt2) == arg1 |
3bfb6c00c1e0
update it from 4.4.2 to 4.4.3.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
557 || gimple_assign_rhs2 (stmt2) != arg1) |
3bfb6c00c1e0
update it from 4.4.2 to 4.4.3.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
558 { |
3bfb6c00c1e0
update it from 4.4.2 to 4.4.3.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
559 fail = true; |
3bfb6c00c1e0
update it from 4.4.2 to 4.4.3.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
560 break; |
3bfb6c00c1e0
update it from 4.4.2 to 4.4.3.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
561 } |
3bfb6c00c1e0
update it from 4.4.2 to 4.4.3.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
562 } |
3bfb6c00c1e0
update it from 4.4.2 to 4.4.3.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
563 if (fail) |
3bfb6c00c1e0
update it from 4.4.2 to 4.4.3.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
564 continue; |
3bfb6c00c1e0
update it from 4.4.2 to 4.4.3.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
565 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
566 gimple_replace_lhs (stmt1, arg1); |
0 | 567 gimple_call_set_fndecl (stmt1, fndecl); |
568 update_stmt (stmt1); | |
569 | |
47
3bfb6c00c1e0
update it from 4.4.2 to 4.4.3.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
570 FOR_EACH_IMM_USE_STMT (stmt, ui, arg1) |
3bfb6c00c1e0
update it from 4.4.2 to 4.4.3.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
571 { |
3bfb6c00c1e0
update it from 4.4.2 to 4.4.3.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
572 gimple_assign_set_rhs_code (stmt, MULT_EXPR); |
3bfb6c00c1e0
update it from 4.4.2 to 4.4.3.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
573 fold_stmt_inplace (stmt); |
3bfb6c00c1e0
update it from 4.4.2 to 4.4.3.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
574 update_stmt (stmt); |
3bfb6c00c1e0
update it from 4.4.2 to 4.4.3.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
575 } |
0 | 576 } |
577 } | |
578 } | |
579 } | |
580 | |
581 free_dominance_info (CDI_DOMINATORS); | |
582 free_dominance_info (CDI_POST_DOMINATORS); | |
583 free_alloc_pool (occ_pool); | |
584 return 0; | |
585 } | |
586 | |
587 struct gimple_opt_pass pass_cse_reciprocals = | |
588 { | |
589 { | |
590 GIMPLE_PASS, | |
591 "recip", /* name */ | |
592 gate_cse_reciprocals, /* gate */ | |
593 execute_cse_reciprocals, /* execute */ | |
594 NULL, /* sub */ | |
595 NULL, /* next */ | |
596 0, /* static_pass_number */ | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
597 TV_NONE, /* tv_id */ |
0 | 598 PROP_ssa, /* properties_required */ |
599 0, /* properties_provided */ | |
600 0, /* properties_destroyed */ | |
601 0, /* todo_flags_start */ | |
602 TODO_dump_func | TODO_update_ssa | TODO_verify_ssa | |
603 | TODO_verify_stmts /* todo_flags_finish */ | |
604 } | |
605 }; | |
606 | |
607 /* Records an occurrence at statement USE_STMT in the vector of trees | |
608 STMTS if it is dominated by *TOP_BB or dominates it or this basic block | |
609 is not yet initialized. Returns true if the occurrence was pushed on | |
610 the vector. Adjusts *TOP_BB to be the basic block dominating all | |
611 statements in the vector. */ | |
612 | |
613 static bool | |
614 maybe_record_sincos (VEC(gimple, heap) **stmts, | |
615 basic_block *top_bb, gimple use_stmt) | |
616 { | |
617 basic_block use_bb = gimple_bb (use_stmt); | |
618 if (*top_bb | |
619 && (*top_bb == use_bb | |
620 || dominated_by_p (CDI_DOMINATORS, use_bb, *top_bb))) | |
621 VEC_safe_push (gimple, heap, *stmts, use_stmt); | |
622 else if (!*top_bb | |
623 || dominated_by_p (CDI_DOMINATORS, *top_bb, use_bb)) | |
624 { | |
625 VEC_safe_push (gimple, heap, *stmts, use_stmt); | |
626 *top_bb = use_bb; | |
627 } | |
628 else | |
629 return false; | |
630 | |
631 return true; | |
632 } | |
633 | |
634 /* Look for sin, cos and cexpi calls with the same argument NAME and | |
635 create a single call to cexpi CSEing the result in this case. | |
636 We first walk over all immediate uses of the argument collecting | |
637 statements that we can CSE in a vector and in a second pass replace | |
638 the statement rhs with a REALPART or IMAGPART expression on the | |
639 result of the cexpi call we insert before the use statement that | |
640 dominates all other candidates. */ | |
641 | |
642 static void | |
643 execute_cse_sincos_1 (tree name) | |
644 { | |
645 gimple_stmt_iterator gsi; | |
646 imm_use_iterator use_iter; | |
647 tree fndecl, res, type; | |
648 gimple def_stmt, use_stmt, stmt; | |
649 int seen_cos = 0, seen_sin = 0, seen_cexpi = 0; | |
650 VEC(gimple, heap) *stmts = NULL; | |
651 basic_block top_bb = NULL; | |
652 int i; | |
653 | |
654 type = TREE_TYPE (name); | |
655 FOR_EACH_IMM_USE_STMT (use_stmt, use_iter, name) | |
656 { | |
657 if (gimple_code (use_stmt) != GIMPLE_CALL | |
658 || !gimple_call_lhs (use_stmt) | |
659 || !(fndecl = gimple_call_fndecl (use_stmt)) | |
660 || DECL_BUILT_IN_CLASS (fndecl) != BUILT_IN_NORMAL) | |
661 continue; | |
662 | |
663 switch (DECL_FUNCTION_CODE (fndecl)) | |
664 { | |
665 CASE_FLT_FN (BUILT_IN_COS): | |
666 seen_cos |= maybe_record_sincos (&stmts, &top_bb, use_stmt) ? 1 : 0; | |
667 break; | |
668 | |
669 CASE_FLT_FN (BUILT_IN_SIN): | |
670 seen_sin |= maybe_record_sincos (&stmts, &top_bb, use_stmt) ? 1 : 0; | |
671 break; | |
672 | |
673 CASE_FLT_FN (BUILT_IN_CEXPI): | |
674 seen_cexpi |= maybe_record_sincos (&stmts, &top_bb, use_stmt) ? 1 : 0; | |
675 break; | |
676 | |
677 default:; | |
678 } | |
679 } | |
680 | |
681 if (seen_cos + seen_sin + seen_cexpi <= 1) | |
682 { | |
683 VEC_free(gimple, heap, stmts); | |
684 return; | |
685 } | |
686 | |
687 /* Simply insert cexpi at the beginning of top_bb but not earlier than | |
688 the name def statement. */ | |
689 fndecl = mathfn_built_in (type, BUILT_IN_CEXPI); | |
690 if (!fndecl) | |
691 return; | |
692 res = make_rename_temp (TREE_TYPE (TREE_TYPE (fndecl)), "sincostmp"); | |
693 stmt = gimple_build_call (fndecl, 1, name); | |
694 gimple_call_set_lhs (stmt, res); | |
695 | |
696 def_stmt = SSA_NAME_DEF_STMT (name); | |
697 if (!SSA_NAME_IS_DEFAULT_DEF (name) | |
698 && gimple_code (def_stmt) != GIMPLE_PHI | |
699 && gimple_bb (def_stmt) == top_bb) | |
700 { | |
701 gsi = gsi_for_stmt (def_stmt); | |
702 gsi_insert_after (&gsi, stmt, GSI_SAME_STMT); | |
703 } | |
704 else | |
705 { | |
706 gsi = gsi_after_labels (top_bb); | |
707 gsi_insert_before (&gsi, stmt, GSI_SAME_STMT); | |
708 } | |
709 update_stmt (stmt); | |
710 | |
711 /* And adjust the recorded old call sites. */ | |
712 for (i = 0; VEC_iterate(gimple, stmts, i, use_stmt); ++i) | |
713 { | |
714 tree rhs = NULL; | |
715 fndecl = gimple_call_fndecl (use_stmt); | |
716 | |
717 switch (DECL_FUNCTION_CODE (fndecl)) | |
718 { | |
719 CASE_FLT_FN (BUILT_IN_COS): | |
720 rhs = fold_build1 (REALPART_EXPR, type, res); | |
721 break; | |
722 | |
723 CASE_FLT_FN (BUILT_IN_SIN): | |
724 rhs = fold_build1 (IMAGPART_EXPR, type, res); | |
725 break; | |
726 | |
727 CASE_FLT_FN (BUILT_IN_CEXPI): | |
728 rhs = res; | |
729 break; | |
730 | |
731 default:; | |
732 gcc_unreachable (); | |
733 } | |
734 | |
735 /* Replace call with a copy. */ | |
736 stmt = gimple_build_assign (gimple_call_lhs (use_stmt), rhs); | |
737 | |
738 gsi = gsi_for_stmt (use_stmt); | |
739 gsi_insert_after (&gsi, stmt, GSI_SAME_STMT); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
740 gsi_remove (&gsi, true); |
0 | 741 } |
742 | |
743 VEC_free(gimple, heap, stmts); | |
744 } | |
745 | |
746 /* Go through all calls to sin, cos and cexpi and call execute_cse_sincos_1 | |
747 on the SSA_NAME argument of each of them. */ | |
748 | |
749 static unsigned int | |
750 execute_cse_sincos (void) | |
751 { | |
752 basic_block bb; | |
753 | |
754 calculate_dominance_info (CDI_DOMINATORS); | |
755 | |
756 FOR_EACH_BB (bb) | |
757 { | |
758 gimple_stmt_iterator gsi; | |
759 | |
760 for (gsi = gsi_after_labels (bb); !gsi_end_p (gsi); gsi_next (&gsi)) | |
761 { | |
762 gimple stmt = gsi_stmt (gsi); | |
763 tree fndecl; | |
764 | |
765 if (is_gimple_call (stmt) | |
766 && gimple_call_lhs (stmt) | |
767 && (fndecl = gimple_call_fndecl (stmt)) | |
768 && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL) | |
769 { | |
770 tree arg; | |
771 | |
772 switch (DECL_FUNCTION_CODE (fndecl)) | |
773 { | |
774 CASE_FLT_FN (BUILT_IN_COS): | |
775 CASE_FLT_FN (BUILT_IN_SIN): | |
776 CASE_FLT_FN (BUILT_IN_CEXPI): | |
777 arg = gimple_call_arg (stmt, 0); | |
778 if (TREE_CODE (arg) == SSA_NAME) | |
779 execute_cse_sincos_1 (arg); | |
780 break; | |
781 | |
782 default:; | |
783 } | |
784 } | |
785 } | |
786 } | |
787 | |
788 free_dominance_info (CDI_DOMINATORS); | |
789 return 0; | |
790 } | |
791 | |
792 static bool | |
793 gate_cse_sincos (void) | |
794 { | |
795 /* Make sure we have either sincos or cexp. */ | |
796 return (TARGET_HAS_SINCOS | |
797 || TARGET_C99_FUNCTIONS) | |
798 && optimize; | |
799 } | |
800 | |
801 struct gimple_opt_pass pass_cse_sincos = | |
802 { | |
803 { | |
804 GIMPLE_PASS, | |
805 "sincos", /* name */ | |
806 gate_cse_sincos, /* gate */ | |
807 execute_cse_sincos, /* execute */ | |
808 NULL, /* sub */ | |
809 NULL, /* next */ | |
810 0, /* static_pass_number */ | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
811 TV_NONE, /* tv_id */ |
0 | 812 PROP_ssa, /* properties_required */ |
813 0, /* properties_provided */ | |
814 0, /* properties_destroyed */ | |
815 0, /* todo_flags_start */ | |
816 TODO_dump_func | TODO_update_ssa | TODO_verify_ssa | |
817 | TODO_verify_stmts /* todo_flags_finish */ | |
818 } | |
819 }; | |
820 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
821 /* A symbolic number is used to detect byte permutation and selection |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
822 patterns. Therefore the field N contains an artificial number |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
823 consisting of byte size markers: |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
824 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
825 0 - byte has the value 0 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
826 1..size - byte contains the content of the byte |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
827 number indexed with that value minus one */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
828 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
829 struct symbolic_number { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
830 unsigned HOST_WIDEST_INT n; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
831 int size; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
832 }; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
833 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
834 /* Perform a SHIFT or ROTATE operation by COUNT bits on symbolic |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
835 number N. Return false if the requested operation is not permitted |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
836 on a symbolic number. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
837 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
838 static inline bool |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
839 do_shift_rotate (enum tree_code code, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
840 struct symbolic_number *n, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
841 int count) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
842 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
843 if (count % 8 != 0) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
844 return false; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
845 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
846 /* Zero out the extra bits of N in order to avoid them being shifted |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
847 into the significant bits. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
848 if (n->size < (int)sizeof (HOST_WIDEST_INT)) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
849 n->n &= ((unsigned HOST_WIDEST_INT)1 << (n->size * BITS_PER_UNIT)) - 1; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
850 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
851 switch (code) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
852 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
853 case LSHIFT_EXPR: |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
854 n->n <<= count; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
855 break; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
856 case RSHIFT_EXPR: |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
857 n->n >>= count; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
858 break; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
859 case LROTATE_EXPR: |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
860 n->n = (n->n << count) | (n->n >> ((n->size * BITS_PER_UNIT) - count)); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
861 break; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
862 case RROTATE_EXPR: |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
863 n->n = (n->n >> count) | (n->n << ((n->size * BITS_PER_UNIT) - count)); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
864 break; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
865 default: |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
866 return false; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
867 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
868 return true; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
869 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
870 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
871 /* Perform sanity checking for the symbolic number N and the gimple |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
872 statement STMT. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
873 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
874 static inline bool |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
875 verify_symbolic_number_p (struct symbolic_number *n, gimple stmt) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
876 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
877 tree lhs_type; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
878 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
879 lhs_type = gimple_expr_type (stmt); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
880 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
881 if (TREE_CODE (lhs_type) != INTEGER_TYPE) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
882 return false; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
883 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
884 if (TYPE_PRECISION (lhs_type) != n->size * BITS_PER_UNIT) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
885 return false; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
886 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
887 return true; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
888 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
889 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
890 /* find_bswap_1 invokes itself recursively with N and tries to perform |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
891 the operation given by the rhs of STMT on the result. If the |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
892 operation could successfully be executed the function returns the |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
893 tree expression of the source operand and NULL otherwise. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
894 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
895 static tree |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
896 find_bswap_1 (gimple stmt, struct symbolic_number *n, int limit) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
897 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
898 enum tree_code code; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
899 tree rhs1, rhs2 = NULL; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
900 gimple rhs1_stmt, rhs2_stmt; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
901 tree source_expr1; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
902 enum gimple_rhs_class rhs_class; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
903 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
904 if (!limit || !is_gimple_assign (stmt)) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
905 return NULL_TREE; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
906 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
907 rhs1 = gimple_assign_rhs1 (stmt); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
908 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
909 if (TREE_CODE (rhs1) != SSA_NAME) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
910 return NULL_TREE; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
911 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
912 code = gimple_assign_rhs_code (stmt); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
913 rhs_class = gimple_assign_rhs_class (stmt); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
914 rhs1_stmt = SSA_NAME_DEF_STMT (rhs1); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
915 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
916 if (rhs_class == GIMPLE_BINARY_RHS) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
917 rhs2 = gimple_assign_rhs2 (stmt); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
918 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
919 /* Handle unary rhs and binary rhs with integer constants as second |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
920 operand. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
921 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
922 if (rhs_class == GIMPLE_UNARY_RHS |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
923 || (rhs_class == GIMPLE_BINARY_RHS |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
924 && TREE_CODE (rhs2) == INTEGER_CST)) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
925 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
926 if (code != BIT_AND_EXPR |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
927 && code != LSHIFT_EXPR |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
928 && code != RSHIFT_EXPR |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
929 && code != LROTATE_EXPR |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
930 && code != RROTATE_EXPR |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
931 && code != NOP_EXPR |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
932 && code != CONVERT_EXPR) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
933 return NULL_TREE; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
934 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
935 source_expr1 = find_bswap_1 (rhs1_stmt, n, limit - 1); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
936 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
937 /* If find_bswap_1 returned NULL STMT is a leaf node and we have |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
938 to initialize the symbolic number. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
939 if (!source_expr1) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
940 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
941 /* Set up the symbolic number N by setting each byte to a |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
942 value between 1 and the byte size of rhs1. The highest |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
943 order byte is set to 1 and the lowest order byte to |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
944 n.size. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
945 n->size = TYPE_PRECISION (TREE_TYPE (rhs1)); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
946 if (n->size % BITS_PER_UNIT != 0) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
947 return NULL_TREE; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
948 n->size /= BITS_PER_UNIT; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
949 n->n = (sizeof (HOST_WIDEST_INT) < 8 ? 0 : |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
950 (unsigned HOST_WIDEST_INT)0x01020304 << 32 | 0x05060708); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
951 n->n >>= (sizeof (HOST_WIDEST_INT) - n->size) * BITS_PER_UNIT; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
952 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
953 source_expr1 = rhs1; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
954 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
955 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
956 switch (code) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
957 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
958 case BIT_AND_EXPR: |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
959 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
960 int i; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
961 unsigned HOST_WIDEST_INT val = widest_int_cst_value (rhs2); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
962 unsigned HOST_WIDEST_INT tmp = val; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
963 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
964 /* Only constants masking full bytes are allowed. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
965 for (i = 0; i < n->size; i++, tmp >>= BITS_PER_UNIT) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
966 if ((tmp & 0xff) != 0 && (tmp & 0xff) != 0xff) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
967 return NULL_TREE; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
968 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
969 n->n &= val; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
970 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
971 break; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
972 case LSHIFT_EXPR: |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
973 case RSHIFT_EXPR: |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
974 case LROTATE_EXPR: |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
975 case RROTATE_EXPR: |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
976 if (!do_shift_rotate (code, n, (int)TREE_INT_CST_LOW (rhs2))) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
977 return NULL_TREE; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
978 break; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
979 CASE_CONVERT: |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
980 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
981 int type_size; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
982 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
983 type_size = TYPE_PRECISION (gimple_expr_type (stmt)); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
984 if (type_size % BITS_PER_UNIT != 0) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
985 return NULL_TREE; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
986 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
987 if (type_size / BITS_PER_UNIT < (int)(sizeof (HOST_WIDEST_INT))) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
988 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
989 /* If STMT casts to a smaller type mask out the bits not |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
990 belonging to the target type. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
991 n->size = type_size / BITS_PER_UNIT; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
992 n->n &= ((unsigned HOST_WIDEST_INT)1 << type_size) - 1; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
993 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
994 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
995 break; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
996 default: |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
997 return NULL_TREE; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
998 }; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
999 return verify_symbolic_number_p (n, stmt) ? source_expr1 : NULL; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1000 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1001 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1002 /* Handle binary rhs. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1003 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1004 if (rhs_class == GIMPLE_BINARY_RHS) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1005 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1006 struct symbolic_number n1, n2; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1007 tree source_expr2; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1008 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1009 if (code != BIT_IOR_EXPR) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1010 return NULL_TREE; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1011 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1012 if (TREE_CODE (rhs2) != SSA_NAME) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1013 return NULL_TREE; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1014 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1015 rhs2_stmt = SSA_NAME_DEF_STMT (rhs2); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1016 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1017 switch (code) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1018 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1019 case BIT_IOR_EXPR: |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1020 source_expr1 = find_bswap_1 (rhs1_stmt, &n1, limit - 1); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1021 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1022 if (!source_expr1) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1023 return NULL_TREE; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1024 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1025 source_expr2 = find_bswap_1 (rhs2_stmt, &n2, limit - 1); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1026 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1027 if (source_expr1 != source_expr2 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1028 || n1.size != n2.size) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1029 return NULL_TREE; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1030 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1031 n->size = n1.size; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1032 n->n = n1.n | n2.n; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1033 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1034 if (!verify_symbolic_number_p (n, stmt)) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1035 return NULL_TREE; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1036 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1037 break; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1038 default: |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1039 return NULL_TREE; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1040 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1041 return source_expr1; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1042 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1043 return NULL_TREE; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1044 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1045 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1046 /* Check if STMT completes a bswap implementation consisting of ORs, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1047 SHIFTs and ANDs. Return the source tree expression on which the |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1048 byte swap is performed and NULL if no bswap was found. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1049 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1050 static tree |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1051 find_bswap (gimple stmt) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1052 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1053 /* The number which the find_bswap result should match in order to |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1054 have a full byte swap. The insignificant bytes are masked out |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1055 before using it. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1056 unsigned HOST_WIDEST_INT cmp = |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1057 sizeof (HOST_WIDEST_INT) < 8 ? 0 : |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1058 (unsigned HOST_WIDEST_INT)0x08070605 << 32 | 0x04030201; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1059 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1060 struct symbolic_number n; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1061 tree source_expr; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1062 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1063 /* The last parameter determines the depth search limit. It usually |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1064 correlates directly to the number of bytes to be touched. We |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1065 increase that number by one here in order to also cover signed -> |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1066 unsigned conversions of the src operand as can be seen in |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1067 libgcc. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1068 source_expr = find_bswap_1 (stmt, &n, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1069 TREE_INT_CST_LOW ( |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1070 TYPE_SIZE_UNIT (gimple_expr_type (stmt))) + 1); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1071 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1072 if (!source_expr) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1073 return NULL_TREE; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1074 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1075 /* Zero out the extra bits of N and CMP. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1076 if (n.size < (int)sizeof (HOST_WIDEST_INT)) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1077 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1078 unsigned HOST_WIDEST_INT mask = |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1079 ((unsigned HOST_WIDEST_INT)1 << (n.size * BITS_PER_UNIT)) - 1; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1080 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1081 n.n &= mask; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1082 cmp &= mask; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1083 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1084 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1085 /* A complete byte swap should make the symbolic number to start |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1086 with the largest digit in the highest order byte. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1087 if (cmp != n.n) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1088 return NULL_TREE; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1089 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1090 return source_expr; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1091 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1092 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1093 /* Find manual byte swap implementations and turn them into a bswap |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1094 builtin invokation. */ |
0 | 1095 |
1096 static unsigned int | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1097 execute_optimize_bswap (void) |
0 | 1098 { |
1099 basic_block bb; | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1100 bool bswap32_p, bswap64_p; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1101 bool changed = false; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1102 tree bswap32_type = NULL_TREE, bswap64_type = NULL_TREE; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1103 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1104 if (BITS_PER_UNIT != 8) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1105 return 0; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1106 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1107 if (sizeof (HOST_WIDEST_INT) < 8) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1108 return 0; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1109 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1110 bswap32_p = (built_in_decls[BUILT_IN_BSWAP32] |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1111 && optab_handler (bswap_optab, SImode)->insn_code != |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1112 CODE_FOR_nothing); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1113 bswap64_p = (built_in_decls[BUILT_IN_BSWAP64] |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1114 && optab_handler (bswap_optab, DImode)->insn_code != |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1115 CODE_FOR_nothing); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1116 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1117 if (!bswap32_p && !bswap64_p) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1118 return 0; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1119 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1120 /* Determine the argument type of the builtins. The code later on |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1121 assumes that the return and argument type are the same. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1122 if (bswap32_p) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1123 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1124 tree fndecl = built_in_decls[BUILT_IN_BSWAP32]; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1125 bswap32_type = TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (fndecl))); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1126 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1127 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1128 if (bswap64_p) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1129 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1130 tree fndecl = built_in_decls[BUILT_IN_BSWAP64]; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1131 bswap64_type = TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (fndecl))); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1132 } |
0 | 1133 |
1134 FOR_EACH_BB (bb) | |
1135 { | |
1136 gimple_stmt_iterator gsi; | |
1137 | |
1138 for (gsi = gsi_after_labels (bb); !gsi_end_p (gsi); gsi_next (&gsi)) | |
1139 { | |
1140 gimple stmt = gsi_stmt (gsi); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1141 tree bswap_src, bswap_type; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1142 tree bswap_tmp; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1143 tree fndecl = NULL_TREE; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1144 int type_size; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1145 gimple call; |
0 | 1146 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1147 if (!is_gimple_assign (stmt) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1148 || gimple_assign_rhs_code (stmt) != BIT_IOR_EXPR) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1149 continue; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1150 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1151 type_size = TYPE_PRECISION (gimple_expr_type (stmt)); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1152 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1153 switch (type_size) |
0 | 1154 { |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1155 case 32: |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1156 if (bswap32_p) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1157 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1158 fndecl = built_in_decls[BUILT_IN_BSWAP32]; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1159 bswap_type = bswap32_type; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1160 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1161 break; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1162 case 64: |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1163 if (bswap64_p) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1164 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1165 fndecl = built_in_decls[BUILT_IN_BSWAP64]; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1166 bswap_type = bswap64_type; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1167 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1168 break; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1169 default: |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1170 continue; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1171 } |
0 | 1172 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1173 if (!fndecl) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1174 continue; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1175 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1176 bswap_src = find_bswap (stmt); |
0 | 1177 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1178 if (!bswap_src) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1179 continue; |
0 | 1180 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1181 changed = true; |
0 | 1182 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1183 bswap_tmp = bswap_src; |
0 | 1184 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1185 /* Convert the src expression if necessary. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1186 if (!useless_type_conversion_p (TREE_TYPE (bswap_tmp), bswap_type)) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1187 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1188 gimple convert_stmt; |
0 | 1189 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1190 bswap_tmp = create_tmp_var (bswap_type, "bswapsrc"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1191 add_referenced_var (bswap_tmp); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1192 bswap_tmp = make_ssa_name (bswap_tmp, NULL); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1193 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1194 convert_stmt = gimple_build_assign_with_ops ( |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1195 CONVERT_EXPR, bswap_tmp, bswap_src, NULL); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1196 gsi_insert_before (&gsi, convert_stmt, GSI_SAME_STMT); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1197 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1198 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1199 call = gimple_build_call (fndecl, 1, bswap_tmp); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1200 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1201 bswap_tmp = gimple_assign_lhs (stmt); |
0 | 1202 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1203 /* Convert the result if necessary. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1204 if (!useless_type_conversion_p (TREE_TYPE (bswap_tmp), bswap_type)) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1205 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1206 gimple convert_stmt; |
0 | 1207 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1208 bswap_tmp = create_tmp_var (bswap_type, "bswapdst"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1209 add_referenced_var (bswap_tmp); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1210 bswap_tmp = make_ssa_name (bswap_tmp, NULL); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1211 convert_stmt = gimple_build_assign_with_ops ( |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1212 CONVERT_EXPR, gimple_assign_lhs (stmt), bswap_tmp, NULL); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1213 gsi_insert_after (&gsi, convert_stmt, GSI_SAME_STMT); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1214 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1215 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1216 gimple_call_set_lhs (call, bswap_tmp); |
0 | 1217 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1218 if (dump_file) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1219 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1220 fprintf (dump_file, "%d bit bswap implementation found at: ", |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1221 (int)type_size); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1222 print_gimple_stmt (dump_file, stmt, 0, 0); |
0 | 1223 } |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1224 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1225 gsi_insert_after (&gsi, call, GSI_SAME_STMT); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1226 gsi_remove (&gsi, true); |
0 | 1227 } |
1228 } | |
1229 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1230 return (changed ? TODO_dump_func | TODO_update_ssa | TODO_verify_ssa |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1231 | TODO_verify_stmts : 0); |
0 | 1232 } |
1233 | |
1234 static bool | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1235 gate_optimize_bswap (void) |
0 | 1236 { |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1237 return flag_expensive_optimizations && optimize; |
0 | 1238 } |
1239 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1240 struct gimple_opt_pass pass_optimize_bswap = |
0 | 1241 { |
1242 { | |
1243 GIMPLE_PASS, | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1244 "bswap", /* name */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1245 gate_optimize_bswap, /* gate */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1246 execute_optimize_bswap, /* execute */ |
0 | 1247 NULL, /* sub */ |
1248 NULL, /* next */ | |
1249 0, /* static_pass_number */ | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1250 TV_NONE, /* tv_id */ |
0 | 1251 PROP_ssa, /* properties_required */ |
1252 0, /* properties_provided */ | |
1253 0, /* properties_destroyed */ | |
1254 0, /* todo_flags_start */ | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
1255 0 /* todo_flags_finish */ |
0 | 1256 } |
1257 }; |