]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
poly_int: PUSH_ROUNDING
authorRichard Sandiford <richard.sandiford@linaro.org>
Wed, 3 Jan 2018 07:18:13 +0000 (07:18 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Wed, 3 Jan 2018 07:18:13 +0000 (07:18 +0000)
PUSH_ROUNDING is difficult to convert to a hook since there is still
a lot of conditional code based on it.  It isn't clear that a direct
conversion with checks for null hooks is the right thing to do.

Rather than untangle that, this patch converts all implementations
that do something to out-of-line functions that have the same
interface as a hook would have.  This should at least help towards
any future hook conversion.

2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
    Alan Hayward  <alan.hayward@arm.com>
    David Sherwood  <david.sherwood@arm.com>

gcc/
* config/cr16/cr16-protos.h (cr16_push_rounding): Declare.
* config/cr16/cr16.h (PUSH_ROUNDING): Move implementation to...
* config/cr16/cr16.c (cr16_push_rounding): ...this new function.
* config/h8300/h8300-protos.h (h8300_push_rounding): Declare.
* config/h8300/h8300.h (PUSH_ROUNDING): Move implementation to...
* config/h8300/h8300.c (h8300_push_rounding): ...this new function.
* config/i386/i386-protos.h (ix86_push_rounding): Declare.
* config/i386/i386.h (PUSH_ROUNDING): Move implementation to...
* config/i386/i386.c (ix86_push_rounding): ...this new function.
* config/m32c/m32c-protos.h (m32c_push_rounding): Take and return
a poly_int64.
* config/m32c/m32c.c (m32c_push_rounding): Likewise.
* config/m68k/m68k-protos.h (m68k_push_rounding): Declare.
* config/m68k/m68k.h (PUSH_ROUNDING): Move implementation to...
* config/m68k/m68k.c (m68k_push_rounding): ...this new function.
* config/pdp11/pdp11-protos.h (pdp11_push_rounding): Declare.
* config/pdp11/pdp11.h (PUSH_ROUNDING): Move implementation to...
* config/pdp11/pdp11.c (pdp11_push_rounding): ...this new function.
* config/stormy16/stormy16-protos.h (xstormy16_push_rounding): Declare.
* config/stormy16/stormy16.h (PUSH_ROUNDING): Move implementation to...
* config/stormy16/stormy16.c (xstormy16_push_rounding): ...this new
function.
* expr.c (emit_move_resolve_push): Treat the input and result
of PUSH_ROUNDING as a poly_int64.
(emit_move_complex_push, emit_single_push_insn_1): Likewise.
(emit_push_insn): Likewise.
* lra-eliminations.c (mark_not_eliminable): Likewise.
* recog.c (push_operand): Likewise.
* reload1.c (elimination_effects): Likewise.
* rtlanal.c (nonzero_bits1): Likewise.
* calls.c (store_one_arg): Likewise.  Require the padding to be
known at compile time.

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

27 files changed:
gcc/ChangeLog
gcc/calls.c
gcc/config/cr16/cr16-protos.h
gcc/config/cr16/cr16.c
gcc/config/cr16/cr16.h
gcc/config/h8300/h8300-protos.h
gcc/config/h8300/h8300.c
gcc/config/h8300/h8300.h
gcc/config/i386/i386-protos.h
gcc/config/i386/i386.c
gcc/config/i386/i386.h
gcc/config/m32c/m32c-protos.h
gcc/config/m32c/m32c.c
gcc/config/m68k/m68k-protos.h
gcc/config/m68k/m68k.c
gcc/config/m68k/m68k.h
gcc/config/pdp11/pdp11-protos.h
gcc/config/pdp11/pdp11.c
gcc/config/pdp11/pdp11.h
gcc/config/stormy16/stormy16-protos.h
gcc/config/stormy16/stormy16.c
gcc/config/stormy16/stormy16.h
gcc/expr.c
gcc/lra-eliminations.c
gcc/recog.c
gcc/reload1.c
gcc/rtlanal.c

index d37f05a5cfe2d5c70f8b12c44a819d4e92b5f228..d9428fe63c6a0f8425467db27587ef7d97ec7c48 100644 (file)
@@ -1,3 +1,40 @@
+2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
+           Alan Hayward  <alan.hayward@arm.com>
+           David Sherwood  <david.sherwood@arm.com>
+
+       * config/cr16/cr16-protos.h (cr16_push_rounding): Declare.
+       * config/cr16/cr16.h (PUSH_ROUNDING): Move implementation to...
+       * config/cr16/cr16.c (cr16_push_rounding): ...this new function.
+       * config/h8300/h8300-protos.h (h8300_push_rounding): Declare.
+       * config/h8300/h8300.h (PUSH_ROUNDING): Move implementation to...
+       * config/h8300/h8300.c (h8300_push_rounding): ...this new function.
+       * config/i386/i386-protos.h (ix86_push_rounding): Declare.
+       * config/i386/i386.h (PUSH_ROUNDING): Move implementation to...
+       * config/i386/i386.c (ix86_push_rounding): ...this new function.
+       * config/m32c/m32c-protos.h (m32c_push_rounding): Take and return
+       a poly_int64.
+       * config/m32c/m32c.c (m32c_push_rounding): Likewise.
+       * config/m68k/m68k-protos.h (m68k_push_rounding): Declare.
+       * config/m68k/m68k.h (PUSH_ROUNDING): Move implementation to...
+       * config/m68k/m68k.c (m68k_push_rounding): ...this new function.
+       * config/pdp11/pdp11-protos.h (pdp11_push_rounding): Declare.
+       * config/pdp11/pdp11.h (PUSH_ROUNDING): Move implementation to...
+       * config/pdp11/pdp11.c (pdp11_push_rounding): ...this new function.
+       * config/stormy16/stormy16-protos.h (xstormy16_push_rounding): Declare.
+       * config/stormy16/stormy16.h (PUSH_ROUNDING): Move implementation to...
+       * config/stormy16/stormy16.c (xstormy16_push_rounding): ...this new
+       function.
+       * expr.c (emit_move_resolve_push): Treat the input and result
+       of PUSH_ROUNDING as a poly_int64.
+       (emit_move_complex_push, emit_single_push_insn_1): Likewise.
+       (emit_push_insn): Likewise.
+       * lra-eliminations.c (mark_not_eliminable): Likewise.
+       * recog.c (push_operand): Likewise.
+       * reload1.c (elimination_effects): Likewise.
+       * rtlanal.c (nonzero_bits1): Likewise.
+       * calls.c (store_one_arg): Likewise.  Require the padding to be
+       known at compile time.
+
 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
            Alan Hayward  <alan.hayward@arm.com>
            David Sherwood  <david.sherwood@arm.com>
index 9b7e1189918eeb35d1fdf47ba90108bf46d1610a..404cccc91366efaaeff4e4b8848d93913da86311 100644 (file)
@@ -5639,7 +5639,6 @@ store_one_arg (struct arg_data *arg, rtx argblock, int flags,
     ;
   else if (arg->mode != BLKmode)
     {
-      int size;
       unsigned int parm_align;
 
       /* Argument is a scalar, not entirely passed in registers.
@@ -5652,10 +5651,8 @@ store_one_arg (struct arg_data *arg, rtx argblock, int flags,
         Note that in C the default argument promotions
         will prevent such mismatches.  */
 
-      if (TYPE_EMPTY_P (TREE_TYPE (pval)))
-       size = 0;
-      else
-       size = GET_MODE_SIZE (arg->mode);
+      poly_int64 size = (TYPE_EMPTY_P (TREE_TYPE (pval))
+                        ? 0 : GET_MODE_SIZE (arg->mode));
 
       /* Compute how much space the push instruction will push.
         On many machines, pushing a byte will advance the stack
@@ -5669,9 +5666,10 @@ store_one_arg (struct arg_data *arg, rtx argblock, int flags,
         round up to a multiple of the alignment for arguments.  */
       if (targetm.calls.function_arg_padding (arg->mode, TREE_TYPE (pval))
          != PAD_NONE)
-       used = (((size + PARM_BOUNDARY / BITS_PER_UNIT - 1)
-                / (PARM_BOUNDARY / BITS_PER_UNIT))
-               * (PARM_BOUNDARY / BITS_PER_UNIT));
+       /* At the moment we don't (need to) support ABIs for which the
+          padding isn't known at compile time.  In principle it should
+          be easy to add though.  */
+       used = force_align_up (size, PARM_BOUNDARY / BITS_PER_UNIT);
 
       /* Compute the alignment of the pushed argument.  */
       parm_align = arg->locate.boundary;
index 4872c0b8b2e3c97f050ab99b3e3661da54da2b68..886669092c5ec10e517c18383930620e17cdc256 100644 (file)
@@ -94,5 +94,6 @@ extern const char *cr16_emit_logical_di (rtx *, enum rtx_code);
 /* Handling the "interrupt" attribute.  */
 extern int cr16_interrupt_function_p (void);
 extern bool cr16_is_data_model (enum data_model_type);
+extern poly_int64 cr16_push_rounding (poly_int64);
 
 #endif /* Not GCC_CR16_PROTOS_H.  */ 
index ddadab2ca7b98a3d128a477ec6843437817022ad..9ea02a967ff4e3db932541b6696a251f4cf49110 100644 (file)
@@ -2215,6 +2215,14 @@ cr16_emit_logical_di (rtx *operands, enum rtx_code code)
   return "";
 }
 
+/* Implement PUSH_ROUNDING.  */
+
+poly_int64
+cr16_push_rounding (poly_int64 bytes)
+{
+  return (bytes + 1) & ~1;
+}
+
 /* Initialize 'targetm' variable which contains pointers to functions 
    and data relating to the target machine.  */
 
index 5c4702c28ef35b19f43c9748ed0ff51306c1ea97..692bbaf86d5fefbd207faf4bad05a63957cfc571 100644 (file)
@@ -381,7 +381,7 @@ enum reg_class
 
 #define PUSH_ARGS 1
 
-#define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & ~1)
+#define PUSH_ROUNDING(BYTES) cr16_push_rounding (BYTES)
 
 #ifndef CUMULATIVE_ARGS
 struct cumulative_args
index d6adebbbe94390c5aa1f593a43eecd0f8f1f744a..1d4a574c7b9240012ea49f31c2751b3a6d3f9d78 100644 (file)
@@ -112,5 +112,6 @@ extern bool            h8sx_mergeable_memrefs_p (rtx, rtx);
 extern bool            h8sx_emit_movmd (rtx, rtx, rtx, HOST_WIDE_INT);
 extern void            h8300_swap_into_er6 (rtx);
 extern void            h8300_swap_out_of_er6 (rtx);
+extern poly_int64      h8300_push_rounding (poly_int64);
 
 #endif /* ! GCC_H8300_PROTOS_H */
index 88c21534471c115efe434cf2bb099c0a94c999a2..432e23e37ff0d9a6514feb6891047486cbbff478 100644 (file)
@@ -6044,6 +6044,21 @@ h8300_trampoline_init (rtx m_tramp, tree fndecl, rtx cxt)
       emit_move_insn (mem, tem);
     }
 }
