summaryrefslogtreecommitdiff
path: root/gcc/config/m68k
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@linaro.org>2018-01-03 07:18:13 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2018-01-03 07:18:13 +0000
commit7b4df2bf95d2254756f6509ee57a90c398baf81b (patch)
treec05cbaa50ad24f72ed0785372d754691a8e79a2b /gcc/config/m68k
parenta930fe51508f431a97eaeb0f546d4b26b40dbfa1 (diff)
poly_int: PUSH_ROUNDING
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
Diffstat (limited to 'gcc/config/m68k')
-rw-r--r--gcc/config/m68k/m68k-protos.h1
-rw-r--r--gcc/config/m68k/m68k.c11
-rw-r--r--gcc/config/m68k/m68k.h4
3 files changed, 13 insertions, 3 deletions
diff --git a/gcc/config/m68k/m68k-protos.h b/gcc/config/m68k/m68k-protos.h
index cdd6798c660..3c285a98fe2 100644
--- a/gcc/config/m68k/m68k-protos.h
+++ b/gcc/config/m68k/m68k-protos.h
@@ -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);
diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c
index 10c78153e64..1c6484e8fec 100644
--- a/gcc/config/m68k/m68k.c
+++ b/gcc/config/m68k/m68k.c
@@ -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"
diff --git a/gcc/config/m68k/m68k.h b/gcc/config/m68k/m68k.h
index 97693cbf549..8eb898e6eba 100644
--- a/gcc/config/m68k/m68k.h
+++ b/gcc/config/m68k/m68k.h
@@ -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