rtl.h (emit): Add an optional boolean parameter to control whether barriers are emitted.

gcc/
	* 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.

From-SVN: r225000
This commit is contained in:
Richard Sandiford 2015-06-26 10:06:56 +00:00 committed by Richard Sandiford
parent 311bd4d897
commit 9d8895c934
6 changed files with 38 additions and 12 deletions

View File

@ -1,3 +1,13 @@
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

View File

@ -5303,11 +5303,14 @@ set_dst_reg_note (rtx insn, enum reg_note kind, rtx datum, rtx dst)
return NULL_RTX;
}
/* 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);
@ -5320,7 +5323,8 @@ emit (rtx 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;
}

View File

@ -277,12 +277,22 @@ gen_emit_seq (rtvec vec, char *used)
{
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");
}
}
}

View File

@ -2983,7 +2983,9 @@ get_pattern_stats (struct pattern_stats *stats, rtvec pattern)
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)
@ -3000,7 +3002,7 @@ get_emit_function (rtx x)
return "emit_jump_insn";
case UNKNOWN:
return "emit";
return NULL;
default:
gcc_unreachable ();

View File

@ -245,7 +245,7 @@ main (int argc, char **argv)
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");

View File

@ -3494,7 +3494,7 @@ extern void add_insn (rtx_insn *);
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);