diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-11-27 12:04:21 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-11-27 12:04:21 +0000 |
commit | 58287c3f4b74a0bb479c7036117d5804eb6765c4 (patch) | |
tree | c299b554740820453d3def4a8e59007a86edd7c7 /gcc/tree-ssa-phiopt.c | |
parent | db827453ce1b7f76552f8ba9a8d18e65d7bf8de8 (diff) | |
download | gcc-58287c3f4b74a0bb479c7036117d5804eb6765c4.tar.gz |
2012-11-26 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 193836 using svnmerge.py
**broken, gcc/melt/xtramelt-ana-base.melt dont compile**
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@193843 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-phiopt.c')
-rw-r--r-- | gcc/tree-ssa-phiopt.c | 68 |
1 files changed, 35 insertions, 33 deletions
diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c index 3856b92ac0d..8a3789d94d2 100644 --- a/gcc/tree-ssa-phiopt.c +++ b/gcc/tree-ssa-phiopt.c @@ -1574,15 +1574,15 @@ cond_if_else_store_replacement (basic_block then_bb, basic_block else_bb, { gimple then_assign = last_and_only_stmt (then_bb); gimple else_assign = last_and_only_stmt (else_bb); - VEC (data_reference_p, heap) *then_datarefs, *else_datarefs; - VEC (ddr_p, heap) *then_ddrs, *else_ddrs; + vec<data_reference_p> then_datarefs, else_datarefs; + vec<ddr_p> then_ddrs, else_ddrs; gimple then_store, else_store; bool found, ok = false, res; struct data_dependence_relation *ddr; data_reference_p then_dr, else_dr; int i, j; tree then_lhs, else_lhs; - VEC (gimple, heap) *then_stores, *else_stores; + vec<gimple> then_stores, else_stores; basic_block blocks[3]; if (MAX_STORES_TO_SINK == 0) @@ -1594,14 +1594,14 @@ cond_if_else_store_replacement (basic_block then_bb, basic_block else_bb, then_assign, else_assign); /* Find data references. */ - then_datarefs = VEC_alloc (data_reference_p, heap, 1); - else_datarefs = VEC_alloc (data_reference_p, heap, 1); + then_datarefs.create (1); + else_datarefs.create (1); if ((find_data_references_in_bb (NULL, then_bb, &then_datarefs) == chrec_dont_know) - || !VEC_length (data_reference_p, then_datarefs) + || !then_datarefs.length () || (find_data_references_in_bb (NULL, else_bb, &else_datarefs) == chrec_dont_know) - || !VEC_length (data_reference_p, else_datarefs)) + || !else_datarefs.length ()) { free_data_refs (then_datarefs); free_data_refs (else_datarefs); @@ -1609,9 +1609,9 @@ cond_if_else_store_replacement (basic_block then_bb, basic_block else_bb, } /* Find pairs of stores with equal LHS. */ - then_stores = VEC_alloc (gimple, heap, 1); - else_stores = VEC_alloc (gimple, heap, 1); - FOR_EACH_VEC_ELT (data_reference_p, then_datarefs, i, then_dr) + then_stores.create (1); + else_stores.create (1); + FOR_EACH_VEC_ELT (then_datarefs, i, then_dr) { if (DR_IS_READ (then_dr)) continue; @@ -1620,7 +1620,7 @@ cond_if_else_store_replacement (basic_block then_bb, basic_block else_bb, then_lhs = gimple_get_lhs (then_store); found = false; - FOR_EACH_VEC_ELT (data_reference_p, else_datarefs, j, else_dr) + FOR_EACH_VEC_ELT (else_datarefs, j, else_dr) { if (DR_IS_READ (else_dr)) continue; @@ -1638,33 +1638,35 @@ cond_if_else_store_replacement (basic_block then_bb, basic_block else_bb, if (!found) continue; - VEC_safe_push (gimple, heap, then_stores, then_store); - VEC_safe_push (gimple, heap, else_stores, else_store); + then_stores.safe_push (then_store); + else_stores.safe_push (else_store); } /* No pairs of stores found. */ - if (!VEC_length (gimple, then_stores) - || VEC_length (gimple, then_stores) > (unsigned) MAX_STORES_TO_SINK) + if (!then_stores.length () + || then_stores.length () > (unsigned) MAX_STORES_TO_SINK) { free_data_refs (then_datarefs); free_data_refs (else_datarefs); - VEC_free (gimple, heap, then_stores); - VEC_free (gimple, heap, else_stores); + then_stores.release (); + else_stores.release (); return false; } /* Compute and check data dependencies in both basic blocks. */ - then_ddrs = VEC_alloc (ddr_p, heap, 1); - else_ddrs = VEC_alloc (ddr_p, heap, 1); - if (!compute_all_dependences (then_datarefs, &then_ddrs, NULL, false) - || !compute_all_dependences (else_datarefs, &else_ddrs, NULL, false)) + then_ddrs.create (1); + else_ddrs.create (1); + if (!compute_all_dependences (then_datarefs, &then_ddrs, + vNULL, false) + || !compute_all_dependences (else_datarefs, &else_ddrs, + vNULL, false)) { free_dependence_relations (then_ddrs); free_dependence_relations (else_ddrs); free_data_refs (then_datarefs); free_data_refs (else_datarefs); - VEC_free (gimple, heap, then_stores); - VEC_free (gimple, heap, else_stores); + then_stores.release (); + else_stores.release (); return false; } blocks[0] = then_bb; @@ -1674,7 +1676,7 @@ cond_if_else_store_replacement (basic_block then_bb, basic_block else_bb, /* Check that there are no read-after-write or write-after-write dependencies in THEN_BB. */ - FOR_EACH_VEC_ELT (ddr_p, then_ddrs, i, ddr) + FOR_EACH_VEC_ELT (then_ddrs, i, ddr) { struct data_reference *dra = DDR_A (ddr); struct data_reference *drb = DDR_B (ddr); @@ -1690,15 +1692,15 @@ cond_if_else_store_replacement (basic_block then_bb, basic_block else_bb, free_dependence_relations (else_ddrs); free_data_refs (then_datarefs); free_data_refs (else_datarefs); - VEC_free (gimple, heap, then_stores); - VEC_free (gimple, heap, else_stores); + then_stores.release (); + else_stores.release (); return false; } } /* Check that there are no read-after-write or write-after-write dependencies in ELSE_BB. */ - FOR_EACH_VEC_ELT (ddr_p, else_ddrs, i, ddr) + FOR_EACH_VEC_ELT (else_ddrs, i, ddr) { struct data_reference *dra = DDR_A (ddr); struct data_reference *drb = DDR_B (ddr); @@ -1714,16 +1716,16 @@ cond_if_else_store_replacement (basic_block then_bb, basic_block else_bb, free_dependence_relations (else_ddrs); free_data_refs (then_datarefs); free_data_refs (else_datarefs); - VEC_free (gimple, heap, then_stores); - VEC_free (gimple, heap, else_stores); + then_stores.release (); + else_stores.release (); return false; } } /* Sink stores with same LHS. */ - FOR_EACH_VEC_ELT (gimple, then_stores, i, then_store) + FOR_EACH_VEC_ELT (then_stores, i, then_store) { - else_store = VEC_index (gimple, else_stores, i); + else_store = else_stores[i]; res = cond_if_else_store_replacement_1 (then_bb, else_bb, join_bb, then_store, else_store); ok = ok || res; @@ -1733,8 +1735,8 @@ cond_if_else_store_replacement (basic_block then_bb, basic_block else_bb, free_dependence_relations (else_ddrs); free_data_refs (then_datarefs); free_data_refs (else_datarefs); - VEC_free (gimple, heap, then_stores); - VEC_free (gimple, heap, else_stores); + then_stores.release (); + else_stores.release (); return ok; } |