diff options
author | chrbr <chrbr@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-05-13 08:50:51 +0000 |
---|---|---|
committer | chrbr <chrbr@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-05-13 08:50:51 +0000 |
commit | cea19dab49b9f646d476010ee9a4ba5e24a3d104 (patch) | |
tree | 2492f596015f55629c1fed3420c824e3fc566559 /gcc/config/sh | |
parent | c256ccd8f3dde8f3d0e6ffa642b2041361af8655 (diff) | |
download | gcc-cea19dab49b9f646d476010ee9a4ba5e24a3d104.tar.gz |
2014-05-13 Christian Bruel <christian.bruel@st.com>
* target.def (mode_switching): New hook vector.
(mode_emit, mode_needed, mode_after, mode_entry): New hooks.
(mode_exit, modepriority_to_mode): Likewise.
* mode-switching.c (MODE_NEEDED, MODE_AFTER, MODE_ENTRY): Hookify.
(MODE_EXIT, MODE_PRIORITY_TO_MODE, EMIT_MODE_SET): Likewise.
(default_priority_to_mode): Define.
* targhooks.h (default_priority_to_mode): Declare.
* target.h: Include tm.h and hard-reg-set.h.
* doc/tm.texi.in (EMIT_MODE_SET, MODE_NEEDED, MODE_AFTER, MODE_ENTRY)
(MODE_EXIT, MODE_PRIORITY_TO_MODE): Delete and hookify.
* doc/tm.texi Regenerate.
* config/sh/sh.h (MODE_NEEDED, MODE_AFTER, MODE_ENTRY): Delete
(MODE_EXIT, MODE_PRIORITY_TO_MODE, EMIT_MODE_SET): Likewise.
* config/sh/sh.c (sh_emit_mode_set, sh_mode_priority): Hookify.
(sh_mode_needed, sh_mode_after, sh_mode_entry, sh_mode_exit): Likewise.
* config/i386/i386.h (MODE_NEEDED, MODE_AFTER, MODE_ENTRY): Delete
(MODE_EXIT, MODE_PRIORITY_TO_MODE, EMIT_MODE_SET): Likewise.
* config/i386/i386-protos.h (ix86_mode_needed, ix86_mode_after)
(ix86_mode_entrym, ix86_emit_mode_set): Remove external declaration.
* config/i386/i386.c (ix86_mode_needed, ix86_mode_after, ix86_mode_exit,
(ix86_mode_entry, ix86_mode_priority, ix86_emit_mode_set): Hookify.
* config/epiphany/epiphany.h (MODE_NEEDED, MODE_AFTER, MODE_ENTRY):
Delete
(MODE_EXIT, MODE_PRIORITY_TO_MODE, EMIT_MODE_SET): Likewise.
* config/sh/sh.h (MODE_NEEDED, MODE_AFTER, MODE_ENTRY): Delete
(MODE_EXIT, MODE_PRIORITY_TO_MODE, EMIT_MODE_SET): Likewise.
* config/sh/sh.c (sh4_emit_mode_set, sh4_mode_needed): Hookify.
(sh4_mode_after, sh4_mode_entry, sh4_mode_exit): Likewise.
* config/epiphany/epiphany-protos.h (epiphany_mode_needed)
(emit_set_fp_mode, epiphany_mode_entry_exit, epiphany_mode_after)
(epiphany_mode_priority_to_mode): Remove declaration.
* config/epiphany/epiphany.c (emit_set_fp_mode): Hookify.
(epiphany_mode_needed, epiphany_mode_priority_to_mode): Likewise.
(epiphany_mode_entry, epiphany_mode_exit, epiphany_mode_after):
Likewise.
(epiphany_mode_priority_to_mode): Change priority type. Hookify.
(epiphany_mode_needed, epiphany_mode_entry_exit): Hookify.
(epiphany_mode_after, epiphany_mode_entry, emit_set_fp_mode): Hookify.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@210354 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/sh')
-rw-r--r-- | gcc/config/sh/sh.c | 66 | ||||
-rw-r--r-- | gcc/config/sh/sh.h | 23 |
2 files changed, 66 insertions, 23 deletions
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index 26a5d79f137..31ea83d1c31 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -202,6 +202,13 @@ static void push_regs (HARD_REG_SET *, int); static int calc_live_regs (HARD_REG_SET *); static HOST_WIDE_INT rounded_frame_size (int); static bool sh_frame_pointer_required (void); +static void sh_emit_mode_set (int, int, HARD_REG_SET); +static int sh_mode_needed (int, rtx); +static int sh_mode_after (int, int, rtx); +static int sh_mode_entry (int); +static int sh_mode_exit (int); +static int sh_mode_priority (int entity, int n); + static rtx mark_constant_pool_use (rtx); static tree sh_handle_interrupt_handler_attribute (tree *, tree, tree, int, bool *); @@ -564,6 +571,24 @@ static const struct attribute_spec sh_attribute_table[] = #undef TARGET_FRAME_POINTER_REQUIRED #define TARGET_FRAME_POINTER_REQUIRED sh_frame_pointer_required +#undef TARGET_MODE_EMIT +#define TARGET_MODE_EMIT sh_emit_mode_set + +#undef TARGET_MODE_NEEDED +#define TARGET_MODE_NEEDED sh_mode_needed + +#undef TARGET_MODE_AFTER +#define TARGET_MODE_AFTER sh_mode_after + +#undef TARGET_MODE_ENTRY +#define TARGET_MODE_ENTRY sh_mode_entry + +#undef TARGET_MODE_EXIT +#define TARGET_MODE_EXIT sh_mode_exit + +#undef TARGET_MODE_PRIORITY +#define TARGET_MODE_PRIORITY sh_mode_priority + /* Return regmode weight for insn. */ #define INSN_REGMODE_WEIGHT(INSN, MODE)\ regmode_weight[((MODE) == SImode) ? 0 : 1][INSN_UID (INSN)] @@ -13549,4 +13574,45 @@ sh_try_omit_signzero_extend (rtx extended_op, rtx insn) return NULL_RTX; } +static void +sh_emit_mode_set (int entity ATTRIBUTE_UNUSED, int mode, + HARD_REG_SET regs_live) +{ + fpscr_set_from_mem (mode, regs_live); +} + +static int +sh_mode_needed (int entity ATTRIBUTE_UNUSED, rtx insn) +{ + return recog_memoized (insn) >= 0 ? get_attr_fp_mode (insn) : FP_MODE_NONE; +} + +static int +sh_mode_after (int entity ATTRIBUTE_UNUSED, int mode, rtx insn) +{ + if (TARGET_HITACHI && recog_memoized (insn) >= 0 && + get_attr_fp_set (insn) != FP_SET_NONE) + return (int) get_attr_fp_set (insn); + else + return mode; +} + +static int +sh_mode_entry (int entity ATTRIBUTE_UNUSED) +{ + return NORMAL_MODE (entity); +} + +static int +sh_mode_exit (int entity ATTRIBUTE_UNUSED) +{ + return sh_cfun_attr_renesas_p () ? FP_MODE_NONE : NORMAL_MODE (entity); +} + +static int +sh_mode_priority (int entity ATTRIBUTE_UNUSED, int n) +{ + return ((TARGET_FPU_SINGLE != 0) ^ (n) ? FP_MODE_SINGLE : FP_MODE_DOUBLE); +} + #include "gt-sh.h" diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h index 00ee0edffda..e42b8d31b68 100644 --- a/gcc/config/sh/sh.h +++ b/gcc/config/sh/sh.h @@ -2218,32 +2218,9 @@ extern int current_function_interrupt; ? (TARGET_FMOVD ? FP_MODE_DOUBLE : FP_MODE_NONE) \ : ACTUAL_NORMAL_MODE (ENTITY)) -#define MODE_ENTRY(ENTITY) NORMAL_MODE (ENTITY) - -#define MODE_EXIT(ENTITY) \ - (sh_cfun_attr_renesas_p () ? FP_MODE_NONE : NORMAL_MODE (ENTITY)) - #define EPILOGUE_USES(REGNO) ((TARGET_SH2E || TARGET_SH4) \ && (REGNO) == FPSCR_REG) -#define MODE_NEEDED(ENTITY, INSN) \ - (recog_memoized (INSN) >= 0 \ - ? get_attr_fp_mode (INSN) \ - : FP_MODE_NONE) - -#define MODE_AFTER(ENTITY, MODE, INSN) \ - (TARGET_HITACHI \ - && recog_memoized (INSN) >= 0 \ - && get_attr_fp_set (INSN) != FP_SET_NONE \ - ? (int) get_attr_fp_set (INSN) \ - : (MODE)) - -#define MODE_PRIORITY_TO_MODE(ENTITY, N) \ - ((TARGET_FPU_SINGLE != 0) ^ (N) ? FP_MODE_SINGLE : FP_MODE_DOUBLE) - -#define EMIT_MODE_SET(ENTITY, MODE, HARD_REGS_LIVE) \ - fpscr_set_from_mem ((MODE), (HARD_REGS_LIVE)) - #define MD_CAN_REDIRECT_BRANCH(INSN, SEQ) \ sh_can_redirect_branch ((INSN), (SEQ)) |