summaryrefslogtreecommitdiff
path: root/gcc/builtins.c
diff options
context:
space:
mode:
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>2001-10-23 18:51:18 +0000
committerRichard Kenner <kenner@gcc.gnu.org>2001-10-23 14:51:18 -0400
commit8ac61af705335691fd0d91ec6cd96e65bb81201c (patch)
tree4f314d9fb9d201416fb3ebce0a67307306ae796f /gcc/builtins.c
parent6c36d76bf6521dd1cc09b8d7e379a02d138ffd53 (diff)
downloadgcc-8ac61af705335691fd0d91ec6cd96e65bb81201c.tar.gz
alias.c (can_address_p): Compnonents are not addressable if the containing type has alias set 0.
* alias.c (can_address_p): Compnonents are not addressable if the containing type has alias set 0. (get_alias_set): Rework to use STRIP_NOPS. Only call front-end routine on object, type, or object with NOPs stripped, not inner values. Use language hook to call front-end routine. * builtins.c (get_memory_rtx): Always call set_mem_attributes. (expand_builtin_apply): Call set_mem_align on MEMs we make. Don't pass alignment to emit_block_move. (expand_builtin_memcpy, expand_builtin_va_copy): Likewise. (expand_builtin_memset): Likewise, but for clear_storage. * c-common.c (lang_get_alias_set): Renamed to c_common_alias_set and remove C++ specific parts. * c-common.h (c_common_get_alias_set): Add declaration. * c-lang.c (LANG_HOOKS_GET_ALIAS_SET): New macro. * calls.c (emit_call_1): Fix typo in sibcall_pop case. (save_fixed_argument_area): Call set_mem_align. Remove alignment in call to emit_block_move. (emit_library_call_value_1, store_one_arg): Likewise. (target_for_arg): Remove; disabled long ago. * emit-rtl.c (set_mem_attributes): Rework to only call get_mem_attrs once and similar cleanups. (offset_address): Use proper introductory comment. * expr.c (emit_block_move): Use alignment from that of MEM args, not from explicit operand; all callers changed. (clear_storage): Likewise. (expand_assignment): Don't call set_mem_alias_set on to_rtx. (store_field): Remove kludge on alias set used for to_rtx. (highest_pow2_factor, case *_DIV_EXPR): Never return 0. (expand_expr_unaligned): Call set_mem_attributes instead of set_mem_alias_set. * expr.h (emit_block_move, clear_storage): Remove ALIGN argument. * function.c (assign_stack_temp_for_type): Set MEM alignment. (expand_function_end): Track MEM attributes of trampolines. * ifcvt.c (noce_try_cmove_arith): Set alignment of new MEM. * integrate.c (copy_rtx_and_substitute, case CALL): Copy memory attributes from original. * langhooks.c (lang_hook_default_get_alias_set): New function. (hook_get_alias_set_0): New function. * langhooks.h (hook_get_alias_set_0): New declaration. (lang_hook_default_get_alias_set): Likewise. (LANG_HOOKS_GET_ALIAS_SET): New macro; add to initializer. * reload1.c (alter_reg): Use adjust_address_nv. * rtl.c (get_mode_alignment): Moved to here. * rtl.h (MEM_ALIGN): Take default from mode, if not BLKmode, and change default if unknown from 1 to BITS_PER_UNIT. * stor-layout.c (get_mode_alignment): Remove from here. * toplev.h (struct lang_hoks): Add get_alias_set field. * tree.h (lang_get_alias_set): Delete declaration. * config/arc/arc.c (arc_setup_incoming_varags): Set MEM alignment. * config/i386/i386.c (ix86_setup_incoming_varargs): Likewise. (ix86_va_arg): Likewise. * config/i960/i960.c (i960_setup_incoming_varargs): Likewise. * config/pa/pa.c (hppa_builtin_saveregs): Likewise. * config/sparc/sparc.c (sparc_va_arg): Likewise. * config/rs6000/rs6000.c (setup_incoming_varargs): Likewise. (expand_block_move_mem): Remove dead code. * cp/cp-lang.c (cxx_get_alias_set): New function. Point LANG_HOOKS_GET_ALIAS_SET to it. * f/com.c (LANG_HOOKS_GET_ALIAS_SET): New macro. (lang_get_alias_set): Delete. * java/lang.c (lang_get_alias_set): Deleted. From-SVN: r46440
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r--gcc/builtins.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 0576886490d..fe127925ac2 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -724,6 +724,8 @@ get_memory_rtx (exp)
expand_expr (exp, NULL_RTX,
ptr_mode, EXPAND_SUM)));
+ set_mem_attributes (mem, exp, 0);
+
/* Get an expression we can use to find the attributes to assign to MEM.
If it is an ADDR_EXPR, use the operand. Otherwise, dereference it if
we can. First remove any nops. */
@@ -739,7 +741,6 @@ get_memory_rtx (exp)
else
return mem;
- set_mem_attributes (mem, exp, 0);
/* memcpy, memset and other builtin stringops can alias with anything. */
set_mem_alias_set (mem, 0);
return mem;
@@ -1040,7 +1041,7 @@ expand_builtin_apply (function, arguments, argsize)
{
int size, align, regno;
enum machine_mode mode;
- rtx incoming_args, result, reg, dest, call_insn;
+ rtx incoming_args, result, reg, dest, src, call_insn;
rtx old_stack_level = 0;
rtx call_fusage = 0;
@@ -1079,13 +1080,16 @@ expand_builtin_apply (function, arguments, argsize)
but it's likely that the source and/or destination addresses in
the block copy will need updating in machine specific ways. */
dest = allocate_dynamic_stack_space (argsize, 0, BITS_PER_UNIT);
- emit_block_move (gen_rtx_MEM (BLKmode, dest),
- gen_rtx_MEM (BLKmode, incoming_args),
- argsize, PARM_BOUNDARY);
+ dest = gen_rtx_MEM (BLKmode, dest);
+ set_mem_align (dest, PARM_BOUNDARY);
+ src = gen_rtx_MEM (BLKmode, incoming_args);
+ set_mem_align (src, PARM_BOUNDARY);
+ emit_block_move (dest, src, argsize);
/* Refer to the argument block. */
apply_args_size ();
arguments = gen_rtx_MEM (BLKmode, arguments);
+ set_mem_align (arguments, PARM_BOUNDARY);
/* Walk past the arg-pointer and structure value address. */
size = GET_MODE_SIZE (Pmode);
@@ -1813,6 +1817,7 @@ expand_builtin_memcpy (arglist)
return 0;
dest_mem = get_memory_rtx (dest);
+ set_mem_align (dest_mem, dest_align);
len_rtx = expand_expr (len, NULL_RTX, VOIDmode, 0);
src_str = c_getstr (src);
@@ -1833,6 +1838,7 @@ expand_builtin_memcpy (arglist)
}
src_mem = get_memory_rtx (src);
+ set_mem_align (src_mem, src_align);
/* Just copy the rights of SRC to the rights of DEST. */
if (current_function_check_memory_usage)
@@ -1842,9 +1848,7 @@ expand_builtin_memcpy (arglist)
len_rtx, TYPE_MODE (sizetype));
/* Copy word part most expediently. */
- dest_addr
- = emit_block_move (dest_mem, src_mem, len_rtx,
- MIN (src_align, dest_align));
+ dest_addr = emit_block_move (dest_mem, src_mem, len_rtx);
if (dest_addr == 0)
dest_addr = force_operand (XEXP (dest_mem, 0), NULL_RTX);
@@ -2041,6 +2045,7 @@ expand_builtin_memset (exp)
len_rtx = expand_expr (len, NULL_RTX, VOIDmode, 0);
dest_mem = get_memory_rtx (dest);
+ set_mem_align (dest_mem, dest_align);
/* Just check DST is writable and mark it as readable. */
if (current_function_check_memory_usage)
@@ -2051,7 +2056,7 @@ expand_builtin_memset (exp)
TYPE_MODE (integer_type_node));
- dest_addr = clear_storage (dest_mem, len_rtx, dest_align);
+ dest_addr = clear_storage (dest_mem, len_rtx);
if (dest_addr == 0)
dest_addr = force_operand (XEXP (dest_mem, 0), NULL_RTX);
@@ -3013,11 +3018,13 @@ expand_builtin_va_copy (arglist)
/* "Dereference" to BLKmode memories. */
dstb = gen_rtx_MEM (BLKmode, dstb);
set_mem_alias_set (dstb, get_alias_set (TREE_TYPE (TREE_TYPE (dst))));
+ set_mem_align (dstb, TYPE_ALIGN (va_list_type_node));
srcb = gen_rtx_MEM (BLKmode, srcb);
set_mem_alias_set (srcb, get_alias_set (TREE_TYPE (TREE_TYPE (src))));
+ set_mem_align (srcb, TYPE_ALIGN (va_list_type_node));
/* Copy. */
- emit_block_move (dstb, srcb, size, TYPE_ALIGN (va_list_type_node));
+ emit_block_move (dstb, srcb, size);
}
return const0_rtx;