From: Richard Guenther Date: Wed, 10 Aug 2011 12:24:23 +0000 (+0000) Subject: tree.h (get_pointer_alignment): Remove max-align argument. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0eb778344e8c1d4e9da37a098bceef7201283432;p=gcc.git tree.h (get_pointer_alignment): Remove max-align argument. 2011-08-10 Richard Guenther * tree.h (get_pointer_alignment): Remove max-align argument. (get_object_alignment): Likewise. * builtins.c (get_object_alignment_1): Adjust. (get_object_alignment): Remove max-align argument. (get_pointer_alignment): Likewise. (expand_builtin_strlen): Adjust. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy_args): Likewise. (expand_builtin_strncpy): Likewise. (expand_builtin_memset_args): Likewise. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (get_builtin_sync_mem): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_memory_op): Likewise. (expand_builtin_memory_chk): Likewise. * emit-rtl.c (get_mem_align_offset): Likewise. (set_mem_attributes_minus_bitpos): Likewise. * expr.c (expand_assignment): Likewise. (expand_expr_real_1): Likewise. * tree-sra.c (tree_non_mode_aligned_mem_p): Likewise. * tree-ssa-forwprop.c (simplify_builtin_call): Likewise. * tree-ssa-loop-ivopts.c (may_be_unaligned_p): Likewise. * tree-vect-data-refs.c (vect_compute_data_ref_alignment): Likewise. * value-prof.c (gimple_stringops_transform): Likewise. From-SVN: r177620 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9560f112cfb..33d7dbd93d1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,32 @@ +2011-08-10 Richard Guenther + + * tree.h (get_pointer_alignment): Remove max-align argument. + (get_object_alignment): Likewise. + * builtins.c (get_object_alignment_1): Adjust. + (get_object_alignment): Remove max-align argument. + (get_pointer_alignment): Likewise. + (expand_builtin_strlen): Adjust. + (expand_builtin_memcpy): Likewise. + (expand_builtin_mempcpy_args): Likewise. + (expand_builtin_strncpy): Likewise. + (expand_builtin_memset_args): Likewise. + (expand_builtin_memcmp): Likewise. + (expand_builtin_strcmp): Likewise. + (expand_builtin_strncmp): Likewise. + (get_builtin_sync_mem): Likewise. + (fold_builtin_memset): Likewise. + (fold_builtin_memory_op): Likewise. + (expand_builtin_memory_chk): Likewise. + * emit-rtl.c (get_mem_align_offset): Likewise. + (set_mem_attributes_minus_bitpos): Likewise. + * expr.c (expand_assignment): Likewise. + (expand_expr_real_1): Likewise. + * tree-sra.c (tree_non_mode_aligned_mem_p): Likewise. + * tree-ssa-forwprop.c (simplify_builtin_call): Likewise. + * tree-ssa-loop-ivopts.c (may_be_unaligned_p): Likewise. + * tree-vect-data-refs.c (vect_compute_data_ref_alignment): Likewise. + * value-prof.c (gimple_stringops_transform): Likewise. + 2011-08-10 Paulo J. Matos * doc/tm.texi.in (CLASS_MAX_NREGS): Fix typo. diff --git a/gcc/builtins.c b/gcc/builtins.c index 0ffacf9d445..723e07f42a8 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -341,7 +341,7 @@ get_object_alignment_1 (tree exp, unsigned HOST_WIDE_INT *bitposp) align = MAX (pi->align * BITS_PER_UNIT, align); } else if (TREE_CODE (addr) == ADDR_EXPR) - align = MAX (align, get_object_alignment (TREE_OPERAND (addr, 0), ~0U)); + align = MAX (align, get_object_alignment (TREE_OPERAND (addr, 0))); bitpos += mem_ref_offset (exp).low * BITS_PER_UNIT; } else if (TREE_CODE (exp) == TARGET_MEM_REF) @@ -365,7 +365,7 @@ get_object_alignment_1 (tree exp, unsigned HOST_WIDE_INT *bitposp) align = MAX (pi->align * BITS_PER_UNIT, align); } else if (TREE_CODE (addr) == ADDR_EXPR) - align = MAX (align, get_object_alignment (TREE_OPERAND (addr, 0), ~0U)); + align = MAX (align, get_object_alignment (TREE_OPERAND (addr, 0))); if (TMR_OFFSET (exp)) bitpos += TREE_INT_CST_LOW (TMR_OFFSET (exp)) * BITS_PER_UNIT; if (TMR_INDEX (exp) && TMR_STEP (exp)) @@ -434,11 +434,10 @@ get_object_alignment_1 (tree exp, unsigned HOST_WIDE_INT *bitposp) return align; } -/* Return the alignment in bits of EXP, an object. - Don't return more than MAX_ALIGN no matter what. */ +/* Return the alignment in bits of EXP, an object. */ unsigned int -get_object_alignment (tree exp, unsigned int max_align) +get_object_alignment (tree exp) { unsigned HOST_WIDE_INT bitpos = 0; unsigned int align; @@ -451,7 +450,7 @@ get_object_alignment (tree exp, unsigned int max_align) if (bitpos != 0) align = (bitpos & -bitpos); - return MIN (align, max_align); + return align; } /* Returns true iff we can trust that alignment information has been @@ -465,7 +464,6 @@ can_trust_pointer_alignment (void) } /* Return the alignment in bits of EXP, a pointer valued expression. - But don't return more than MAX_ALIGN no matter what. The alignment returned is, by default, the alignment of the thing that EXP points to. If it is not a POINTER_TYPE, 0 is returned. @@ -473,12 +471,12 @@ can_trust_pointer_alignment (void) expression is actually pointing at an object whose alignment is tighter. */ unsigned int -get_pointer_alignment (tree exp, unsigned int max_align) +get_pointer_alignment (tree exp) { STRIP_NOPS (exp); if (TREE_CODE (exp) == ADDR_EXPR) - return get_object_alignment (TREE_OPERAND (exp, 0), max_align); + return get_object_alignment (TREE_OPERAND (exp, 0)); else if (TREE_CODE (exp) == SSA_NAME && POINTER_TYPE_P (TREE_TYPE (exp))) { @@ -490,7 +488,7 @@ get_pointer_alignment (tree exp, unsigned int max_align) align = (pi->misalign & -pi->misalign); else align = pi->align; - return MIN (max_align, align * BITS_PER_UNIT); + return align * BITS_PER_UNIT; } return POINTER_TYPE_P (TREE_TYPE (exp)) ? BITS_PER_UNIT : 0; @@ -2926,7 +2924,7 @@ expand_builtin_strlen (tree exp, rtx target, return expand_expr (len, target, target_mode, EXPAND_NORMAL); } - align = get_pointer_alignment (src, BIGGEST_ALIGNMENT) / BITS_PER_UNIT; + align = get_pointer_alignment (src) / BITS_PER_UNIT; /* If SRC is not a pointer type, don't do this operation inline. */ if (align == 0) @@ -3026,9 +3024,8 @@ expand_builtin_memcpy (tree exp, rtx target) tree src = CALL_EXPR_ARG (exp, 1); tree len = CALL_EXPR_ARG (exp, 2); const char *src_str; - unsigned int src_align = get_pointer_alignment (src, BIGGEST_ALIGNMENT); - unsigned int dest_align - = get_pointer_alignment (dest, BIGGEST_ALIGNMENT); + unsigned int src_align = get_pointer_alignment (src); + unsigned int dest_align = get_pointer_alignment (dest); rtx dest_mem, src_mem, dest_addr, len_rtx; HOST_WIDE_INT expected_size = -1; unsigned int expected_align = 0; @@ -3135,9 +3132,8 @@ expand_builtin_mempcpy_args (tree dest, tree src, tree len, else { const char *src_str; - unsigned int src_align = get_pointer_alignment (src, BIGGEST_ALIGNMENT); - unsigned int dest_align - = get_pointer_alignment (dest, BIGGEST_ALIGNMENT); + unsigned int src_align = get_pointer_alignment (src); + unsigned int dest_align = get_pointer_alignment (dest); rtx dest_mem, src_mem, len_rtx; /* If either SRC or DEST is not a pointer type, don't do this @@ -3390,8 +3386,7 @@ expand_builtin_strncpy (tree exp, rtx target) use store_by_pieces, if it fails, punt. */ if (tree_int_cst_lt (slen, len)) { - unsigned int dest_align - = get_pointer_alignment (dest, BIGGEST_ALIGNMENT); + unsigned int dest_align = get_pointer_alignment (dest); const char *p = c_getstr (src); rtx dest_mem; @@ -3495,7 +3490,7 @@ expand_builtin_memset_args (tree dest, tree val, tree len, HOST_WIDE_INT expected_size = -1; unsigned int expected_align = 0; - dest_align = get_pointer_alignment (dest, BIGGEST_ALIGNMENT); + dest_align = get_pointer_alignment (dest); /* If DEST is not a pointer type, don't do this operation in-line. */ if (dest_align == 0) @@ -3657,10 +3652,8 @@ expand_builtin_memcmp (tree exp, ATTRIBUTE_UNUSED rtx target, tree arg2 = CALL_EXPR_ARG (exp, 1); tree len = CALL_EXPR_ARG (exp, 2); - unsigned int arg1_align - = get_pointer_alignment (arg1, BIGGEST_ALIGNMENT) / BITS_PER_UNIT; - unsigned int arg2_align - = get_pointer_alignment (arg2, BIGGEST_ALIGNMENT) / BITS_PER_UNIT; + unsigned int arg1_align = get_pointer_alignment (arg1) / BITS_PER_UNIT; + unsigned int arg2_align = get_pointer_alignment (arg2) / BITS_PER_UNIT; enum machine_mode insn_mode; #ifdef HAVE_cmpmemsi @@ -3759,10 +3752,8 @@ expand_builtin_strcmp (tree exp, ATTRIBUTE_UNUSED rtx target) tree arg1 = CALL_EXPR_ARG (exp, 0); tree arg2 = CALL_EXPR_ARG (exp, 1); - unsigned int arg1_align - = get_pointer_alignment (arg1, BIGGEST_ALIGNMENT) / BITS_PER_UNIT; - unsigned int arg2_align - = get_pointer_alignment (arg2, BIGGEST_ALIGNMENT) / BITS_PER_UNIT; + unsigned int arg1_align = get_pointer_alignment (arg1) / BITS_PER_UNIT; + unsigned int arg2_align = get_pointer_alignment (arg2) / BITS_PER_UNIT; /* If we don't have POINTER_TYPE, call the function. */ if (arg1_align == 0 || arg2_align == 0) @@ -3910,10 +3901,8 @@ expand_builtin_strncmp (tree exp, ATTRIBUTE_UNUSED rtx target, tree arg2 = CALL_EXPR_ARG (exp, 1); tree arg3 = CALL_EXPR_ARG (exp, 2); - unsigned int arg1_align - = get_pointer_alignment (arg1, BIGGEST_ALIGNMENT) / BITS_PER_UNIT; - unsigned int arg2_align - = get_pointer_alignment (arg2, BIGGEST_ALIGNMENT) / BITS_PER_UNIT; + unsigned int arg1_align = get_pointer_alignment (arg1) / BITS_PER_UNIT; + unsigned int arg2_align = get_pointer_alignment (arg2) / BITS_PER_UNIT; enum machine_mode insn_mode = insn_data[(int) CODE_FOR_cmpstrnsi].operand[0].mode; @@ -5087,7 +5076,7 @@ get_builtin_sync_mem (tree loc, enum machine_mode mode) /* The alignment needs to be at least according to that of the mode. */ set_mem_align (mem, MAX (GET_MODE_ALIGNMENT (mode), - get_pointer_alignment (loc, BIGGEST_ALIGNMENT))); + get_pointer_alignment (loc))); set_mem_alias_set (mem, ALIAS_SET_MEMORY_BARRIER); MEM_VOLATILE_P (mem) = 1; @@ -7891,8 +7880,7 @@ fold_builtin_memset (location_t loc, tree dest, tree c, tree len, length = tree_low_cst (len, 1); if (GET_MODE_SIZE (TYPE_MODE (etype)) != length - || get_pointer_alignment (dest, BIGGEST_ALIGNMENT) / BITS_PER_UNIT - < length) + || get_pointer_alignment (dest) / BITS_PER_UNIT < length) return NULL_TREE; if (length > HOST_BITS_PER_WIDE_INT / BITS_PER_UNIT) @@ -7982,8 +7970,8 @@ fold_builtin_memory_op (location_t loc, tree dest, tree src, if (endp == 3) { - src_align = get_pointer_alignment (src, BIGGEST_ALIGNMENT); - dest_align = get_pointer_alignment (dest, BIGGEST_ALIGNMENT); + src_align = get_pointer_alignment (src); + dest_align = get_pointer_alignment (dest); /* Both DEST and SRC must be pointer types. ??? This is what old code did. Is the testing for pointer types @@ -8131,8 +8119,8 @@ fold_builtin_memory_op (location_t loc, tree dest, tree src, || TREE_ADDRESSABLE (desttype)) return NULL_TREE; - src_align = get_pointer_alignment (src, BIGGEST_ALIGNMENT); - dest_align = get_pointer_alignment (dest, BIGGEST_ALIGNMENT); + src_align = get_pointer_alignment (src); + dest_align = get_pointer_alignment (dest); if (dest_align < TYPE_ALIGN (desttype) || src_align < TYPE_ALIGN (srctype)) return NULL_TREE; @@ -11696,8 +11684,7 @@ expand_builtin_memory_chk (tree exp, rtx target, enum machine_mode mode, return NULL_RTX; else { - unsigned int dest_align - = get_pointer_alignment (dest, BIGGEST_ALIGNMENT); + unsigned int dest_align = get_pointer_alignment (dest); /* If DEST is not a pointer type, call the normal function. */ if (dest_align == 0) @@ -11722,8 +11709,7 @@ expand_builtin_memory_chk (tree exp, rtx target, enum machine_mode mode, /* __memmove_chk special case. */ if (fcode == BUILT_IN_MEMMOVE_CHK) { - unsigned int src_align - = get_pointer_alignment (src, BIGGEST_ALIGNMENT); + unsigned int src_align = get_pointer_alignment (src); if (src_align == 0) return NULL_RTX; diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index 16a1c6cd981..25628e40bc2 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -1466,7 +1466,7 @@ get_mem_align_offset (rtx mem, unsigned int align) /* This function can't use if (!MEM_EXPR (mem) || !MEM_OFFSET_KNOWN_P (mem) || (MAX (MEM_ALIGN (mem), - get_object_alignment (MEM_EXPR (mem), align)) + MAX (align, get_object_alignment (MEM_EXPR (mem)))) < align)) return -1; else @@ -1826,9 +1826,9 @@ set_mem_attributes_minus_bitpos (rtx ref, tree t, int objectp, apply_bitpos = bitpos; } - if (!align_computed && !INDIRECT_REF_P (t)) + if (!align_computed) { - unsigned int obj_align = get_object_alignment (t, BIGGEST_ALIGNMENT); + unsigned int obj_align = get_object_alignment (t); attrs.align = MAX (attrs.align, obj_align); } } diff --git a/gcc/expr.c b/gcc/expr.c index f170596d330..f0b76e187b7 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -4440,8 +4440,7 @@ expand_assignment (tree to, tree from, bool nontemporal) if ((TREE_CODE (to) == MEM_REF || TREE_CODE (to) == TARGET_MEM_REF) && mode != BLKmode - && ((align = MAX (TYPE_ALIGN (TREE_TYPE (to)), - get_object_alignment (to, BIGGEST_ALIGNMENT))) + && ((align = MAX (TYPE_ALIGN (TREE_TYPE (to)), get_object_alignment (to))) < (signed) GET_MODE_ALIGNMENT (mode)) && ((icode = optab_handler (movmisalign_optab, mode)) != CODE_FOR_nothing)) @@ -9046,8 +9045,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, temp = gen_rtx_MEM (mode, op0); set_mem_attributes (temp, exp, 0); set_mem_addr_space (temp, as); - align = MAX (TYPE_ALIGN (TREE_TYPE (exp)), - get_object_alignment (exp, BIGGEST_ALIGNMENT)); + align = MAX (TYPE_ALIGN (TREE_TYPE (exp)), get_object_alignment (exp)); if (mode != BLKmode && (unsigned) align < GET_MODE_ALIGNMENT (mode) /* If the target does not have special handling for unaligned @@ -9127,8 +9125,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, gimple_assign_rhs1 (def_stmt), mask); TREE_OPERAND (exp, 0) = base; } - align = MAX (TYPE_ALIGN (TREE_TYPE (exp)), - get_object_alignment (exp, BIGGEST_ALIGNMENT)); + align = MAX (TYPE_ALIGN (TREE_TYPE (exp)), get_object_alignment (exp)); op0 = expand_expr (base, NULL_RTX, VOIDmode, EXPAND_SUM); op0 = memory_address_addr_space (address_mode, op0, as); if (!integer_zerop (TREE_OPERAND (exp, 1))) diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index ab60748c970..2d97845ffe6 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -1085,7 +1085,7 @@ tree_non_mode_aligned_mem_p (tree exp) || !STRICT_ALIGNMENT) return false; - align = get_object_alignment (exp, BIGGEST_ALIGNMENT); + align = get_object_alignment (exp); if (GET_MODE_ALIGNMENT (mode) > align) return true; diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c index 2a56b79a423..afbe525b99d 100644 --- a/gcc/tree-ssa-forwprop.c +++ b/gcc/tree-ssa-forwprop.c @@ -1509,7 +1509,7 @@ simplify_builtin_call (gimple_stmt_iterator *gsi_p, tree callee2) || use_stmt != stmt2)) break; - ptr1_align = get_pointer_alignment (ptr1, BIGGEST_ALIGNMENT); + ptr1_align = get_pointer_alignment (ptr1); /* Construct the new source string literal. */ src_buf = XALLOCAVEC (char, src_len + 1); if (callee1) diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index cc9b2dd8945..79fff3f4eae 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -1635,7 +1635,7 @@ may_be_unaligned_p (tree ref, tree step) base = get_inner_reference (ref, &bitsize, &bitpos, &toffset, &mode, &unsignedp, &volatilep, true); base_type = TREE_TYPE (base); - base_align = get_object_alignment (base, BIGGEST_ALIGNMENT); + base_align = get_object_alignment (base); base_align = MAX (base_align, TYPE_ALIGN (base_type)); if (mode != BLKmode) diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index f0d2f0d06b1..e4d32e9d277 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -860,8 +860,7 @@ vect_compute_data_ref_alignment (struct data_reference *dr) && tree_int_cst_compare (ssize_int (TYPE_ALIGN_UNIT (TREE_TYPE ( TREE_TYPE (base_addr)))), alignment) >= 0) - || (get_pointer_alignment (base_addr, TYPE_ALIGN (vectype)) - >= TYPE_ALIGN (vectype))) + || (get_pointer_alignment (base_addr) >= TYPE_ALIGN (vectype))) base_aligned = true; else base_aligned = false; diff --git a/gcc/tree.h b/gcc/tree.h index 367c7b92106..2fa5999c615 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -5359,11 +5359,11 @@ extern tree build_string_literal (int, const char *); extern bool validate_arglist (const_tree, ...); extern rtx builtin_memset_read_str (void *, HOST_WIDE_INT, enum machine_mode); extern bool can_trust_pointer_alignment (void); -extern unsigned int get_pointer_alignment (tree, unsigned int); extern bool is_builtin_name (const char *); extern bool is_builtin_fn (tree); extern unsigned int get_object_alignment_1 (tree, unsigned HOST_WIDE_INT *); -extern unsigned int get_object_alignment (tree, unsigned int); +extern unsigned int get_object_alignment (tree); +extern unsigned int get_pointer_alignment (tree); extern tree fold_call_stmt (gimple, bool); extern tree gimple_fold_builtin_snprintf_chk (gimple, tree, enum built_in_function); extern tree make_range (tree, int *, tree *, tree *, bool *); diff --git a/gcc/value-prof.c b/gcc/value-prof.c index 2b7a9d83bf2..2df04f56813 100644 --- a/gcc/value-prof.c +++ b/gcc/value-prof.c @@ -1528,13 +1528,13 @@ gimple_stringops_transform (gimple_stmt_iterator *gsi) else prob = 0; dest = gimple_call_arg (stmt, 0); - dest_align = get_pointer_alignment (dest, BIGGEST_ALIGNMENT); + dest_align = get_pointer_alignment (dest); switch (fcode) { case BUILT_IN_MEMCPY: case BUILT_IN_MEMPCPY: src = gimple_call_arg (stmt, 1); - src_align = get_pointer_alignment (src, BIGGEST_ALIGNMENT); + src_align = get_pointer_alignment (src); if (!can_move_by_pieces (val, MIN (dest_align, src_align))) return false; break;