Commit 7df9b6f1 by Richard Sandiford Committed by Richard Sandiford

poly_int: get_object_alignment_2

This patch makes get_object_alignment_2 track polynomial offsets
and sizes.  The real work is done by get_inner_reference, but we
then need to handle the alignment correctly.

2017-12-20  Richard Sandiford  <richard.sandiford@linaro.org>
	    Alan Hayward  <alan.hayward@arm.com>
	    David Sherwood  <david.sherwood@arm.com>

gcc/
	* builtins.c (get_object_alignment_2): Track polynomial offsets
	and sizes.  Update the alignment handling.

Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>

From-SVN: r255893
parent 06889da8
...@@ -2,6 +2,13 @@ ...@@ -2,6 +2,13 @@
Alan Hayward <alan.hayward@arm.com> Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com> David Sherwood <david.sherwood@arm.com>
* builtins.c (get_object_alignment_2): Track polynomial offsets
and sizes. Update the alignment handling.
2017-12-20 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
* tree.h (get_inner_reference): Add a version that returns the * tree.h (get_inner_reference): Add a version that returns the
offset and size as poly_int64_pods rather than HOST_WIDE_INTs. offset and size as poly_int64_pods rather than HOST_WIDE_INTs.
* cfgexpand.c (expand_debug_expr): Track polynomial offsets. Simply * cfgexpand.c (expand_debug_expr): Track polynomial offsets. Simply
...@@ -248,7 +248,7 @@ static bool ...@@ -248,7 +248,7 @@ static bool
get_object_alignment_2 (tree exp, unsigned int *alignp, get_object_alignment_2 (tree exp, unsigned int *alignp,
unsigned HOST_WIDE_INT *bitposp, bool addr_p) unsigned HOST_WIDE_INT *bitposp, bool addr_p)
{ {
HOST_WIDE_INT bitsize, bitpos; poly_int64 bitsize, bitpos;
tree offset; tree offset;
machine_mode mode; machine_mode mode;
int unsignedp, reversep, volatilep; int unsignedp, reversep, volatilep;
...@@ -373,8 +373,17 @@ get_object_alignment_2 (tree exp, unsigned int *alignp, ...@@ -373,8 +373,17 @@ get_object_alignment_2 (tree exp, unsigned int *alignp,
} }
} }
/* Account for the alignment of runtime coefficients, so that the constant
bitpos is guaranteed to be accurate. */
unsigned int alt_align = ::known_alignment (bitpos - bitpos.coeffs[0]);
if (alt_align != 0 && alt_align < align)
{
align = alt_align;
known_alignment = false;
}
*alignp = align; *alignp = align;
*bitposp = bitpos & (*alignp - 1); *bitposp = bitpos.coeffs[0] & (align - 1);
return known_alignment; return known_alignment;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment