Re: [043/nnn] poly_int: frame allocations

2017-12-05 Thread Jeff Law
On 10/23/2017 11:18 AM, Richard Sandiford wrote:
> 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-10-23  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.
> 

OK
Jeff



[043/nnn] poly_int: frame allocations

2017-10-23 Thread Richard Sandiford
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-10-23  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.

Index: gcc/function.h
===
--- gcc/function.h  2017-10-23 17:07:40.163546918 +0100
+++ gcc/function.h  2017-10-23 17:18:53.834514759 +0100
@@ -187,8 +187,8 @@ struct GTY(()) frame_space
 {
   struct frame_space *next;
 
-  HOST_WIDE_INT start;
-  HOST_WIDE_INT length;
+  poly_int64 start;
+  poly_int64 length;
 };
 
 struct GTY(()) stack_usage
@@ -571,19 +571,19 @@ extern void free_after_compilation (stru
 /* Return size needed for stack frame based on slots so far allocated.
This size counts from zero.  It is not rounded to STACK_BOUNDARY;
the caller may have to do that.  */
-extern HOST_WIDE_INT get_frame_size (void);
+extern poly_int64 get_frame_size (void);
 
 /* Issue an error message and return TRUE if frame OFFSET overflows in
the signed target pointer arithmetics for function FUNC.  Otherwise
return FALSE.  */
-extern bool frame_offset_overflow (HOST_WIDE_INT, tree);
+extern bool frame_offset_overflow (poly_int64, tree);
 
 extern unsigned int spill_slot_alignment (machine_mode);
 
-extern rtx assign_stack_local_1 (machine_mode, HOST_WIDE_INT, int, int);
-extern rtx assign_stack_local (machine_mode, HOST_WIDE_INT, int);
-extern rtx assign_stack_temp_for_type (machine_mode, HOST_WIDE_INT, tree);
-extern rtx assign_stack_temp (machine_mode, HOST_WIDE_INT);
+extern rtx assign_stack_local_1 (machine_mode, poly_int64, int, int);
+extern rtx assign_stack_local (machine_mode, poly_int64, int);
+extern rtx assign_stack_temp_for_type (machine_mode, poly_int64, tree);
+extern rtx assign_stack_temp (machine_mode, poly_int64);
 extern rtx assign_temp (tree, int, int);
 extern void update_temp_slot_address (rtx, rtx);