+
+/* Implement PUSH_ROUNDING.
+
+   On the H8/300, @-sp really pushes a byte if you ask it to - but that's
+   dangerous, so we claim that it always pushes a word, then we catch
+   the mov.b rx,@-sp and turn it into a mov.w rx,@-sp on output.
+
+   On the H8/300H, we simplify TARGET_QUICKCALL by setting this to 4
+   and doing a similar thing.  */
+
+poly_int64
+h8300_push_rounding (poly_int64 bytes)
+{
+  return ((bytes + PARM_BOUNDARY / 8 - 1) & (-PARM_BOUNDARY / 8));
+}
 \f
 /* Initialize the GCC target structure.  */
 #undef TARGET_ATTRIBUTE_TABLE
index 9ba82a76ab9275e891f1eeadaa14551488108b21..a57e7b543e5ce59a1bbe91eadeaf9031df30c287 100644 (file)
@@ -352,18 +352,7 @@ enum reg_class {
 
 #define FRAME_GROWS_DOWNWARD 1
 
-/* If we generate an insn to push BYTES bytes,
-   this says how many the stack pointer really advances by.
-
-   On the H8/300, @-sp really pushes a byte if you ask it to - but that's
-   dangerous, so we claim that it always pushes a word, then we catch
-   the mov.b rx,@-sp and turn it into a mov.w rx,@-sp on output.
-
-   On the H8/300H, we simplify TARGET_QUICKCALL by setting this to 4
-   and doing a similar thing.  */
-
-#define PUSH_ROUNDING(BYTES) \
-  (((BYTES) + PARM_BOUNDARY / 8 - 1) & -PARM_BOUNDARY / 8)
+#define PUSH_ROUNDING(BYTES) h8300_push_rounding (BYTES)
 
 /* Offset of first parameter from the argument pointer register value.  */
 /* Is equal to the size of the saved fp + pc, even if an fp isn't
index 287b019858951935da14cb25bf2407ebaffed61a..d1b5330c351a2bb6191a1aafbeabff5c24f41e39 100644 (file)
@@ -323,6 +323,8 @@ extern void ix86_core2i7_init_hooks (void);
 
 extern int ix86_atom_sched_reorder (FILE *, int, rtx_insn **, int *, int);
 
+extern poly_int64 ix86_push_rounding (poly_int64);
+
 #ifdef RTX_CODE
 /* Target data for multipass lookahead scheduling.
    Currently used for Core 2/i7 tuning.  */
index cac510de9710766a5139d095d0212954a628496b..ff058f44542a2297645d5f4d7e52361c79100f36 100644 (file)
@@ -49964,6 +49964,19 @@ ix86_excess_precision (enum excess_precision_type type)
   return FLT_EVAL_METHOD_UNPREDICTABLE;
 }
 
