From f075bd950c5ad3e2baeb3d8f82fe962efc8e4f7a Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Thu, 21 Dec 2017 06:58:16 +0000 Subject: poly_int: frame allocations This patch converts the frame allocation code (mostly in function.c) to use poly_int64 rather than HOST_WIDE_INT for frame offsets and sizes. 2017-12-21 Richard Sandiford Alan Hayward David Sherwood gcc/ * function.h (frame_space): Change start and length from HOST_WIDE_INT to poly_int64. (get_frame_size): Return the size as a poly_int64 rather than a HOST_WIDE_INT. (frame_offset_overflow): Take the offset as a poly_int64 rather than a HOST_WIDE_INT. (assign_stack_local_1, assign_stack_local, assign_stack_temp_for_type) (assign_stack_temp): Likewise for the size. * function.c (get_frame_size): Return a poly_int64 rather than a HOST_WIDE_INT. (frame_offset_overflow): Take the offset as a poly_int64 rather than a HOST_WIDE_INT. (try_fit_stack_local): Take the start, length and size as poly_int64s rather than HOST_WIDE_INTs. Return the offset as a poly_int64_pod rather than a HOST_WIDE_INT. (add_frame_space): Take the start and end as poly_int64s rather than HOST_WIDE_INTs. (assign_stack_local_1, assign_stack_local, assign_stack_temp_for_type) (assign_stack_temp): Likewise for the size. (temp_slot): Change size, base_offset and full_size from HOST_WIDE_INT to poly_int64. (find_temp_slot_from_address): Handle polynomial offsets. (combine_temp_slots): Likewise. * emit-rtl.h (rtl_data::x_frame_offset): Change from HOST_WIDE_INT to poly_int64. * cfgexpand.c (alloc_stack_frame_space): Return the offset as a poly_int64 rather than a HOST_WIDE_INT. (expand_one_stack_var_at): Take the offset as a poly_int64 rather than a HOST_WIDE_INT. (expand_stack_vars, expand_one_stack_var_1, expand_used_vars): Handle polynomial frame offsets. * config/m32r/m32r-protos.h (m32r_compute_frame_size): Take the size as a poly_int64 rather than an int. * config/m32r/m32r.c (m32r_compute_frame_size): Likewise. * config/v850/v850-protos.h (compute_frame_size): Likewise. * config/v850/v850.c (compute_frame_size): Likewise. * config/xtensa/xtensa-protos.h (compute_frame_size): Likewise. * config/xtensa/xtensa.c (compute_frame_size): Likewise. * config/pa/pa-protos.h (pa_compute_frame_size): Likewise. * config/pa/pa.c (pa_compute_frame_size): Likewise. * explow.h (get_dynamic_stack_base): Take the offset as a poly_int64 rather than a HOST_WIDE_INT. * explow.c (get_dynamic_stack_base): Likewise. * final.c (final_start_function): Use the constant lower bound of the frame size for -Wframe-larger-than. * ira.c (do_reload): Adjust for new get_frame_size return type. * lra.c (lra): Likewise. * reload1.c (reload): Likewise. * config/avr/avr.c (avr_asm_function_end_prologue): Likewise. * config/pa/pa.h (EXIT_IGNORE_STACK): Likewise. * rtlanal.c (get_initial_register_offset): Return the offset as a poly_int64 rather than a HOST_WIDE_INT. Co-Authored-By: Alan Hayward Co-Authored-By: David Sherwood From-SVN: r255917 --- gcc/reload1.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'gcc/reload1.c') diff --git a/gcc/reload1.c b/gcc/reload1.c index 0f90a4c..7cf6412 100644 --- a/gcc/reload1.c +++ b/gcc/reload1.c @@ -887,7 +887,7 @@ reload (rtx_insn *first, int global) for (;;) { int something_changed; - HOST_WIDE_INT starting_frame_size; + poly_int64 starting_frame_size; starting_frame_size = get_frame_size (); something_was_spilled = false; @@ -955,7 +955,7 @@ reload (rtx_insn *first, int global) if (caller_save_needed) setup_save_areas (); - if (starting_frame_size && crtl->stack_alignment_needed) + if (maybe_ne (starting_frame_size, 0) && crtl->stack_alignment_needed) { /* If we have a stack frame, we must align it now. The stack size may be a part of the offset computation for @@ -968,7 +968,8 @@ reload (rtx_insn *first, int global) assign_stack_local (BLKmode, 0, crtl->stack_alignment_needed); } /* If we allocated another stack slot, redo elimination bookkeeping. */ - if (something_was_spilled || starting_frame_size != get_frame_size ()) + if (something_was_spilled + || maybe_ne (starting_frame_size, get_frame_size ())) { if (update_eliminables_and_spill ()) finish_spills (0); @@ -994,7 +995,8 @@ reload (rtx_insn *first, int global) /* If we allocated any new memory locations, make another pass since it might have changed elimination offsets. */ - if (something_was_spilled || starting_frame_size != get_frame_size ()) + if (something_was_spilled + || maybe_ne (starting_frame_size, get_frame_size ())) something_changed = 1; /* Even if the frame size remained the same, we might still have @@ -1043,11 +1045,11 @@ reload (rtx_insn *first, int global) if (insns_need_reload != 0 || something_needs_elimination || something_needs_operands_changed) { - HOST_WIDE_INT old_frame_size = get_frame_size (); + poly_int64 old_frame_size = get_frame_size (); reload_as_needed (global); - gcc_assert (old_frame_size == get_frame_size ()); + gcc_assert (known_eq (old_frame_size, get_frame_size ())); gcc_assert (verify_initial_elim_offsets ()); } -- cgit v1.1