+2015-06-26 Richard Sandiford <richard.sandiford@arm.com>
+
+ * rtl.h (emit): Add an optional boolean parameter to control
+ whether barriers are emitted.
+ * emit-rtl.c (emit): Likewise.
+ * gensupport.c (get_emit_function): Return null rather than "emit".
+ * genemit.c (gen_emit_seq): Handle the null return value.
+ Don't emit barriers after the final instruction in the sequence.
+ * gentarget-def.c (main): Don't emit barriers after the instruction.
+
2015-06-26 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
* config/arm/arm.c (arm_output_multireg_pop): Fix use of
return NULL_RTX;
}
\f
-/* Emit the rtl pattern X as an appropriate kind of insn.
+/* Emit the rtl pattern X as an appropriate kind of insn. Also emit a
+ following barrier if the instruction needs one and if ALLOW_BARRIER_P
+ is true.
+
If X is a label, it is simply added into the insn chain. */
rtx_insn *
-emit (rtx x)
+emit (rtx x, bool allow_barrier_p)
{
enum rtx_code code = classify_insn (x);
case JUMP_INSN:
{
rtx_insn *insn = emit_jump_insn (x);
- if (any_uncondjump_p (insn) || GET_CODE (x) == RETURN)
+ if (allow_barrier_p
+ && (any_uncondjump_p (insn) || GET_CODE (x) == RETURN))
return emit_barrier ();
return insn;
}
{
for (int i = 0, len = GET_NUM_ELEM (vec); i < len; ++i)
{
+ bool last_p = (i == len - 1);
rtx next = RTVEC_ELT (vec, i);
- printf (" %s (", get_emit_function (next));
- gen_exp (next, DEFINE_EXPAND, used);
- printf (");\n");
- if (needs_barrier_p (next))
- printf (" emit_barrier ();");
+ if (const char *name = get_emit_function (next))
+ {
+ printf (" %s (", name);
+ gen_exp (next, DEFINE_EXPAND, used);
+ printf (");\n");
+ if (!last_p && needs_barrier_p (next))
+ printf (" emit_barrier ();");
+ }
+ else
+ {
+ printf (" emit (");
+ gen_exp (next, DEFINE_EXPAND, used);
+ printf (", %s);\n", last_p ? "false" : "true");
+ }
}
}
\f
stats->max_scratch_opno)) + 1;
}
-/* Return the emit_* function that should be used for pattern X. */
+/* Return the emit_* function that should be used for pattern X, or NULL
+ if we can't pick a particular type at compile time and should instead
+ fall back to "emit". */
const char *
get_emit_function (rtx x)
return "emit_jump_insn";
case UNKNOWN:
- return "emit";
+ return NULL;
default:
gcc_unreachable ();
printf (" if (rtx_insn *insn = dyn_cast <rtx_insn *> (x))\n");
printf (" return insn;\n");
printf (" start_sequence ();\n");
- printf (" emit (x);\n");
+ printf (" emit (x, false);\n");
printf (" rtx_insn *res = get_insns ();\n");
printf (" end_sequence ();\n");
printf (" return res;\n");
extern void add_insn_before (rtx, rtx, basic_block);
extern void add_insn_after (rtx, rtx, basic_block);
extern void remove_insn (rtx);
-extern rtx_insn *emit (rtx);
+extern rtx_insn *emit (rtx, bool = true);
extern void emit_insn_at_entry (rtx);
extern rtx gen_lowpart_SUBREG (machine_mode, rtx);
extern rtx gen_const_mem (machine_mode, rtx);