+/* Implement PUSH_ROUNDING.  On 386, we have pushw instruction that
+   decrements by exactly 2 no matter what the position was, there is no pushb.
+
+   But as CIE data alignment factor on this arch is -4 for 32bit targets
+   and -8 for 64bit targets, we need to make sure all stack pointer adjustments
+   are in multiple of 4 for 32bit targets and 8 for 64bit targets.  */
+
+poly_int64
+ix86_push_rounding (poly_int64 bytes)
+{
+  return ROUND_UP (bytes, UNITS_PER_WORD);
+}
+
 /* Target-specific selftests.  */
 
 #if CHECKING_P
index 3b953de506a33553d9ffa44b8d2784271093e69c..8a17c0e17c4b5b2f4a131ed8b5a8d61218cfe8fa 100644 (file)
@@ -1547,15 +1547,7 @@ enum reg_class
    goes at a more negative offset in the frame.  */
 #define FRAME_GROWS_DOWNWARD 1
 
-/* If we generate an insn to push BYTES bytes, this says how many the stack
-   pointer really advances by.  On 386, we have pushw instruction that
-   decrements by exactly 2 no matter what the position was, there is no pushb.
-
-   But as CIE data alignment factor on this arch is -4 for 32bit targets
-   and -8 for 64bit targets, we need to make sure all stack pointer adjustments
-   are in multiple of 4 for 32bit targets and 8 for 64bit targets.  */
-
-#define PUSH_ROUNDING(BYTES) ROUND_UP ((BYTES), UNITS_PER_WORD)
+#define PUSH_ROUNDING(BYTES) ix86_push_rounding (BYTES)
 
 /* If defined, the maximum amount of space required for outgoing arguments
    will be computed and placed into the variable `crtl->outgoing_args_size'.
index 8647a208420e48e8b816f22b5fc6fa50dbd7634b..f68d3b3185d006235f21cf8e8380c49a046a5c32 100644 (file)
@@ -29,7 +29,7 @@ void m32c_init_expanders (void);
 int  m32c_initial_elimination_offset (int, int);
 void m32c_output_reg_pop (FILE *, int);
 void m32c_output_reg_push (FILE *, int);
-unsigned int  m32c_push_rounding (int);
+poly_int64 m32c_push_rounding (poly_int64);
 void m32c_register_pragmas (void);
 void m32c_note_pragma_address (const char *, unsigned);
 int  m32c_regno_ok_for_base_p (int);
index f1a465a4b44dd6b995d417781d19e27331a42497..d8f69ee8ed9fb4472a85dbd8b92e6c1dc766e745 100644 (file)
@@ -1290,8 +1290,8 @@ m32c_initial_elimination_offset (int from, int to)
 
 /* Implements PUSH_ROUNDING.  The R8C and M16C have byte stacks, the
    M32C has word stacks.  */
