diff options
author | Martin Jambor <mjambor@suse.cz> | 2012-05-03 17:48:56 +0200 |
---|---|---|
committer | Martin Jambor <jamborm@gcc.gnu.org> | 2012-05-03 17:48:56 +0200 |
commit | 644ffefd9b62c0023e707beaa1d95213e2816611 (patch) | |
tree | e8950dc74bb16dd5c134d58dd1c869b0d3b374f9 /gcc/tree-ssanames.c | |
parent | 445db530c33d3949c69b3d525e8d889a9a896306 (diff) | |
download | gcc-644ffefd9b62c0023e707beaa1d95213e2816611.zip gcc-644ffefd9b62c0023e707beaa1d95213e2816611.tar.gz gcc-644ffefd9b62c0023e707beaa1d95213e2816611.tar.bz2 |
builtins.c (get_object_alignment_1): Return whether we can determine the alignment or conservatively assume byte...
2012-05-03 Martin Jambor <mjambor@suse.cz>
* builtins.c (get_object_alignment_1): Return whether we can determine
the alignment or conservatively assume byte alignment. Return the
alignment by reference. Use get_pointer_alignment_1 for dereference
alignment.
(get_pointer_alignment_1): Return whether we can determine the
alignment or conservatively assume byte alignment. Return the
alignment by reference. Use get_ptr_info_alignment to get SSA name
alignment.
(get_object_alignment): Update call to get_object_alignment_1.
(get_object_or_type_alignment): Likewise, fall back to type alignment
only when it returned false.
(get_pointer_alignment): Update call to get_pointer_alignment_1.
* fold-const.c (get_pointer_modulus_and_residue): Update call to
get_object_alignment_1.
* ipa-prop.c (ipa_modify_call_arguments): Update call to
get_pointer_alignment_1.
* tree-sra.c (build_ref_for_offset): Likewise, fall back to the type
of MEM_REF or TARGET_MEM_REF only when it returns false.
* tree-ssa-ccp.c (get_value_from_alignment): Update call to
get_object_alignment_1.
(ccp_finalize): Use set_ptr_info_alignment.
* tree.h (get_object_alignment_1): Update declaration.
(get_pointer_alignment_1): Likewise.
* gimple-pretty-print.c (dump_gimple_phi): Use get_ptr_info_alignment.
(dump_gimple_stmt): Likewise.
* tree-flow.h (ptr_info_def): Updated comments of fields align and
misalign.
(get_ptr_info_alignment): Declared.
(mark_ptr_info_alignment_unknown): Likewise.
(set_ptr_info_alignment): Likewise.
(adjust_ptr_info_misalignment): Likewise.
* tree-ssa-address.c (copy_ref_info): Use new access functions to get
and set alignment of SSA names.
* tree-ssa-loop-ivopts.c (rewrite_use_nonlinear_expr): Call
mark_ptr_info_alignment_unknown.
* tree-ssanames.c (get_ptr_info_alignment): New function.
(mark_ptr_info_alignment_unknown): Likewise.
(set_ptr_info_alignment): Likewise.
(adjust_ptr_info_misalignment): Likewise.
(get_ptr_info): Call mark_ptr_info_alignment_unknown.
* tree-vect-data-refs.c (vect_create_addr_base_for_vector_ref):
Likewise.
(bump_vector_ptr): Likewise.
* tree-vect-stmts.c (create_array_ref): Use set_ptr_info_alignment.
(vectorizable_store): Likewise.
(vectorizable_load): Likewise.
From-SVN: r187101
Diffstat (limited to 'gcc/tree-ssanames.c')
-rw-r--r-- | gcc/tree-ssanames.c | 59 |
1 files changed, 57 insertions, 2 deletions
diff --git a/gcc/tree-ssanames.c b/gcc/tree-ssanames.c index 7c31550..64455af 100644 --- a/gcc/tree-ssanames.c +++ b/gcc/tree-ssanames.c @@ -238,6 +238,62 @@ release_ssa_name (tree var) } } +/* If the alignment of the pointer described by PI is known, return true and + store the alignment and the deviation from it into *ALIGNP and *MISALIGNP + respectively. Otherwise return false. */ + +bool +get_ptr_info_alignment (struct ptr_info_def *pi, unsigned int *alignp, + unsigned int *misalignp) +{ + if (pi->align) + { + *alignp = pi->align; + *misalignp = pi->misalign; + return true; + } + else + return false; +} + +/* State that the pointer described by PI has unknown alignment. */ + +void +mark_ptr_info_alignment_unknown (struct ptr_info_def *pi) +{ + pi->align = 0; + pi->misalign = 0; +} + +/* Store the the power-of-two byte alignment and the deviation from that + alignment of pointer described by PI to ALIOGN and MISALIGN + respectively. */ + +void +set_ptr_info_alignment (struct ptr_info_def *pi, unsigned int align, + unsigned int misalign) +{ + gcc_checking_assert (align != 0); + gcc_assert ((align & (align - 1)) == 0); + gcc_assert ((misalign & ~(align - 1)) == 0); + + pi->align = align; + pi->misalign = misalign; +} + +/* If pointer decribed by PI has known alignment, increase its known + misalignment by INCREMENT modulo its current alignment. */ + +void +adjust_ptr_info_misalignment (struct ptr_info_def *pi, + unsigned int increment) +{ + if (pi->align != 0) + { + pi->misalign += increment; + pi->misalign &= (pi->align - 1); + } +} /* Return the alias information associated with pointer T. It creates a new instance if none existed. */ @@ -254,8 +310,7 @@ get_ptr_info (tree t) { pi = ggc_alloc_cleared_ptr_info_def (); pt_solution_reset (&pi->pt); - pi->align = 1; - pi->misalign = 0; + mark_ptr_info_alignment_unknown (pi); SSA_NAME_PTR_INFO (t) = pi; } |