diff options
author | Richard Kenner <kenner@vlsi1.ultra.nyu.edu> | 2001-10-23 18:51:18 +0000 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 2001-10-23 14:51:18 -0400 |
commit | 8ac61af705335691fd0d91ec6cd96e65bb81201c (patch) | |
tree | 4f314d9fb9d201416fb3ebce0a67307306ae796f /gcc/emit-rtl.c | |
parent | 6c36d76bf6521dd1cc09b8d7e379a02d138ffd53 (diff) | |
download | gcc-8ac61af705335691fd0d91ec6cd96e65bb81201c.zip gcc-8ac61af705335691fd0d91ec6cd96e65bb81201c.tar.gz gcc-8ac61af705335691fd0d91ec6cd96e65bb81201c.tar.bz2 |
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/emit-rtl.c')
-rw-r--r-- | gcc/emit-rtl.c | 95 |
1 files changed, 48 insertions, 47 deletions
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index eb71518..79cdf5c 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -1651,6 +1651,11 @@ set_mem_attributes (ref, t, objectp) tree t; int objectp; { + HOST_WIDE_INT alias = MEM_ALIAS_SET (ref); + tree decl = MEM_DECL (ref); + rtx offset = MEM_OFFSET (ref); + rtx size = MEM_SIZE (ref); + unsigned int align = MEM_ALIGN (ref); tree type; /* It can happen that type_for_mode was given a mode for which there @@ -1669,8 +1674,8 @@ set_mem_attributes (ref, t, objectp) abort (); /* Get the alias set from the expression or type (perhaps using a - front-end routine). */ - set_mem_alias_set (ref, get_alias_set (t)); + front-end routine) and use it. */ + alias = get_alias_set (t); MEM_VOLATILE_P (ref) = TYPE_VOLATILE (type); MEM_IN_STRUCT_P (ref) = AGGREGATE_TYPE_P (type); @@ -1678,57 +1683,54 @@ set_mem_attributes (ref, t, objectp) |= (lang_hooks.honor_readonly && (TYPE_READONLY (type) || TREE_READONLY (t))); - /* If we are making an object of this type, we know that it is a scalar if - the type is not an aggregate. */ - if (objectp && ! AGGREGATE_TYPE_P (type)) + /* If we are making an object of this type, or if this is a DECL, we know + that it is a scalar if the type is not an aggregate. */ + if ((objectp || DECL_P (t)) && ! AGGREGATE_TYPE_P (type)) MEM_SCALAR_P (ref) = 1; /* If the size is known, we can set that. */ if (TYPE_SIZE_UNIT (type) && host_integerp (TYPE_SIZE_UNIT (type), 1)) - MEM_ATTRS (ref) - = get_mem_attrs (MEM_ALIAS_SET (ref), MEM_DECL (ref), MEM_OFFSET (ref), - GEN_INT (tree_low_cst (TYPE_SIZE_UNIT (type), 1)), - MEM_ALIGN (ref)); + size = GEN_INT (tree_low_cst (TYPE_SIZE_UNIT (type), 1)); - /* If T is a type, there's nothing more we can do. Otherwise, we may be able - to deduce some more information about the expression. */ + /* If T is not a type. Otherwise, we may be able to deduce some more + information about the expression. */ if (TYPE_P (t)) - return; - - maybe_set_unchanging (ref, t); - if (TREE_THIS_VOLATILE (t)) - MEM_VOLATILE_P (ref) = 1; + { + maybe_set_unchanging (ref, t); + if (TREE_THIS_VOLATILE (t)) + MEM_VOLATILE_P (ref) = 1; - /* Now remove any NOPs: they don't change what the underlying object is. + /* Now remove any NOPs: they don't change what the underlying object is. Likewise for SAVE_EXPR. */ - while (TREE_CODE (t) == NOP_EXPR || TREE_CODE (t) == CONVERT_EXPR - || TREE_CODE (t) == NON_LVALUE_EXPR || TREE_CODE (t) == SAVE_EXPR) - t = TREE_OPERAND (t, 0); - - /* If this is a decl, set the attributes of the MEM from it. */ - if (DECL_P (t)) - MEM_ATTRS (ref) - = get_mem_attrs - (MEM_ALIAS_SET (ref), t, GEN_INT (0), - (TYPE_SIZE_UNIT (TREE_TYPE (t)) - && host_integerp (TYPE_SIZE_UNIT (TREE_TYPE (t)), 1)) - ? GEN_INT (tree_low_cst (TYPE_SIZE_UNIT (TREE_TYPE (t)), 1)) - : 0, DECL_ALIGN (t)); - - /* If this is an INDIRECT_REF, we know its alignment. */ - if (TREE_CODE (t) == INDIRECT_REF) - set_mem_align (ref, TYPE_ALIGN (type)); - - /* Now see if we can say more about whether it's an aggregate or - scalar. If we already know it's an aggregate, don't bother. */ - if (MEM_IN_STRUCT_P (ref)) + while (TREE_CODE (t) == NOP_EXPR || TREE_CODE (t) == CONVERT_EXPR + || TREE_CODE (t) == NON_LVALUE_EXPR || TREE_CODE (t) == SAVE_EXPR) + t = TREE_OPERAND (t, 0); + + /* If this is a decl, set the attributes of the MEM from it. */ + if (DECL_P (t)) + { + decl = t; + offset = GEN_INT (0); + size = (DECL_SIZE_UNIT (t) + && host_integerp (DECL_SIZE_UNIT (t), 1) + ? GEN_INT (tree_low_cst (DECL_SIZE_UNIT (t), 1)) : 0); + align = DECL_ALIGN (t); + } + + /* If this is an INDIRECT_REF, we know its alignment. */ + else if (TREE_CODE (t) == INDIRECT_REF) + align = TYPE_ALIGN (type); + } + + /* Now set the attributes we computed above. */ + MEM_ATTRS (ref) = get_mem_attrs (alias, decl, offset, size, align); + + /* If this is already known to be a scalar or aggregate, we are done. */ + if (MEM_IN_STRUCT_P (ref) || MEM_SCALAR_P (ref)) return; - /* Since we already know the type isn't an aggregate, if this is a decl, - it must be a scalar. Or if it is a reference into an aggregate, - this is part of an aggregate. Otherwise we don't know. */ - if (DECL_P (t)) - MEM_SCALAR_P (ref) = 1; + /* If it is a reference into an aggregate, this is part of an aggregate. + Otherwise we don't know. */ else if (TREE_CODE (t) == COMPONENT_REF || TREE_CODE (t) == ARRAY_REF || TREE_CODE (t) == ARRAY_RANGE_REF || TREE_CODE (t) == BIT_FIELD_REF) @@ -1878,10 +1880,9 @@ adjust_address_1 (memref, mode, offset, validate) return new; } -/* Return a memory reference like MEMREF, but with its address changed to - ADDR. The caller is asserting that the actual piece of memory pointed - to is the same, just the form of the address is being changed, such as - by putting something into a register. */ +/* Return a memory reference like MEMREF, but whose address is changed by + adding OFFSET, an RTX, to it. POW2 is the highest power of two factor + known to be in OFFSET (possibly 1). */ rtx offset_address (memref, offset, pow2) |