Re: [050/nnn] poly_int: reload<->ira interface

2017-11-28 Thread Jeff Law
On 10/23/2017 11:21 AM, Richard Sandiford wrote:
> This patch uses poly_int64 for:
> 
> - ira_reuse_stack_slot
> - ira_mark_new_stack_slot
> - ira_spilled_reg_stack_slot::width
> 
> all of which are part of the IRA/reload interface.
> 
> 
> 2017-10-23  Richard Sandiford  
>   Alan Hayward  
>   David Sherwood  
> 
> gcc/
>   * ira-int.h (ira_spilled_reg_stack_slot::width): Change from
>   an unsigned int to a poly_uint64.
>   * ira.h (ira_reuse_stack_slot, ira_mark_new_stack_slot): Take the
>   sizes as poly_uint64s rather than unsigned ints.
>   * ira-color.c (ira_reuse_stack_slot, ira_mark_new_stack_slot):
>   Likewise.
OK
Jeff





[050/nnn] poly_int: reload<->ira interface

2017-10-23 Thread Richard Sandiford
This patch uses poly_int64 for:

- ira_reuse_stack_slot
- ira_mark_new_stack_slot
- ira_spilled_reg_stack_slot::width

all of which are part of the IRA/reload interface.


2017-10-23  Richard Sandiford  
Alan Hayward  
David Sherwood  

gcc/
* ira-int.h (ira_spilled_reg_stack_slot::width): Change from
an unsigned int to a poly_uint64.
* ira.h (ira_reuse_stack_slot, ira_mark_new_stack_slot): Take the
sizes as poly_uint64s rather than unsigned ints.
* ira-color.c (ira_reuse_stack_slot, ira_mark_new_stack_slot):
Likewise.

Index: gcc/ira-int.h
===
--- gcc/ira-int.h   2017-10-23 16:52:18.222670182 +0100
+++ gcc/ira-int.h   2017-10-23 17:20:48.204761416 +0100
@@ -604,7 +604,7 @@ struct ira_spilled_reg_stack_slot
   /* RTL representation of the stack slot.  */
   rtx mem;
   /* Size of the stack slot.  */
-  unsigned int width;
+  poly_uint64_pod width;
 };
 
 /* The number of elements in the following array.  */
Index: gcc/ira.h
===
--- gcc/ira.h   2017-10-23 17:10:45.257213436 +0100
+++ gcc/ira.h   2017-10-23 17:20:48.204761416 +0100
@@ -200,8 +200,8 @@ extern void ira_mark_allocation_change (
 extern void ira_mark_memory_move_deletion (int, int);
 extern bool ira_reassign_pseudos (int *, int, HARD_REG_SET, HARD_REG_SET *,
  HARD_REG_SET *, bitmap);
-extern rtx ira_reuse_stack_slot (int, unsigned int, unsigned int);
-extern void ira_mark_new_stack_slot (rtx, int, unsigned int);
+extern rtx ira_reuse_stack_slot (int, poly_uint64, poly_uint64);
+extern void ira_mark_new_stack_slot (rtx, int, poly_uint64);
 extern bool ira_better_spill_reload_regno_p (int *, int *, rtx, rtx, rtx_insn 
*);
 extern bool ira_bad_reload_regno (int, rtx, rtx);
 
Index: gcc/ira-color.c
===
--- gcc/ira-color.c 2017-10-23 17:11:40.005487591 +0100
+++ gcc/ira-color.c 2017-10-23 17:20:48.204761416 +0100
@@ -4495,8 +4495,8 @@ ira_reassign_pseudos (int *spilled_pseud
TOTAL_SIZE.  In the case of failure to find a slot which can be
used for REGNO, the function returns NULL.  */
 rtx
-ira_reuse_stack_slot (int regno, unsigned int inherent_size,
- unsigned int total_size)
+ira_reuse_stack_slot (int regno, poly_uint64 inherent_size,
+ poly_uint64 total_size)
 {
   unsigned int i;
   int slot_num, best_slot_num;
@@ -4509,8 +4509,8 @@ ira_reuse_stack_slot (int regno, unsigne
 
   ira_assert (! ira_use_lra_p);
 
-  ira_assert (inherent_size == PSEUDO_REGNO_BYTES (regno)
- && inherent_size <= total_size
+  ira_assert (must_eq (inherent_size, PSEUDO_REGNO_BYTES (regno))
+ && must_le (inherent_size, total_size)
  && ALLOCNO_HARD_REGNO (allocno) < 0);
   if (! flag_ira_share_spill_slots)
 return NULL_RTX;
@@ -4533,8 +4533,8 @@ ira_reuse_stack_slot (int regno, unsigne
  slot = _spilled_reg_stack_slots[slot_num];
  if (slot->mem == NULL_RTX)
continue;
- if (slot->width < total_size
- || GET_MODE_SIZE (GET_MODE (slot->mem)) < inherent_size)
+ if (may_lt (slot->width, total_size)
+ || may_lt (GET_MODE_SIZE (GET_MODE (slot->mem)), inherent_size))
continue;
 
  EXECUTE_IF_SET_IN_BITMAP (>spilled_regs,
@@ -4586,7 +4586,7 @@ ira_reuse_stack_slot (int regno, unsigne
 }
   if (x != NULL_RTX)
 {
-  ira_assert (slot->width >= total_size);
+  ira_assert (must_ge (slot->width, total_size));
 #ifdef ENABLE_IRA_CHECKING
   EXECUTE_IF_SET_IN_BITMAP (>spilled_regs,
FIRST_PSEUDO_REGISTER, i, bi)
@@ -4615,7 +4615,7 @@ ira_reuse_stack_slot (int regno, unsigne
TOTAL_SIZE was allocated for REGNO.  We store this info for
subsequent ira_reuse_stack_slot calls.  */
 void
-ira_mark_new_stack_slot (rtx x, int regno, unsigned int total_size)
+ira_mark_new_stack_slot (rtx x, int regno, poly_uint64 total_size)
 {
   struct ira_spilled_reg_stack_slot *slot;
   int slot_num;
@@ -4623,7 +4623,7 @@ ira_mark_new_stack_slot (rtx x, int regn
 
   ira_assert (! ira_use_lra_p);
 
-  ira_assert (PSEUDO_REGNO_BYTES (regno) <= total_size);
+  ira_assert (must_le (PSEUDO_REGNO_BYTES (regno), total_size));
   allocno = ira_regno_allocno_map[regno];
   slot_num = -ALLOCNO_HARD_REGNO (allocno) - 2;
   if (slot_num == -1)