-unsigned int
-m32c_push_rounding (int n)
+poly_int64
+m32c_push_rounding (poly_int64 n)
 {
   if (TARGET_R8C || TARGET_M16C)
     return n;
index cdd6798c6608d42b7e6bf15ad20dd0ea9ab52eab..3c285a98fe28284bba8033393a36c00ae6a16079 100644 (file)
@@ -99,3 +99,4 @@ extern void init_68881_table (void);
 extern rtx m68k_legitimize_call_address (rtx);
 extern rtx m68k_legitimize_sibcall_address (rtx);
 extern int m68k_hard_regno_rename_ok(unsigned int, unsigned int);
+extern poly_int64 m68k_push_rounding (poly_int64);
index 10c78153e642a00ffc5391f696d1796178b8e913..1c6484e8fec2981de2b5cc65b58500e1fb3042d4 100644 (file)
@@ -6610,4 +6610,15 @@ m68k_excess_precision (enum excess_precision_type type)
   return FLT_EVAL_METHOD_UNPREDICTABLE;
 }
 
+/* Implement PUSH_ROUNDING.  On the 680x0, sp@- in a byte insn really pushes
+   a word.  On the ColdFire, sp@- in a byte insn pushes just a byte.  */
+
+poly_int64
+m68k_push_rounding (poly_int64 bytes)
+{
+  if (TARGET_COLDFIRE)
+    return bytes;
+  return (bytes + 1) & ~1;
+}
+
 #include "gt-m68k.h"
