diff options
author | Richard Guenther <rguenther@suse.de> | 2011-04-14 12:07:57 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2011-04-14 12:07:57 +0000 |
commit | daade2060caf31a11154d926d4927717564a7a46 (patch) | |
tree | 8d1c24f7892e87a4ef9d15d2ffc7a8758db7b114 /gcc/fold-const.c | |
parent | 920e81727482ab7c10dd4cadf78e7ff052644762 (diff) | |
download | gcc-daade2060caf31a11154d926d4927717564a7a46.zip gcc-daade2060caf31a11154d926d4927717564a7a46.tar.gz gcc-daade2060caf31a11154d926d4927717564a7a46.tar.bz2 |
tree.h (get_object_alignment_1): Declare.
2011-04-14 Richard Guenther <rguenther@suse.de>
* tree.h (get_object_alignment_1): Declare.
* builtins.c (get_object_alignment_1): Split out worker from ...
(get_object_alignment): ... here.
* fold-const.c (get_pointer_modulus_and_residue): Use
get_object_alignment_1.
* gcc.dg/fold-bitand-4.c: Move ...
* c-c++-common/fold-bitand-4.c: ... here. Adjust slightly.
From-SVN: r172424
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 34 |
1 files changed, 7 insertions, 27 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 0c0420d..8d543c4 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -9230,30 +9230,10 @@ get_pointer_modulus_and_residue (tree expr, unsigned HOST_WIDE_INT *residue, code = TREE_CODE (expr); if (code == ADDR_EXPR) { - expr = TREE_OPERAND (expr, 0); - if (handled_component_p (expr)) - { - HOST_WIDE_INT bitsize, bitpos; - tree offset; - enum machine_mode mode; - int unsignedp, volatilep; - - expr = get_inner_reference (expr, &bitsize, &bitpos, &offset, - &mode, &unsignedp, &volatilep, false); - *residue = bitpos / BITS_PER_UNIT; - if (offset) - { - if (TREE_CODE (offset) == INTEGER_CST) - *residue += TREE_INT_CST_LOW (offset); - else - /* We don't handle more complicated offset expressions. */ - return 1; - } - } - - if (DECL_P (expr) - && (allow_func_align || TREE_CODE (expr) != FUNCTION_DECL)) - return DECL_ALIGN_UNIT (expr); + unsigned int bitalign; + bitalign = get_object_alignment_1 (TREE_OPERAND (expr, 0), residue); + *residue /= BITS_PER_UNIT; + return bitalign / BITS_PER_UNIT; } else if (code == POINTER_PLUS_EXPR) { @@ -9298,9 +9278,9 @@ get_pointer_modulus_and_residue (tree expr, unsigned HOST_WIDE_INT *residue, } } - /* If we get here, we were unable to determine anything useful about the - expression. */ - return 1; + /* If we get here, we were unable to determine anything useful about the + expression. */ + return 1; } |