aboutsummaryrefslogtreecommitdiff
path: root/gcc/builtins.c
diff options
context:
space:
mode:
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>2000-03-30 11:47:08 +0000
committerRichard Kenner <kenner@gcc.gnu.org>2000-03-30 06:47:08 -0500
commit19caa751a84a1ff3a90a5dc64e3f4c5cac6ce97f (patch)
tree329b51ffb0413c60bc6cbeaca6487042e3b6592d /gcc/builtins.c
parent2dc4d9f050c5d46500c925725a5f18303dd882c1 (diff)
downloadgcc-19caa751a84a1ff3a90a5dc64e3f4c5cac6ce97f.zip
gcc-19caa751a84a1ff3a90a5dc64e3f4c5cac6ce97f.tar.gz
gcc-19caa751a84a1ff3a90a5dc64e3f4c5cac6ce97f.tar.bz2
builtins.c (get_pointer_alignment): Use host_integerp & tree_low_cst.
* builtins.c (get_pointer_alignment): Use host_integerp & tree_low_cst. (expand_builtin_apply): Pass alignment to emit_block_move in bits. (expand_builtin_memcpy, expand_builtin_va_copy): Likewise. (expand_builtin_memset): Likewise, but to clear_storage. * calls.c (save_fixed_argument_area): Likewise, to move_by_pieces. (restore_fixed_argument_area): Likewise. (store_unaligned_arguments_into_pseudos): Likewise, to store_bit_field. (load_register_parameters): Likewise, to emit_group_load. (expand_call): Likewise, to emit_group_store and emit_block_move. (emit_library_call_value_1): Likewise, to emit_block_move. (store_one_arg): Likewise, and to emit_push_insn. * expmed.c (extract_bit_field): Alignment is in bits, not bytes. (extract_fixed_bit_field, extract_split_bit_field): Likewise. * expr.c (move_by_pieces, move_by_pieces_ninsns): Likewise. (emit_block_move, emit_group_load, emit_group_store): Likewise. (clear_by_pieces, clear_storage, emit_push_insn): Likewise. (expand_assigment, store_expr, store_constructor_field): Likewise. (expand_expr_unaligned, do_jump, do_compare_and_jump): Likewise. (store_constructor, store_field, get_inner_reference): Likewise. Use host_integerp and tree_low_cst; sizes and positions HOST_WIDE_INT. (expand_expr, case COMPONENT_REF): Likewise. (copy_blkmode_from_regs): Use UNSIGNED_HOST_WIDE_INT for sizes and positions; reindent code. * expr.h (emit_cmp_insn, emit_cmp_and_jump_insns): Alignment unsigned. * function.c (purge_addressof_1): Pass bit align to store_bit_field. (assign_parms): Likewise to emit_group_store. * optbas.c (prepare_cmp_insn): Alignment is in bits. (emit_cmp_and_jump_insns, emit_cmp_insn): Likewise, and also unsigned. * stmt.c (expand_value_return): Pass align in bits to emit_group_load. (expand_return): Likewise to {extract,store}_bit_field. * stor-layout.c (get_mode_alignment): Minor cleanup. * config/rs6000/rs6000.h (SLOW_UNALIGNED_ACCESS): Align is in bits. * config/sh/sh.h (MOVE_BY_PIECES_P): Likewise. * ch/expr.c (chill_expand_expr): Pass bit alignment to emit_block_move. From-SVN: r32827
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r--gcc/builtins.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 94997fb..63b17f7 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -135,6 +135,7 @@ get_pointer_alignment (exp, max_align)
exp = TREE_OPERAND (exp, 0);
if (TREE_CODE (TREE_TYPE (exp)) != POINTER_TYPE)
return align;
+
inner = TYPE_ALIGN (TREE_TYPE (TREE_TYPE (exp)));
align = MIN (inner, max_align);
break;
@@ -143,10 +144,10 @@ get_pointer_alignment (exp, max_align)
/* If sum of pointer + int, restrict our maximum alignment to that
imposed by the integer. If not, we can't do any better than
ALIGN. */
- if (TREE_CODE (TREE_OPERAND (exp, 1)) != INTEGER_CST)
+ if (! host_integerp (TREE_OPERAND (exp, 1), 1))
return align;
- while (((TREE_INT_CST_LOW (TREE_OPERAND (exp, 1)) * BITS_PER_UNIT)
+ while (((tree_low_cst (TREE_OPERAND (exp, 1), 1) * BITS_PER_UNIT)
& (max_align - 1))
!= 0)
max_align >>= 1;
@@ -903,8 +904,7 @@ expand_builtin_apply (function, arguments, argsize)
dest = allocate_dynamic_stack_space (argsize, 0, 0);
emit_block_move (gen_rtx_MEM (BLKmode, dest),
gen_rtx_MEM (BLKmode, incoming_args),
- argsize,
- PARM_BOUNDARY / BITS_PER_UNIT);
+ argsize, PARM_BOUNDARY);
/* Refer to the argument block. */
apply_args_size ();
@@ -1435,10 +1435,8 @@ expand_builtin_memcpy (arglist)
tree src = TREE_VALUE (TREE_CHAIN (arglist));
tree len = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
- int src_align
- = get_pointer_alignment (src, BIGGEST_ALIGNMENT) / BITS_PER_UNIT;
- int dest_align
- = get_pointer_alignment (dest, BIGGEST_ALIGNMENT) / BITS_PER_UNIT;
+ int src_align = get_pointer_alignment (src, BIGGEST_ALIGNMENT);
+ int dest_align = get_pointer_alignment (dest, BIGGEST_ALIGNMENT);
rtx dest_mem, src_mem, dest_addr, len_rtx;
/* If either SRC or DEST is not a pointer type, don't do
@@ -1531,8 +1529,7 @@ expand_builtin_memset (exp)
tree val = TREE_VALUE (TREE_CHAIN (arglist));
tree len = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
- int dest_align
- = get_pointer_alignment (dest, BIGGEST_ALIGNMENT) / BITS_PER_UNIT;
+ int dest_align = get_pointer_alignment (dest, BIGGEST_ALIGNMENT);
rtx dest_mem, dest_addr, len_rtx;
/* If DEST is not a pointer type, don't do this
@@ -1918,6 +1915,7 @@ stabilize_va_list (valist, needs_lvalue)
{
tree p1 = build_pointer_type (TREE_TYPE (va_list_type_node));
tree p2 = build_pointer_type (va_list_type_node);
+
valist = build1 (ADDR_EXPR, p2, valist);
valist = fold (build1 (NOP_EXPR, p1, valist));
}
@@ -2190,8 +2188,7 @@ expand_builtin_va_copy (arglist)
MEM_ALIAS_SET (srcb) = get_alias_set (TREE_TYPE (TREE_TYPE (src)));
/* Copy. */
- emit_block_move (dstb, srcb, size,
- TYPE_ALIGN (va_list_type_node) / BITS_PER_UNIT);
+ emit_block_move (dstb, srcb, size, TYPE_ALIGN (va_list_type_node));
}
return const0_rtx;