index 97693cbf54984a53aa6c35061ca723dae6d1a7b3..8eb898e6eba91f84119fe42732b08ac7ab8590e4 100644 (file)
@@ -468,9 +468,7 @@ extern enum reg_class regno_reg_class[];
 #define STACK_GROWS_DOWNWARD 1
 #define FRAME_GROWS_DOWNWARD 1
 
-/* On the 680x0, sp@- in a byte insn really pushes a word.
-   On the ColdFire, sp@- in a byte insn pushes just a byte.  */
-#define PUSH_ROUNDING(BYTES) (TARGET_COLDFIRE ? BYTES : ((BYTES) + 1) & ~1)
+#define PUSH_ROUNDING(BYTES) m68k_push_rounding (BYTES)
 
 #define FIRST_PARM_OFFSET(FNDECL) 8
 
index f6c7d1a7f1b651d864786a6b2d8f66093b3d4e47..467b0d87a0a0f07a25e3956280dddaf33056579c 100644 (file)
@@ -44,3 +44,4 @@ extern void pdp11_asm_output_var (FILE *, const char *, int, int, bool);
 extern void pdp11_expand_prologue (void);
 extern void pdp11_expand_epilogue (void);
 extern int pdp11_branch_cost (void);
+extern poly_int64 pdp11_push_rounding (poly_int64);
index 06fef13f5d6785e3826652c2560e23b1e4c590d5..1367a072b1be2851dbc08005d79589818dc2c47f 100644 (file)
@@ -1977,4 +1977,13 @@ pdp11_modes_tieable_p (machine_mode, machine_mode)
   return false;
 }
 
