aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vectorizer.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2007-01-08 12:13:14 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2007-01-08 11:13:14 +0000
commitf4b3ca7277845d4444997924301da6225ce19001 (patch)
tree5658297c549eec3a1a45febe1d3d11e413cc482c /gcc/tree-vectorizer.c
parent2fe29729951cda1678804a3e681b145430cd068c (diff)
downloadgcc-f4b3ca7277845d4444997924301da6225ce19001.zip
gcc-f4b3ca7277845d4444997924301da6225ce19001.tar.gz
gcc-f4b3ca7277845d4444997924301da6225ce19001.tar.bz2
tree-pas.h (TODO_remove_function): New flag.
* tree-pas.h (TODO_remove_function): New flag. (TODO_update*): Renumber. (pass_ipa_increase_alignment, pass_ipa_function_and_variable_visibility): New passes. * cgraphunit.c (cgraph_increase_alignment): Move to tree-vectorizer.c (cgraph_function_and_variable_visibility): Move to ipa.c (cgraph_optimize): Don't call cgraph_function_and_variable_visibility, cgraph_increase_alignment. * ipa-inline.c (cgraph_decide_inlining): Don't push timevar. (cgraph_decide_inlining_incrementally): Push TV_INTEGRATION before calling tree-inline. (cgraph_early_inlining): Do not call cgraph_remove_unreachable_nodes. (pass_ipa_inline, pass_early_ipa_inlining): Set TODO_remove_functions * tree-vectorizer.c (increase_alignment): Move here from cgraphunit.c (gate_increase_alignment): New function. (pass_ipa_increase_alignment): New pass. * ipa.c: Inline tree-pass.h and timevar.h (function_and_variable_visibility): Move here from cgraphunit.c * tree-optimize.c (pass_early_local_passes): Add TODO_remove_functions. * passes.c (init_optimization_passes): Add the two new passes. (execute_todo): Handle cgraph_remove_functions. From-SVN: r120576
Diffstat (limited to 'gcc/tree-vectorizer.c')
-rw-r--r--gcc/tree-vectorizer.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c
index f8c01f9..aeda161 100644
--- a/gcc/tree-vectorizer.c
+++ b/gcc/tree-vectorizer.c
@@ -2211,3 +2211,69 @@ vectorize_loops (void)
return num_vectorized_loops > 0 ? TODO_cleanup_cfg : 0;
}
+
+/* Increase alignment of global arrays to improve vectorization potential.
+ TODO:
+ - Consider also structs that have an array field.
+ - Use ipa analysis to prune arrays that can't be vectorized?
+ This should involve global alignment analysis and in the future also
+ array padding. */
+
+static unsigned int
+increase_alignment (void)
+{
+ struct varpool_node *vnode;
+
+ /* Increase the alignment of all global arrays for vectorization. */
+ for (vnode = varpool_nodes_queue;
+ vnode;
+ vnode = vnode->next_needed)
+ {
+ tree vectype, decl = vnode->decl;
+ unsigned int alignment;
+
+ if (TREE_CODE (TREE_TYPE (decl)) != ARRAY_TYPE)
+ continue;
+ vectype = get_vectype_for_scalar_type (TREE_TYPE (TREE_TYPE (decl)));
+ if (!vectype)
+ continue;
+ alignment = TYPE_ALIGN (vectype);
+ if (DECL_ALIGN (decl) >= alignment)
+ continue;
+
+ if (vect_can_force_dr_alignment_p (decl, alignment))
+ {
+ DECL_ALIGN (decl) = TYPE_ALIGN (vectype);
+ DECL_USER_ALIGN (decl) = 1;
+ if (dump_file)
+ {
+ fprintf (dump_file, "Increasing alignment of decl: ");
+ print_generic_expr (dump_file, decl, TDF_SLIM);
+ }
+ }
+ }
+ return 0;
+}
+
+static int
+gate_increase_alignment (void)
+{
+ return flag_section_anchors && flag_tree_vectorize;
+}
+
+struct tree_opt_pass pass_ipa_increase_alignment =
+{
+ "increase_alignment", /* name */
+ gate_increase_alignment, /* gate */
+ increase_alignment, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ 0, /* tv_id */
+ 0, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ 0, /* todo_flags_finish */
+ 0 /* letter */
+};