diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-07-28 14:33:56 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-07-28 14:33:56 +0000 |
commit | 75a70cf95f65fe9204b15ad9aba31c571381d224 (patch) | |
tree | 2926705dd533a8904679724ab1cec40dfee45094 /gcc/tree-ssa-ter.c | |
parent | d0a9db40355cf570989e2aca92ab2060df234926 (diff) | |
download | gcc-75a70cf95f65fe9204b15ad9aba31c571381d224.tar.gz |
2008-07-28 Richard Guenther <rguenther@suse.de>
Merge from gimple-tuples-branch.
* ChangeLog.tuples: ChangeLog from gimple-tuples-branch.
* gimple.def: New file.
* gsstruct.def: Likewise.
* gimple-iterator.c: Likewise.
* gimple-pretty-print.c: Likewise.
* tree-gimple.c: Removed. Merged into ...
* gimple.c: ... here. New file.
* tree-gimple.h: Removed. Merged into ...
* gimple.h: ... here. New file.
* Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h.
* configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the
--enable-checking=gimple flag.
* config.in: Likewise.
* configure: Regenerated.
* tree-ssa-operands.h: Tuplified.
* tree-vrp.c: Likewise.
* tree-loop-linear.c: Likewise.
* tree-into-ssa.c: Likewise.
* tree-ssa-loop-im.c: Likewise.
* tree-dump.c: Likewise.
* tree-complex.c: Likewise.
* cgraphbuild.c: Likewise.
* tree-ssa-threadupdate.c: Likewise.
* tree-ssa-loop-niter.c: Likewise.
* tree-pretty-print.c: Likewise.
* tracer.c: Likewise.
* gengtype.c: Likewise.
* tree-loop-distribution.c: Likewise.
* tree-ssa-loop-unswitch.c: Likewise.
* cgraph.c: Likewise.
* cgraph.h: Likewise.
* tree-ssa-loop-manip.c: Likewise.
* value-prof.c: Likewise.
* tree-ssa-loop-ch.c: Likewise.
* tree-tailcall.c: Likewise.
* value-prof.h: Likewise.
* tree.c: Likewise.
* tree.h: Likewise.
* tree-pass.h: Likewise.
* ipa-cp.c: Likewise.
* tree-scalar-evolution.c: Likewise.
* tree-scalar-evolution.h: Likewise.
* target.h: Likewise.
* lambda-mat.c: Likewise.
* tree-phinodes.c: Likewise.
* diagnostic.h: Likewise.
* builtins.c: Likewise.
* tree-ssa-alias-warnings.c: Likewise.
* cfghooks.c: Likewise.
* fold-const.c: Likewise.
* cfghooks.h: Likewise.
* omp-low.c: Likewise.
* tree-ssa-dse.c: Likewise.
* ipa-reference.c: Likewise.
* tree-ssa-uncprop.c: Likewise.
* toplev.c: Likewise.
* tree-gimple.c: Likewise.
* tree-gimple.h: Likewise.
* tree-chrec.c: Likewise.
* tree-chrec.h: Likewise.
* tree-ssa-sccvn.c: Likewise.
* tree-ssa-sccvn.h: Likewise.
* cgraphunit.c: Likewise.
* tree-ssa-copyrename.c: Likewise.
* tree-ssa-ccp.c: Likewise.
* tree-ssa-loop-ivopts.c: Likewise.
* tree-nomudflap.c: Likewise.
* tree-call-cdce.c: Likewise.
* ipa-pure-const.c: Likewise.
* c-format.c: Likewise.
* tree-stdarg.c: Likewise.
* tree-ssa-math-opts.c: Likewise.
* tree-ssa-dom.c: Likewise.
* tree-nrv.c: Likewise.
* tree-ssa-propagate.c: Likewise.
* ipa-utils.c: Likewise.
* tree-ssa-propagate.h: Likewise.
* tree-ssa-alias.c: Likewise.
* gimple-low.c: Likewise.
* tree-ssa-sink.c: Likewise.
* ipa-inline.c: Likewise.
* c-semantics.c: Likewise.
* dwarf2out.c: Likewise.
* expr.c: Likewise.
* tree-ssa-loop-ivcanon.c: Likewise.
* predict.c: Likewise.
* tree-ssa-loop.c: Likewise.
* tree-parloops.c: Likewise.
* tree-ssa-address.c: Likewise.
* tree-ssa-ifcombine.c: Likewise.
* matrix-reorg.c: Likewise.
* c-decl.c: Likewise.
* tree-eh.c: Likewise.
* c-pretty-print.c: Likewise.
* lambda-trans.c: Likewise.
* function.c: Likewise.
* langhooks.c: Likewise.
* ebitmap.h: Likewise.
* tree-vectorizer.c: Likewise.
* function.h: Likewise.
* langhooks.h: Likewise.
* tree-vectorizer.h: Likewise.
* ipa-type-escape.c: Likewise.
* ipa-type-escape.h: Likewise.
* domwalk.c: Likewise.
* tree-if-conv.c: Likewise.
* profile.c: Likewise.
* domwalk.h: Likewise.
* tree-data-ref.c: Likewise.
* tree-data-ref.h: Likewise.
* tree-flow-inline.h: Likewise.
* tree-affine.c: Likewise.
* tree-vect-analyze.c: Likewise.
* c-typeck.c: Likewise.
* gimplify.c: Likewise.
* coretypes.h: Likewise.
* tree-ssa-phiopt.c: Likewise.
* calls.c: Likewise.
* tree-ssa-coalesce.c: Likewise.
* tree.def: Likewise.
* tree-dfa.c: Likewise.
* except.c: Likewise.
* except.h: Likewise.
* cfgexpand.c: Likewise.
* tree-cfgcleanup.c: Likewise.
* tree-ssa-pre.c: Likewise.
* tree-ssa-live.c: Likewise.
* tree-sra.c: Likewise.
* tree-ssa-live.h: Likewise.
* tree-predcom.c: Likewise.
* lambda.h: Likewise.
* tree-mudflap.c: Likewise.
* ipa-prop.c: Likewise.
* print-tree.c: Likewise.
* tree-ssa-copy.c: Likewise.
* ipa-prop.h: Likewise.
* tree-ssa-forwprop.c: Likewise.
* ggc-page.c: Likewise.
* c-omp.c: Likewise.
* tree-ssa-dce.c: Likewise.
* tree-vect-patterns.c: Likewise.
* tree-ssa-ter.c: Likewise.
* tree-nested.c: Likewise.
* tree-ssa.c: Likewise.
* lambda-code.c: Likewise.
* tree-ssa-loop-prefetch.c: Likewise.
* tree-inline.c: Likewise.
* tree-inline.h: Likewise.
* tree-iterator.c: Likewise.
* tree-optimize.c: Likewise.
* tree-ssa-phiprop.c: Likewise.
* tree-vect-transform.c: Likewise.
* tree-object-size.c: Likewise.
* tree-outof-ssa.c: Likewise.
* cfgloop.c: Likewise.
* system.h: Likewise.
* tree-profile.c: Likewise.
* cfgloop.h: Likewise.
* c-gimplify.c: Likewise.
* c-common.c: Likewise.
* tree-vect-generic.c: Likewise.
* tree-flow.h: Likewise.
* c-common.h: Likewise.
* basic-block.h: Likewise.
* tree-ssa-structalias.c: Likewise.
* tree-switch-conversion.c: Likewise.
* tree-ssa-structalias.h: Likewise.
* tree-cfg.c: Likewise.
* passes.c: Likewise.
* ipa-struct-reorg.c: Likewise.
* ipa-struct-reorg.h: Likewise.
* tree-ssa-reassoc.c: Likewise.
* cfgrtl.c: Likewise.
* varpool.c: Likewise.
* stmt.c: Likewise.
* tree-ssanames.c: Likewise.
* tree-ssa-threadedge.c: Likewise.
* langhooks-def.h: Likewise.
* tree-ssa-operands.c: Likewise.
* config/alpha/alpha.c: Likewise.
* config/frv/frv.c: Likewise.
* config/s390/s390.c: Likewise.
* config/m32c/m32c.c: Likewise.
* config/m32c/m32c-protos.h: Likewise.
* config/spu/spu.c: Likewise.
* config/sparc/sparc.c: Likewise.
* config/i386/i386.c: Likewise.
* config/sh/sh.c: Likewise.
* config/xtensa/xtensa.c: Likewise.
* config/stormy16/stormy16.c: Likewise.
* config/ia64/ia64.c: Likewise.
* config/rs6000/rs6000.c: Likewise.
* config/pa/pa.c: Likewise.
* config/mips/mips.c: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@138207 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-ter.c')
-rw-r--r-- | gcc/tree-ssa-ter.c | 101 |
1 files changed, 43 insertions, 58 deletions
diff --git a/gcc/tree-ssa-ter.c b/gcc/tree-ssa-ter.c index e02867520c8..099c19742e4 100644 --- a/gcc/tree-ssa-ter.c +++ b/gcc/tree-ssa-ter.c @@ -89,7 +89,7 @@ along with GCC; see the file COPYING3. If not see TER implements this but stepping through the instructions in a block and tracking potential expressions for replacement, and the partitions they are dependent on. Expressions are represented by the SSA_NAME_VERSION of the - DEF on the LHS of a GIMPLE_MODIFY_STMT and the expression is the RHS. + DEF on the LHS of a GIMPLE_ASSIGN and the expression is the RHS. When a stmt is determined to be a possible replacement expression, the following steps are taken: @@ -159,7 +159,7 @@ typedef struct temp_expr_table_d { var_map map; bitmap *partition_dependencies; /* Partitions expr is dependent on. */ - tree *replaceable_expressions; /* Replacement expression table. */ + gimple *replaceable_expressions; /* Replacement expression table. */ bitmap *expr_decl_uids; /* Base uids of exprs. */ bitmap *kill_list; /* Expr's killed by a partition. */ int virtual_partition; /* Pseudo partition for virtual ops. */ @@ -216,10 +216,10 @@ new_temp_expr_table (var_map map) /* Free TER table T. If there are valid replacements, return the expression vector. */ -static tree * +static gimple * free_temp_expr_table (temp_expr_table_p t) { - tree *ret = NULL; + gimple *ret = NULL; unsigned i; #ifdef ENABLE_CHECKING @@ -255,7 +255,7 @@ version_to_be_replaced_p (temp_expr_table_p tab, int version) { if (!tab->replaceable_expressions) return false; - return tab->replaceable_expressions[version] != NULL_TREE; + return tab->replaceable_expressions[version] != NULL; } @@ -360,20 +360,20 @@ add_dependence (temp_expr_table_p tab, int version, tree var) /* Return TRUE if expression STMT is suitable for replacement. */ static inline bool -is_replaceable_p (tree stmt) +is_replaceable_p (gimple stmt) { - tree call_expr; use_operand_p use_p; - tree def, use_stmt; + tree def; + gimple use_stmt; location_t locus1, locus2; tree block1, block2; /* Only consider modify stmts. */ - if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT) + if (!is_gimple_assign (stmt)) return false; /* If the statement may throw an exception, it cannot be replaced. */ - if (tree_could_throw_p (stmt)) + if (stmt_could_throw_p (stmt)) return false; /* Punt if there is more than 1 def. */ @@ -386,33 +386,21 @@ is_replaceable_p (tree stmt) return false; /* If the use isn't in this block, it wont be replaced either. */ - if (bb_for_stmt (use_stmt) != bb_for_stmt (stmt)) + if (gimple_bb (use_stmt) != gimple_bb (stmt)) return false; - if (GIMPLE_STMT_P (stmt)) - { - locus1 = GIMPLE_STMT_LOCUS (stmt); - block1 = GIMPLE_STMT_BLOCK (stmt); - } - else - { - locus1 = *EXPR_LOCUS (stmt); - block1 = TREE_BLOCK (stmt); - } - if (GIMPLE_STMT_P (use_stmt)) - { - locus2 = GIMPLE_STMT_LOCUS (use_stmt); - block2 = GIMPLE_STMT_BLOCK (use_stmt); - } - if (TREE_CODE (use_stmt) == PHI_NODE) + locus1 = gimple_location (stmt); + block1 = gimple_block (stmt); + + if (gimple_code (use_stmt) == GIMPLE_PHI) { locus2 = 0; block2 = NULL_TREE; } else { - locus2 = *EXPR_LOCUS (use_stmt); - block2 = TREE_BLOCK (use_stmt); + locus2 = gimple_location (use_stmt); + block2 = gimple_block (use_stmt); } if (!optimize @@ -420,7 +408,7 @@ is_replaceable_p (tree stmt) return false; /* Used in this block, but at the TOP of the block, not the end. */ - if (TREE_CODE (use_stmt) == PHI_NODE) + if (gimple_code (use_stmt) == GIMPLE_PHI) return false; /* There must be no VDEFs. */ @@ -428,26 +416,26 @@ is_replaceable_p (tree stmt) return false; /* Without alias info we can't move around loads. */ - if (stmt_ann (stmt)->references_memory && !optimize) + if (gimple_references_memory_p (stmt) && !optimize) return false; /* Float expressions must go through memory if float-store is on. */ if (flag_float_store - && FLOAT_TYPE_P (TREE_TYPE (GENERIC_TREE_OPERAND (stmt, 1)))) + && FLOAT_TYPE_P (gimple_expr_type (stmt))) return false; /* An assignment with a register variable on the RHS is not replaceable. */ - if (TREE_CODE (GENERIC_TREE_OPERAND (stmt, 1)) == VAR_DECL - && DECL_HARD_REGISTER (GENERIC_TREE_OPERAND (stmt, 1))) + if (gimple_assign_rhs_code (stmt) == VAR_DECL + && DECL_HARD_REGISTER (gimple_assign_rhs1 (stmt))) return false; /* No function calls can be replaced. */ - if ((call_expr = get_call_expr_in (stmt)) != NULL_TREE) + if (is_gimple_call (stmt)) return false; /* Leave any stmt with volatile operands alone as well. */ - if (stmt_ann (stmt)->has_volatile_ops) + if (gimple_has_volatile_ops (stmt)) return false; return true; @@ -480,7 +468,7 @@ finished_with_expr (temp_expr_table_p tab, int version, bool free_expr) /* Create an expression entry for a replaceable expression. */ static void -process_replaceable (temp_expr_table_p tab, tree stmt) +process_replaceable (temp_expr_table_p tab, gimple stmt) { tree var, def, basevar; int version; @@ -574,7 +562,7 @@ mark_replaceable (temp_expr_table_p tab, tree var, bool more_replacing) /* Set the replaceable expression. */ if (!tab->replaceable_expressions) - tab->replaceable_expressions = XCNEWVEC (tree, num_ssa_names + 1); + tab->replaceable_expressions = XCNEWVEC (gimple, num_ssa_names + 1); tab->replaceable_expressions[version] = SSA_NAME_DEF_STMT (var); } @@ -585,20 +573,20 @@ mark_replaceable (temp_expr_table_p tab, tree var, bool more_replacing) static void find_replaceable_in_bb (temp_expr_table_p tab, basic_block bb) { - block_stmt_iterator bsi; - tree stmt, def, use; - stmt_ann_t ann; + gimple_stmt_iterator bsi; + gimple stmt; + tree def, use; int partition; var_map map = tab->map; ssa_op_iter iter; bool stmt_replaceable; - for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi)) + for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi)) { - stmt = bsi_stmt (bsi); - ann = stmt_ann (stmt); + stmt = gsi_stmt (bsi); stmt_replaceable = is_replaceable_p (stmt); + /* Determine if this stmt finishes an existing expression. */ FOR_EACH_SSA_TREE_OPERAND (use, stmt, iter, SSA_OP_USE) { @@ -627,7 +615,7 @@ find_replaceable_in_bb (temp_expr_table_p tab, basic_block bb) /* Mark expression as replaceable unless stmt is volatile or the def variable has the same root variable as something in the substitution list. */ - if (ann->has_volatile_ops || same_root_var) + if (gimple_has_volatile_ops (stmt) || same_root_var) finished_with_expr (tab, ver, true); else mark_replaceable (tab, use, stmt_replaceable); @@ -665,12 +653,12 @@ find_replaceable_in_bb (temp_expr_table_p tab, basic_block bb) NULL is returned by the function, otherwise an expression vector indexed by SSA_NAME version numbers. */ -extern tree * +extern gimple * find_replaceable_exprs (var_map map) { basic_block bb; temp_expr_table_p table; - tree *ret; + gimple *ret; table = new_temp_expr_table (map); FOR_EACH_BB (bb) @@ -700,23 +688,20 @@ find_replaceable_exprs (var_map map) /* Dump TER expression table EXPR to file F. */ -extern void -dump_replaceable_exprs (FILE *f, tree *expr) +void +dump_replaceable_exprs (FILE *f, gimple *expr) { - tree stmt, var; - int x; + tree var; + unsigned x; fprintf (f, "\nReplacing Expressions\n"); - for (x = 0; x < (int)num_ssa_names; x++) + for (x = 0; x < num_ssa_names; x++) if (expr[x]) { - stmt = expr[x]; - var = SINGLE_SSA_TREE_OPERAND (stmt, SSA_OP_DEF); - gcc_assert (var != NULL_TREE); + var = ssa_name (x); print_generic_expr (f, var, TDF_SLIM); fprintf (f, " replace with --> "); - print_generic_expr (f, GENERIC_TREE_OPERAND (stmt, 1), - TDF_SLIM); + print_gimple_stmt (f, expr[x], 0, TDF_SLIM); fprintf (f, "\n"); } fprintf (f, "\n"); @@ -728,7 +713,7 @@ dump_replaceable_exprs (FILE *f, tree *expr) exclusively to debug TER. F is the place to send debug info and T is the table being debugged. */ -extern void +void debug_ter (FILE *f, temp_expr_table_p t) { unsigned x, y; |