poly_int: ipa_parm_adjustment
authorRichard Sandiford <richard.sandiford@linaro.org>
Wed, 20 Dec 2017 12:54:55 +0000 (12:54 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Wed, 20 Dec 2017 12:54:55 +0000 (12:54 +0000)
This patch changes the type of ipa_parm_adjustment::offset from
HOST_WIDE_INT to poly_int64 and updates uses accordingly.

2017-12-20  Richard Sandiford  <richard.sandiford@linaro.org>
    Alan Hayward  <alan.hayward@arm.com>
    David Sherwood  <david.sherwood@arm.com>

gcc/
* ipa-param-manipulation.h (ipa_parm_adjustment::offset): Change from
HOST_WIDE_INT to poly_int64_pod.
* ipa-param-manipulation.c (ipa_modify_call_arguments): Track
polynomail parameter offsets.

Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r255885

gcc/ChangeLog
gcc/ipa-param-manipulation.c
gcc/ipa-param-manipulation.h

index 7bb3f5d5371449878588444d4674ada17635b871..a909fa79349de6b807135b7c98562b73ebe90c5f 100644 (file)
@@ -1,3 +1,12 @@
+2017-12-20  Richard Sandiford  <richard.sandiford@linaro.org>
+           Alan Hayward  <alan.hayward@arm.com>
+           David Sherwood  <david.sherwood@arm.com>
+
+       * ipa-param-manipulation.h (ipa_parm_adjustment::offset): Change from
+       HOST_WIDE_INT to poly_int64_pod.
+       * ipa-param-manipulation.c (ipa_modify_call_arguments): Track
+       polynomail parameter offsets.
+
 2017-12-20  Richard Sandiford  <richard.sandiford@linaro.org>
            Alan Hayward  <alan.hayward@arm.com>
            David Sherwood  <david.sherwood@arm.com>
index bcc736b99c0f0bb786b169f112d79cebba3fea90..3d559f5b5a429e3943ec8d3294a0e545c7a07250 100644 (file)
@@ -293,15 +293,14 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gcall *stmt,
             simply taking the address of a reference inside the original
             aggregate.  */
 
-         gcc_checking_assert (adj->offset % BITS_PER_UNIT == 0);
+         poly_int64 byte_offset = exact_div (adj->offset, BITS_PER_UNIT);
          base = gimple_call_arg (stmt, adj->base_index);
          loc = DECL_P (base) ? DECL_SOURCE_LOCATION (base)
                              : EXPR_LOCATION (base);
 
          if (TREE_CODE (base) != ADDR_EXPR
              && POINTER_TYPE_P (TREE_TYPE (base)))
-           off = build_int_cst (adj->alias_ptr_type,
-                                adj->offset / BITS_PER_UNIT);
+           off = build_int_cst (adj->alias_ptr_type, byte_offset);
          else
            {
              HOST_WIDE_INT base_offset;
@@ -321,8 +320,7 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gcall *stmt,
              if (!base)
                {
                  base = build_fold_addr_expr (prev_base);
-                 off = build_int_cst (adj->alias_ptr_type,
-                                      adj->offset / BITS_PER_UNIT);
+                 off = build_int_cst (adj->alias_ptr_type, byte_offset);
                }
              else if (TREE_CODE (base) == MEM_REF)
                {
@@ -332,8 +330,7 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gcall *stmt,
                      deref_align = TYPE_ALIGN (TREE_TYPE (base));
                    }
                  off = build_int_cst (adj->alias_ptr_type,
-                                      base_offset
-                                      + adj->offset / BITS_PER_UNIT);
+                                      base_offset + byte_offset);
                  off = int_const_binop (PLUS_EXPR, TREE_OPERAND (base, 1),
                                         off);
                  base = TREE_OPERAND (base, 0);
@@ -341,8 +338,7 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gcall *stmt,
              else
                {
                  off = build_int_cst (adj->alias_ptr_type,
-                                      base_offset
-                                      + adj->offset / BITS_PER_UNIT);
+                                      base_offset + byte_offset);
                  base = build_fold_addr_expr (base);
                }
            }
@@ -655,7 +651,7 @@ ipa_get_adjustment_candidate (tree **expr, bool *convert,
       struct ipa_parm_adjustment *adj = &adjustments[i];
 
       if (adj->base == base
-         && (adj->offset == offset || adj->op == IPA_PARM_OP_REMOVE))
+         && (known_eq (adj->offset, offset) || adj->op == IPA_PARM_OP_REMOVE))
        {
          cand = adj;
          break;
@@ -756,7 +752,10 @@ ipa_dump_param_adjustments (FILE *file, ipa_parm_adjustment_vec adjustments,
       else if (adj->op == IPA_PARM_OP_REMOVE)
        fprintf (file, ", remove_param");
       else
-       fprintf (file, ", offset %li", (long) adj->offset);
+       {
+         fprintf (file, ", offset ");
+         print_dec (adj->offset, file);
+       }
       if (adj->by_ref)
        fprintf (file, ", by_ref");
       print_node_brief (file, ", type: ", adj->type, 0);
index 364e4489c294ddf94d757187878613f81697e624..7bf942fe2c36e94fafa5db765f634f40223be108 100644 (file)
@@ -84,7 +84,7 @@ struct ipa_parm_adjustment
 
   /* Offset into the original parameter (for the cases when the new parameter
      is a component of an original one).  */
-  HOST_WIDE_INT offset;
+  poly_int64_pod offset;
 
   /* Zero based index of the original parameter this one is based on.  */
   int base_index;