diff options
author | Richard Henderson <rth@redhat.com> | 2015-05-11 16:33:23 -0700 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2015-05-11 16:33:23 -0700 |
commit | 7ca35180e923e40e8de6df1953c9177d22eae665 (patch) | |
tree | caa8a966e2b428095382916220510834997b1c60 /gcc/config/cris/cris.c | |
parent | 15a85b055d38e8f0000da08d80e143a89ecb827e (diff) | |
download | gcc-7ca35180e923e40e8de6df1953c9177d22eae665.zip gcc-7ca35180e923e40e8de6df1953c9177d22eae665.tar.gz gcc-7ca35180e923e40e8de6df1953c9177d22eae665.tar.bz2 |
Convert to md_asm_adjust
Using proper vectors instead of lists of trees.
From-SVN: r223025
Diffstat (limited to 'gcc/config/cris/cris.c')
-rw-r--r-- | gcc/config/cris/cris.c | 88 |
1 files changed, 38 insertions, 50 deletions
diff --git a/gcc/config/cris/cris.c b/gcc/config/cris/cris.c index a9451b5..fc79e3e 100644 --- a/gcc/config/cris/cris.c +++ b/gcc/config/cris/cris.c @@ -179,7 +179,9 @@ static rtx cris_function_incoming_arg (cumulative_args_t, machine_mode, const_tree, bool); static void cris_function_arg_advance (cumulative_args_t, machine_mode, const_tree, bool); -static tree cris_md_asm_clobbers (tree, tree, tree); +static rtx_insn *cris_md_asm_adjust (vec<rtx> &, vec<rtx> &, + vec<const char *> &, + vec<rtx> &, HARD_REG_SET &); static bool cris_cannot_force_const_mem (machine_mode, rtx); static void cris_option_override (void); @@ -283,8 +285,8 @@ int cris_cpu_version = CRIS_DEFAULT_CPU_VERSION; #define TARGET_FUNCTION_INCOMING_ARG cris_function_incoming_arg #undef TARGET_FUNCTION_ARG_ADVANCE #define TARGET_FUNCTION_ARG_ADVANCE cris_function_arg_advance -#undef TARGET_MD_ASM_CLOBBERS -#define TARGET_MD_ASM_CLOBBERS cris_md_asm_clobbers +#undef TARGET_MD_ASM_ADJUST +#define TARGET_MD_ASM_ADJUST cris_md_asm_adjust #undef TARGET_CANNOT_FORCE_CONST_MEM #define TARGET_CANNOT_FORCE_CONST_MEM cris_cannot_force_const_mem @@ -4189,55 +4191,41 @@ cris_function_arg_advance (cumulative_args_t ca_v, machine_mode mode, ca->regs += (3 + CRIS_FUNCTION_ARG_SIZE (mode, type)) / 4; } -/* Worker function for TARGET_MD_ASM_CLOBBERS. */ +/* Worker function for TARGET_MD_ASM_ADJUST. */ -static tree -cris_md_asm_clobbers (tree outputs, tree inputs, tree in_clobbers) +static rtx_insn * +cris_md_asm_adjust (vec<rtx> &outputs, vec<rtx> &inputs, + vec<const char *> &constraints, + vec<rtx> &clobbers, HARD_REG_SET &clobbered_regs) { - HARD_REG_SET mof_set; - tree clobbers; - tree t; - - CLEAR_HARD_REG_SET (mof_set); - SET_HARD_REG_BIT (mof_set, CRIS_MOF_REGNUM); - - /* For the time being, all asms clobber condition codes. Revisit when - there's a reasonable use for inputs/outputs that mention condition - codes. */ - clobbers - = tree_cons (NULL_TREE, - build_string (strlen (reg_names[CRIS_CC0_REGNUM]), - reg_names[CRIS_CC0_REGNUM]), - in_clobbers); - - for (t = outputs; t != NULL; t = TREE_CHAIN (t)) - { - tree val = TREE_VALUE (t); - - /* The constraint letter for the singleton register class of MOF - is 'h'. If it's mentioned in the constraints, the asm is - MOF-aware and adding it to the clobbers would cause it to have - impossible constraints. */ - if (strchr (TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (t))), - 'h') != NULL - || tree_overlaps_hard_reg_set (val, &mof_set) != NULL_TREE) - return clobbers; - } - - for (t = inputs; t != NULL; t = TREE_CHAIN (t)) - { - tree val = TREE_VALUE (t); - - if (strchr (TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (t))), - 'h') != NULL - || tree_overlaps_hard_reg_set (val, &mof_set) != NULL_TREE) - return clobbers; - } - - return tree_cons (NULL_TREE, - build_string (strlen (reg_names[CRIS_MOF_REGNUM]), - reg_names[CRIS_MOF_REGNUM]), - clobbers); + /* For the time being, all asms clobber condition codes. + Revisit when there's a reasonable use for inputs/outputs + that mention condition codes. */ + clobbers.safe_push (gen_rtx_REG (CCmode, CRIS_CC0_REGNUM)); + SET_HARD_REG_BIT (clobbered_regs, CRIS_CC0_REGNUM); + + /* Determine if the source using MOF. If it is, automatically + clobbering MOF would cause it to have impossible constraints. */ + + /* Look for a use of the MOF constraint letter: h. */ + for (unsigned i = 0, n = constraints.length(); i < n; ++i) + if (strchr (constraints[i], 'h') != NULL) + return NULL; + + /* Look for an output or an input that touches MOF. */ + rtx mof_reg = gen_rtx_REG (SImode, CRIS_MOF_REGNUM); + for (unsigned i = 0, n = outputs.length(); i < n; ++i) + if (reg_overlap_mentioned_p (mof_reg, outputs[i])) + return NULL; + for (unsigned i = 0, n = inputs.length(); i < n; ++i) + if (reg_overlap_mentioned_p (mof_reg, inputs[i])) + return NULL; + + /* No direct reference to MOF or its constraint. + Clobber it for backward compatibility. */ + clobbers.safe_push (mof_reg); + SET_HARD_REG_BIT (clobbered_regs, CRIS_MOF_REGNUM); + return NULL; } /* Implement TARGET_FRAME_POINTER_REQUIRED. |