+/* Implement PUSH_ROUNDING.  On the pdp11, the stack is on an even
+   boundary.  */
+
+poly_int64
+pdp11_push_rounding (poly_int64 bytes)
+{
+  return (bytes + 1) & ~1;
+}
+
 struct gcc_target targetm = TARGET_INITIALIZER;
index 115bb5b83a020cbfad42a449989d85ea7aaef680..5ccec18e91ac60a73ceb07bbaa53ab5114c8eb94 100644 (file)
@@ -257,10 +257,7 @@ enum reg_class { NO_REGS, MUL_REGS, GENERAL_REGS, LOAD_FPU_REGS, NO_LOAD_FPU_REG
 */
 #define FRAME_GROWS_DOWNWARD 1
 
-/* If we generate an insn to push BYTES bytes,
-   this says how many the stack pointer really advances by.
-   On the pdp11, the stack is on an even boundary */
-#define PUSH_ROUNDING(BYTES) ((BYTES + 1) & ~1)
+#define PUSH_ROUNDING(BYTES) pdp11_push_rounding (BYTES)
 
 /* current_first_parm_offset stores the # of registers pushed on the 
    stack */
index 38be8d2adfd0e8da7b9f5f200edb08c1f8bc88a3..c4ce1145c21b0098cc2a74d5311f57dea695d8ab 100644 (file)
@@ -28,6 +28,7 @@ extern int direct_return (void);
 extern int xstormy16_interrupt_function_p (void);
 extern int xstormy16_epilogue_uses (int);
 extern void xstormy16_function_profiler (void);
+extern poly_int64 xstormy16_push_rounding (poly_int64);
 
 #if defined (TREE_CODE)
 extern void xstormy16_asm_output_aligned_common (FILE *, tree, const char *,
index a3557940d9ef6823ab456243d0e2bd7557eca7d9..002eeee8f8ceb0d94aeb014326c56e32dea0c9ef 100644 (file)
@@ -2635,6 +2635,14 @@ xstormy16_modes_tieable_p (machine_mode mode1, machine_mode mode2)
 {
   return mode1 != BImode && mode2 != BImode;
 }
+
+/* Implement PUSH_ROUNDING.  */
+
+poly_int64
+xstormy16_push_rounding (poly_int64 bytes)
+{
+  return (bytes + 1) & ~1;
+}
 \f
 #undef  TARGET_ASM_ALIGNED_HI_OP
 #define TARGET_ASM_ALIGNED_HI_OP "\t.hword\t"
index 1d7045759c526ca8ee57a0b050769e73faa227db..dfc659c2e983fc68cd245bd24ab6f04e6bd1c9f7 100644 (file)
@@ -255,7 +255,7 @@ enum reg_class
 \f
 /* Passing Function Arguments on the Stack.  */
 
-#define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & ~1)
+#define PUSH_ROUNDING(BYTES) xstormy16_push_rounding (BYTES)
 
 \f
 /* Function Arguments in Registers.  */
index 336673f059aaddf372422de001c98b944b2a6d3a..580ec4868c04da262534301f55e55f5f83d757fa 100644 (file)
@@ -3347,10 +3347,9 @@ rtx
 emit_move_resolve_push (machine_mode mode, rtx x)
 {
   enum rtx_code code = GET_CODE (XEXP (x, 0));
-  HOST_WIDE_INT adjust;
   rtx temp;
 
-  adjust = GET_MODE_SIZE (mode);
+  poly_int64 adjust = GET_MODE_SIZE (mode);
 #ifdef PUSH_ROUNDING
   adjust = PUSH_ROUNDING (adjust);
 #endif
@@ -3359,14 +3358,12 @@ emit_move_resolve_push (machine_mode mode, rtx x)
   else if (code == PRE_MODIFY || code == POST_MODIFY)
     {
       rtx expr = XEXP (XEXP (x, 0), 1);
-      HOST_WIDE_INT val;
 
       gcc_assert (GET_CODE (expr) == PLUS || GET_CODE (expr) == MINUS);
-      gcc_assert (CONST_INT_P (XEXP (expr, 1)));
-      val = INTVAL (XEXP (expr, 1));
+      poly_int64 val = rtx_to_poly_int64 (XEXP (expr, 1));
       if (GET_CODE (expr) == MINUS)
        val = -val;
-      gcc_assert (adjust == val || adjust == -val);
+      gcc_assert (known_eq (adjust, val) || known_eq (adjust, -val));
       adjust = val;
     }
 
@@ -3408,11 +3405,11 @@ emit_move_complex_push (machine_mode mode, rtx x, rtx y)
   bool imag_first;
 
 #ifdef PUSH_ROUNDING
-  unsigned int submodesize = GET_MODE_SIZE (submode);
+  poly_int64 submodesize = GET_MODE_SIZE (submode);
 
   /* In case we output to the stack, but the size is smaller than the
      machine can push exactly, we need to use move instructions.  */
-  if (PUSH_ROUNDING (submodesize) != submodesize)
+  if (maybe_ne (PUSH_ROUNDING (submodesize), submodesize))
     {
       x = emit_move_resolve_push (mode, x);
       return emit_move_insn (x, y);
@@ -4132,7 +4129,7 @@ static void
 emit_single_push_insn_1 (machine_mode mode, rtx x, tree type)
 {
   rtx dest_addr;
-  unsigned rounded_size = PUSH_ROUNDING (GET_MODE_SIZE (mode));
+  poly_int64 rounded_size = PUSH_ROUNDING (GET_MODE_SIZE (mode));
   rtx dest;
   enum insn_code icode;
 
@@ -4147,7 +4144,7 @@ emit_single_push_insn_1 (machine_mode mode, rtx x, tree type)
       if (maybe_expand_insn (icode, 1, ops))
        return;
     }
-  if (GET_MODE_SIZE (mode) == rounded_size)
+  if (known_eq (GET_MODE_SIZE (mode), rounded_size))
     dest_addr = gen_rtx_fmt_e (STACK_PUSH_CODE, Pmode, stack_pointer_rtx);
   /* If we are to pad downward, adjust the stack pointer first and
      then store X into the stack location using an offset.  This is
@@ -4375,9 +4372,9 @@ emit_push_insn (rtx x, machine_mode mode, tree type, rtx size,
             and such small pushes do rounding that causes trouble.  */
          && ((!targetm.slow_unaligned_access (word_mode, align))
              || align >= BIGGEST_ALIGNMENT
-             || (PUSH_ROUNDING (align / BITS_PER_UNIT)
-                 == (align / BITS_PER_UNIT)))
-         && (HOST_WIDE_INT) PUSH_ROUNDING (INTVAL (size)) == INTVAL (size))
+             || known_eq (PUSH_ROUNDING (align / BITS_PER_UNIT),
+                          align / BITS_PER_UNIT))
+         && known_eq (PUSH_ROUNDING (INTVAL (size)), INTVAL (size)))
        {
          /* Push padding now if padding above and stack grows down,
             or if padding below and stack grows up.
index 4f130a68e79854aefd18b04a3c94d20b894e9466..a4437809431eb38f906f9b04458ffc0511c33bc6 100644 (file)
@@ -748,7 +748,7 @@ mark_not_eliminable (rtx x, machine_mode mem_mode)
                  && XEXP (x, 0) == XEXP (XEXP (x, 1), 0)
                  && poly_int_rtx_p (XEXP (XEXP (x, 1), 1), &offset))))
        {
-         int size = GET_MODE_SIZE (mem_mode);
+         poly_int64 size = GET_MODE_SIZE (mem_mode);
          
 #ifdef PUSH_ROUNDING
          /* If more bytes than MEM_MODE are pushed, account for
index 99031df553d18fbeb2b21dc4fe8cea13c65d96fc..43e8781099f5b6b739e6299c8cceb20cc888a2a1 100644 (file)
@@ -1258,33 +1258,35 @@ nonmemory_operand (rtx op, machine_mode mode)
 int
 push_operand (rtx op, machine_mode mode)
 {
-  unsigned int rounded_size = GET_MODE_SIZE (mode);
-
-#ifdef PUSH_ROUNDING
-  rounded_size = PUSH_ROUNDING (rounded_size);
-#endif
-
   if (!MEM_P (op))
     return 0;
 
   if (mode != VOIDmode && GET_MODE (op) != mode)
     return 0;
 
+  poly_int64 rounded_size = GET_MODE_SIZE (mode);
+
+#ifdef PUSH_ROUNDING
+  rounded_size = PUSH_ROUNDING (MACRO_INT (rounded_size));
+#endif
+
   op = XEXP (op, 0);
 
-  if (rounded_size == GET_MODE_SIZE (mode))
+  if (known_eq (rounded_size, GET_MODE_SIZE (mode)))
     {
       if (GET_CODE (op) != STACK_PUSH_CODE)
        return 0;
     }
   else
     {
+      poly_int64 offset;
       if (GET_CODE (op) != PRE_MODIFY
          || GET_CODE (XEXP (op, 1)) != PLUS
          || XEXP (XEXP (op, 1), 0) != XEXP (op, 0)
-         || !CONST_INT_P (XEXP (XEXP (op, 1), 1))
-         || INTVAL (XEXP (XEXP (op, 1), 1))
-            != ((STACK_GROWS_DOWNWARD ? -1 : 1) * (int) rounded_size))
+         || !poly_int_rtx_p (XEXP (XEXP (op, 1), 1), &offset)
+         || (STACK_GROWS_DOWNWARD
+             ? maybe_ne (offset, -rounded_size)
+             : maybe_ne (offset, rounded_size)))
        return 0;
     }
 
index 2483ed9af8b500859da0af9a9892214dee8b351e..a1dcf421878a7690ad7483de9c1dc2afa51def11 100644 (file)
@@ -2996,7 +2996,7 @@ elimination_effects (rtx x, machine_mode mem_mode)
       for (ep = reg_eliminate; ep < &reg_eliminate[NUM_ELIMINABLE_REGS]; ep++)
        if (ep->to_rtx == XEXP (x, 0))
          {
-           int size = GET_MODE_SIZE (mem_mode);
+           poly_int64 size = GET_MODE_SIZE (mem_mode);
 
            /* If more bytes than MEM_MODE are pushed, account for them.  */
 #ifdef PUSH_ROUNDING
index 89c8816fbb913b91acacd92a1ca1ec4d263daa6a..62350972e2b570b362f7e94cbb6c0ab56f3debda 100644 (file)
@@ -4518,8 +4518,10 @@ nonzero_bits1 (const_rtx x, scalar_int_mode mode, const_rtx known_x,
             stack to be momentarily aligned only to that amount,
             so we pick the least alignment.  */
          if (x == stack_pointer_rtx && PUSH_ARGS)
-           alignment = MIN ((unsigned HOST_WIDE_INT) PUSH_ROUNDING (1),
-                            alignment);
+           {
+             poly_uint64 rounded_1 = PUSH_ROUNDING (poly_int64 (1));
+             alignment = MIN (known_alignment (rounded_1), alignment);
+           }
 #endif
 
          nonzero &= ~(alignment - 1);