diff options
author | Richard Kenner <kenner@vlsi1.ultra.nyu.edu> | 2000-05-31 18:37:31 +0000 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 2000-05-31 14:37:31 -0400 |
commit | 3bdf5ad13852aaa871ab41a6e8f509809c8c104d (patch) | |
tree | b0b7fe92ad1922c85f0e4c70693ee5b33b128261 /gcc/function.c | |
parent | 99923eedd0700c7055810224f548f70bcd009267 (diff) | |
download | gcc-3bdf5ad13852aaa871ab41a6e8f509809c8c104d.zip gcc-3bdf5ad13852aaa871ab41a6e8f509809c8c104d.tar.gz gcc-3bdf5ad13852aaa871ab41a6e8f509809c8c104d.tar.bz2 |
Makefile.in (c-decl.o): Depend on rtl.h and expr.h.
* Makefile.in (c-decl.o): Depend on rtl.h and expr.h.
* alias.c (struct alias_entry): alias_set is HOST_WIDE_INT.
(REG_BASE_VALUE): Remove unneeded cast to unsigned.
(get_alias_set_entry): ALIAS_SET arg is HOST_WIDE_INT.
(find_base_decl): New function, from c_find_base_decl in c-common.c.
(new_alias_set): Moved from tree.c; return is HOST_WIDE_INT.
(get_alias_set): Likewise.
Major rework to do more things and allow language-specific code
to just handle special-cases.
(record_alias_subset): Args are HOST_WIDE_INT.
(record_component_alias): Local vars are HOST_WIDE_INT.
Don't handle COMPLEX_EXPR.
(get_varargs_alias_set): Moved from builtins.c.
(get_frame_alias_set): New function.
* builtins.c (expand_builtin_return_address): Use frame alias set.
(expand_builtin_setjmp, expand_builtin_longjmp): Use alias set
for setjmp buffer.
(get_memory_rtx): Rework to use set_mem_attributes.
(get_varargs_alias_set): Deleted from here.
* c-common.c (c_apply_type_quals_to_decl): Alias sets now HOST_WIDE_INT.
(c_find_base_decl): Deleted from here.
(c_get_alias_set): Remove many cases and rework to just handle
C-specific cases.
* c-common.h (c_get_alias_set): Returns HOST_WIDE_INT.
* c-decl.c (rtl.h, expr.h): Now included.
(init_decl_processing): Call record_component_aliases on array types.
(grokdeclarator): Likewise.
Set TREE_ADDRESSABLE for all fields that are not bitfields.
* c-typeck.c (common_type): Call record_component_aliases for array.
* caller-save.c (setup_save_areas): Rework register loop for unsigned.
Set all save areas to the frame alias set.
* calls.c (initialie_argument_information): Call set_mem_attributes.
(compute_argument_addresses, expand_call): Likewise.
* explow.c (set_mem_attributes): New function.
(stabilize): Use MEM_COPY_ATTRIBUTES and force_reg.
* expr.c (struct move_by_pieces): Remove {to,from}_{struct,readonly}.
LEN and OFFSET now HOST_WIDE_INT.
(clear_by_pieces): Similar changes.
(move_by_pieces): LEN now HOST_WIDE_INT; don't set deleted fields.
(move_by_pieces_ninsns): Now returns unsigned HOST_WIDE_INT.
(move_by_pieces_1): Don't use deleted fields, use MEM_COPY_ATTRIBUTES.
(clear_by_pieces_1): Likewise.
(emit_push_insn): Call set_mem_attributes.
(expand_expr, case INDIRECT_REF): Likewise.
(expand_expr, case VAR_DECL): Call change_address.
* expr.h (ADD_PARM_SIZE, SUB_PARM_SIZE): Use host_integerp and
tree_low_cst.
(get_varargs_alias_set, get_frame_alias_set): New decls.
(record_base_value, record_alias_subset, lang_get_alias_set): Likewise.
(new_alias_set, set_mem_attributes): Likewse.
* function.c (struct temp_slot): ALIAS_SET is HOST_WIDE_INT.
(assign_stack_temp_for_type): Likewise.
Can split slot even if alias set since can copy.
Set MEM_ALIAS_SET and MEM_SET_IN_STRUCT_P.
(assign_temp): Use host_integerp and tree_low_cst.
(put_var_into_stack): Properly handle SAVE_EXPR.
(put_addressof_into_stack): Likewise.
(assign_parms): Call set_mem_attributes.
Delete #if 0 code.
(fix_lexical_address): Put reference to chain into frame alias set.
(expand_function_start): Call set_mem_attributes.
* integrate.c (expand_inline_function): Likewise.
* recog.c (adj_offsettable_operand): Use MEM_COPY_ATTRIBUTES.
* regmove.c (try_apply_stack_adjustment): Likewise.
* reload.c (push_reload, make_memloc): Likewise.
* reload1.c (alter_reg): Make alias sets for spilled pseudos.
* rtl.def (MEM): Update comment.
* rtl.h (MEM_ALIAS_SET): Now uses XCWINT.
(move_by_pieces): Change length to HOST_WIDE_INT.
(record_base_value, record_alias_subset): Delete from here.
* stmt.c (expand_decl): Call set_mem_attributes.
* stor-layout.c (finish_record_layout): Call record_component_aliases.i
* toplev.c (compile_file): Call init_alias_once earlier.
* tree.c (lang_get_alias_set, get_alias_set, new_alias_set): Deleted
from here: now in alias.c.
* tree.h (struct tree_type): alias_set is HOST_WIDE_INT.
(struct tree_decl): Likewise.
(get_alias_set, new_alias_set, lang_get_alias_set): Deleted from here.
* varasm.c (make_function_rtl, make_decl_rtl): Call set_mem_attributes.
(output_constant_def, force_const_mem): Likewise.
* cp/Makefile.in (decl.o): Include ../expr.h.
* cp/decl.c (expr.h): Include.
(init_decl_processing): Call record_component_aliases for arrays.
(grokdeclarator): Likewise.
Set TREE_ADDRESSABLE for fields that aren't bitfields.
* cp/tree.c (build_cplus_array_type_1): Call record_component_aliases.
From-SVN: r34305
Diffstat (limited to 'gcc/function.c')
-rw-r--r-- | gcc/function.c | 125 |
1 files changed, 41 insertions, 84 deletions
diff --git a/gcc/function.c b/gcc/function.c index 1c67eec..978dc81 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -204,7 +204,7 @@ struct temp_slot imposed on the memory. For example, if the stack slot is the call frame for an inline functioned, we have no idea what alias sets will be assigned to various pieces of the call frame. */ - int alias_set; + HOST_WIDE_INT alias_set; /* The value of `sequence_rtl_expr' when this temporary is allocated. */ tree rtl_expr; /* Non-zero if this temporary is currently in use. */ @@ -628,6 +628,7 @@ assign_stack_local_1 (mode, size, align, function) /* Wrapper around assign_stack_local_1; assign a local stack slot for the current function. */ + rtx assign_stack_local (mode, size, align) enum machine_mode mode; @@ -662,7 +663,7 @@ assign_stack_temp_for_type (mode, size, keep, type) tree type; { int align; - int alias_set; + HOST_WIDE_INT alias_set; struct temp_slot *p, *best_p = 0; /* If SIZE is -1 it means that somebody tried to allocate a temporary @@ -684,6 +685,7 @@ assign_stack_temp_for_type (mode, size, keep, type) if (! type) type = type_for_mode (mode, 0); + if (type) align = LOCAL_ALIGNMENT (type, align); @@ -693,7 +695,7 @@ assign_stack_temp_for_type (mode, size, keep, type) for (p = temp_slots; p; p = p->next) if (p->align >= align && p->size >= size && GET_MODE (p->slot) == mode && ! p->in_use - && (!flag_strict_aliasing + && (! flag_strict_aliasing || (alias_set && p->alias_set == alias_set)) && (best_p == 0 || best_p->size > p->size || (best_p->size == p->size && best_p->align > p->align))) @@ -712,11 +714,7 @@ assign_stack_temp_for_type (mode, size, keep, type) /* If there are enough aligned bytes left over, make them into a new temp_slot so that the extra bytes don't get wasted. Do this only for BLKmode slots, so that we can be sure of the alignment. */ - if (GET_MODE (best_p->slot) == BLKmode - /* We can't split slots if -fstrict-aliasing because the - information about the alias set for the new slot will be - lost. */ - && !flag_strict_aliasing) + if (GET_MODE (best_p->slot) == BLKmode) { int alignment = best_p->align / BITS_PER_UNIT; HOST_WIDE_INT rounded_size = CEIL_ROUND (size, alignment); @@ -734,6 +732,7 @@ assign_stack_temp_for_type (mode, size, keep, type) p->align = best_p->align; p->address = 0; p->rtl_expr = 0; + p->alias_set = best_p->alias_set; p->next = temp_slots; temp_slots = p; @@ -824,7 +823,11 @@ assign_stack_temp_for_type (mode, size, keep, type) RTX_UNCHANGING_P (p->slot) = 0; MEM_IN_STRUCT_P (p->slot) = 0; MEM_SCALAR_P (p->slot) = 0; - MEM_ALIAS_SET (p->slot) = 0; + MEM_ALIAS_SET (p->slot) = alias_set; + + if (type != 0) + MEM_SET_IN_STRUCT_P (p->slot, AGGREGATE_TYPE_P (type)); + return p->slot; } @@ -875,11 +878,10 @@ assign_temp (type, keep, memory_required, dont_promote) instead. This is the case for Chill variable-sized strings. */ if (size == -1 && TREE_CODE (type) == ARRAY_TYPE && TYPE_ARRAY_MAX_SIZE (type) != NULL_TREE - && TREE_CODE (TYPE_ARRAY_MAX_SIZE (type)) == INTEGER_CST) - size = TREE_INT_CST_LOW (TYPE_ARRAY_MAX_SIZE (type)); + && host_integerp (TYPE_ARRAY_MAX_SIZE (type), 1)) + size = tree_low_cst (TYPE_ARRAY_MAX_SIZE (type), 1); tmp = assign_stack_temp_for_type (mode, size, keep, type); - MEM_SET_IN_STRUCT_P (tmp, AGGREGATE_TYPE_P (type)); return tmp; } @@ -1397,8 +1399,12 @@ put_var_into_stack (decl) else put_reg_into_stack (function, reg, TREE_TYPE (decl), promoted_mode, decl_mode, - TREE_SIDE_EFFECTS (decl), 0, - TREE_USED (decl) || DECL_INITIAL (decl) != 0, + (TREE_CODE (decl) != SAVE_EXPR + && TREE_THIS_VOLATILE (decl)), + 0, + (TREE_USED (decl) + || (TREE_CODE (decl) != SAVE_EXPR + && DECL_INITIAL (decl) != 0)), 0); } else if (GET_CODE (reg) == CONCAT) @@ -2840,9 +2846,14 @@ put_addressof_into_stack (r, ht) abort (); put_reg_into_stack (0, reg, TREE_TYPE (decl), GET_MODE (reg), - DECL_MODE (decl), TREE_SIDE_EFFECTS (decl), + GET_MODE (reg), + (TREE_CODE (decl) != SAVE_EXPR + && TREE_THIS_VOLATILE (decl)), ADDRESSOF_REGNO (r), - TREE_USED (decl) || DECL_INITIAL (decl) != 0, ht); + (TREE_USED (decl) + || (TREE_CODE (decl) != SAVE_EXPR + && DECL_INITIAL (decl) != 0)), + ht); } /* List of replacements made below in purge_addressof_1 when creating @@ -4168,7 +4179,6 @@ assign_parms (fndecl) for (parm = fnargs; parm; parm = TREE_CHAIN (parm)) { - int aggregate = AGGREGATE_TYPE_P (TREE_TYPE (parm)); struct args_size stack_offset; struct args_size arg_size; int passed_pointer = 0; @@ -4325,12 +4335,7 @@ assign_parms (fndecl) internal_arg_pointer, offset_rtx)); - /* If this is a memory ref that contains aggregate components, - mark it as such for cse and loop optimize. Likewise if it - is readonly. */ - MEM_SET_IN_STRUCT_P (stack_parm, aggregate); - RTX_UNCHANGING_P (stack_parm) = TREE_READONLY (parm); - MEM_ALIAS_SET (stack_parm) = get_alias_set (parm); + set_mem_attributes (stack_parm, parm, 1); } /* If this parameter was passed both in registers and in the stack, @@ -4435,38 +4440,6 @@ assign_parms (fndecl) && nominal_mode != BLKmode && nominal_mode != passed_mode) stack_parm = 0; -#if 0 - /* Now adjust STACK_PARM to the mode and precise location - where this parameter should live during execution, - if we discover that it must live in the stack during execution. - To make debuggers happier on big-endian machines, we store - the value in the last bytes of the space available. */ - - if (nominal_mode != BLKmode && nominal_mode != passed_mode - && stack_parm != 0) - { - rtx offset_rtx; - - if (BYTES_BIG_ENDIAN - && GET_MODE_SIZE (nominal_mode) < UNITS_PER_WORD) - stack_offset.constant += (GET_MODE_SIZE (passed_mode) - - GET_MODE_SIZE (nominal_mode)); - - offset_rtx = ARGS_SIZE_RTX (stack_offset); - if (offset_rtx == const0_rtx) - stack_parm = gen_rtx_MEM (nominal_mode, internal_arg_pointer); - else - stack_parm = gen_rtx_MEM (nominal_mode, - gen_rtx_PLUS (Pmode, - internal_arg_pointer, - offset_rtx)); - - /* If this is a memory ref that contains aggregate components, - mark it as such for cse and loop optimize. */ - MEM_SET_IN_STRUCT_P (stack_parm, aggregate); - } -#endif /* 0 */ - /* ENTRY_PARM is an RTX for the parameter as it arrives, in the mode in which it arrives. STACK_PARM is an RTX for a stack slot where the parameter can live @@ -4506,18 +4479,12 @@ assign_parms (fndecl) stack_parm = assign_stack_local (GET_MODE (entry_parm), size_stored, 0); - - /* If this is a memory ref that contains aggregate - components, mark it as such for cse and loop optimize. */ - MEM_SET_IN_STRUCT_P (stack_parm, aggregate); + set_mem_attributes (stack_parm, parm, 1); } else if (PARM_BOUNDARY % BITS_PER_WORD != 0) abort (); - if (TREE_READONLY (parm)) - RTX_UNCHANGING_P (stack_parm) = 1; - /* Handle calls that pass values in multiple non-contiguous locations. The Irix 6 ABI has examples of this. */ if (GET_CODE (entry_parm) == PARALLEL) @@ -4566,7 +4533,7 @@ assign_parms (fndecl) { DECL_RTL (parm) = gen_rtx_MEM (TYPE_MODE (TREE_TYPE (passed_type)), parmreg); - MEM_SET_IN_STRUCT_P (DECL_RTL (parm), aggregate); + set_mem_attributes (DECL_RTL (parm), parm, 1); } else DECL_RTL (parm) = parmreg; @@ -4672,8 +4639,7 @@ assign_parms (fndecl) else copy = assign_stack_temp (TYPE_MODE (type), int_size_in_bytes (type), 1); - MEM_SET_IN_STRUCT_P (copy, AGGREGATE_TYPE_P (type)); - RTX_UNCHANGING_P (copy) = TREE_READONLY (parm); + set_mem_attributes (copy, parm); store_expr (parm, copy, 0); emit_move_insn (parmreg, XEXP (copy, 0)); @@ -4824,9 +4790,7 @@ assign_parms (fndecl) stack_parm = assign_stack_local (GET_MODE (entry_parm), GET_MODE_SIZE (GET_MODE (entry_parm)), 0); - /* If this is a memory ref that contains aggregate components, - mark it as such for cse and loop optimize. */ - MEM_SET_IN_STRUCT_P (stack_parm, aggregate); + set_mem_attributes (stack_parm, parm, 1); } if (promoted_mode != nominal_mode) @@ -4863,19 +4827,12 @@ assign_parms (fndecl) if (parm == function_result_decl) { tree result = DECL_RESULT (fndecl); - tree restype = TREE_TYPE (result); DECL_RTL (result) = gen_rtx_MEM (DECL_MODE (result), DECL_RTL (parm)); - MEM_SET_IN_STRUCT_P (DECL_RTL (result), - AGGREGATE_TYPE_P (restype)); + set_mem_attributes (DECL_RTL (result), result, 1); } - - if (TREE_THIS_VOLATILE (parm)) - MEM_VOLATILE_P (DECL_RTL (parm)) = 1; - if (TREE_READONLY (parm)) - RTX_UNCHANGING_P (DECL_RTL (parm)) = 1; } /* Output all parameter conversion instructions (possibly including calls) @@ -5398,7 +5355,9 @@ fix_lexical_addr (addr, var) addr = fix_lexical_addr (XEXP (fp->x_arg_pointer_save_area, 0), var); addr = memory_address (Pmode, addr); - base = copy_to_reg (gen_rtx_MEM (Pmode, addr)); + base = gen_rtx_MEM (Pmode, addr); + MEM_ALIAS_SET (base) = get_frame_alias_set (); + base = copy_to_reg (base); #else displacement += (FIRST_PARM_OFFSET (context) - STARTING_FRAME_OFFSET); base = lookup_static_chain (var); @@ -6149,10 +6108,8 @@ expand_function_start (subr, parms_have_cleanups) { DECL_RTL (DECL_RESULT (subr)) = gen_rtx_MEM (DECL_MODE (DECL_RESULT (subr)), value_address); - MEM_SET_IN_STRUCT_P (DECL_RTL (DECL_RESULT (subr)), - AGGREGATE_TYPE_P (TREE_TYPE - (DECL_RESULT - (subr)))); + set_mem_attributes (DECL_RTL (DECL_RESULT (subr)), + DECL_RESULT (subr), 1); } } else if (DECL_MODE (DECL_RESULT (subr)) == VOIDmode) @@ -6247,9 +6204,9 @@ expand_function_start (subr, parms_have_cleanups) #ifdef FRAME_GROWS_DOWNWARD last_ptr = plus_constant (last_ptr, - GET_MODE_SIZE (Pmode)); #endif - last_ptr = copy_to_reg (gen_rtx_MEM (Pmode, - memory_address (Pmode, - last_ptr))); + last_ptr = gen_rtx_MEM (Pmode, memory_address (Pmode, last_ptr)); + MEM_ALIAS_SET (last_ptr) = get_frame_alias_set (); + last_ptr = copy_to_reg (last_ptr); /* If we are not optimizing, ensure that we know that this piece of context is live over the entire function. */ |