Mercurial > hg > CbC > CbC_gcc
comparison gcc/tree-ssa-uncprop.c @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children | 1830386684a0 |
comparison
equal
deleted
inserted
replaced
111:04ced10e8804 | 131:84e7813d76e9 |
---|---|
1 /* Routines for discovering and unpropagating edge equivalences. | 1 /* Routines for discovering and unpropagating edge equivalences. |
2 Copyright (C) 2005-2017 Free Software Foundation, Inc. | 2 Copyright (C) 2005-2018 Free Software Foundation, Inc. |
3 | 3 |
4 This file is part of GCC. | 4 This file is part of GCC. |
5 | 5 |
6 GCC is free software; you can redistribute it and/or modify | 6 GCC is free software; you can redistribute it and/or modify |
7 it under the terms of the GNU General Public License as published by | 7 it under the terms of the GNU General Public License as published by |
182 which are reached by a single case label which represents | 182 which are reached by a single case label which represents |
183 a single value. */ | 183 a single value. */ |
184 for (i = 0; i < n_labels; i++) | 184 for (i = 0; i < n_labels; i++) |
185 { | 185 { |
186 tree label = gimple_switch_label (switch_stmt, i); | 186 tree label = gimple_switch_label (switch_stmt, i); |
187 basic_block bb = label_to_block (CASE_LABEL (label)); | 187 basic_block bb = label_to_block (cfun, CASE_LABEL (label)); |
188 | 188 |
189 if (CASE_HIGH (label) | 189 if (CASE_HIGH (label) |
190 || !CASE_LOW (label) | 190 || !CASE_LOW (label) |
191 || info[bb->index]) | 191 || info[bb->index]) |
192 info[bb->index] = error_mark_node; | 192 info[bb->index] = error_mark_node; |
406 remove_equivalence (equiv->rhs); | 406 remove_equivalence (equiv->rhs); |
407 } | 407 } |
408 } | 408 } |
409 } | 409 } |
410 | 410 |
411 /* Ignoring loop backedges, if BB has precisely one incoming edge then | |
412 return that edge. Otherwise return NULL. */ | |
413 static edge | |
414 single_incoming_edge_ignoring_loop_edges (basic_block bb) | |
415 { | |
416 edge retval = NULL; | |
417 edge e; | |
418 edge_iterator ei; | |
419 | |
420 FOR_EACH_EDGE (e, ei, bb->preds) | |
421 { | |
422 /* A loop back edge can be identified by the destination of | |
423 the edge dominating the source of the edge. */ | |
424 if (dominated_by_p (CDI_DOMINATORS, e->src, e->dest)) | |
425 continue; | |
426 | |
427 /* If we have already seen a non-loop edge, then we must have | |
428 multiple incoming non-loop edges and thus we return NULL. */ | |
429 if (retval) | |
430 return NULL; | |
431 | |
432 /* This is the first non-loop incoming edge we have found. Record | |
433 it. */ | |
434 retval = e; | |
435 } | |
436 | |
437 return retval; | |
438 } | |
439 | |
440 edge | 411 edge |
441 uncprop_dom_walker::before_dom_children (basic_block bb) | 412 uncprop_dom_walker::before_dom_children (basic_block bb) |
442 { | 413 { |
443 basic_block parent; | 414 basic_block parent; |
444 edge e; | |
445 bool recorded = false; | 415 bool recorded = false; |
446 | 416 |
447 /* If this block is dominated by a single incoming edge and that edge | 417 /* If this block is dominated by a single incoming edge and that edge |
448 has an equivalency, then record the equivalency and push the | 418 has an equivalency, then record the equivalency and push the |
449 VALUE onto EQUIV_STACK. Else push a NULL entry on EQUIV_STACK. */ | 419 VALUE onto EQUIV_STACK. Else push a NULL entry on EQUIV_STACK. */ |
450 parent = get_immediate_dominator (CDI_DOMINATORS, bb); | 420 parent = get_immediate_dominator (CDI_DOMINATORS, bb); |
451 if (parent) | 421 if (parent) |
452 { | 422 { |
453 e = single_incoming_edge_ignoring_loop_edges (bb); | 423 edge e = single_pred_edge_ignoring_loop_edges (bb, false); |
454 | 424 |
455 if (e && e->src == parent && e->aux) | 425 if (e && e->src == parent && e->aux) |
456 { | 426 { |
457 struct edge_equivalency *equiv = (struct edge_equivalency *) e->aux; | 427 struct edge_equivalency *equiv = (struct edge_equivalency *) e->aux; |
458 | 428 |