diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2015-06-26 10:06:56 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2015-06-26 10:06:56 +0000 |
commit | 9d8895c9342d2c46d7d7e9b0437879db9d60cf7c (patch) | |
tree | 8a2e3d3e02ca429c89dc152311efede46fcf29ac | |
parent | 311bd4d8973d4ad8727e3dcf842fbc4bcfd12d7b (diff) | |
download | gcc-9d8895c9342d2c46d7d7e9b0437879db9d60cf7c.zip gcc-9d8895c9342d2c46d7d7e9b0437879db9d60cf7c.tar.gz gcc-9d8895c9342d2c46d7d7e9b0437879db9d60cf7c.tar.bz2 |
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
-rw-r--r-- | gcc/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/emit-rtl.c | 10 | ||||
-rw-r--r-- | gcc/genemit.c | 20 | ||||
-rw-r--r-- | gcc/gensupport.c | 6 | ||||
-rw-r--r-- | gcc/gentarget-def.c | 2 | ||||
-rw-r--r-- | gcc/rtl.h | 2 |
6 files changed, 38 insertions, 12 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ecc209f..bd9abfc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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 diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index e7f7eab..80c0adb 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -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; } diff --git a/gcc/genemit.c b/gcc/genemit.c index 15ec081..4ee07a0 100644 --- a/gcc/genemit.c +++ b/gcc/genemit.c @@ -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"); + } } } diff --git a/gcc/gensupport.c b/gcc/gensupport.c index 916fbc1..729366c 100644 --- a/gcc/gensupport.c +++ b/gcc/gensupport.c @@ -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 (); diff --git a/gcc/gentarget-def.c b/gcc/gentarget-def.c index bca9480..c1125dd 100644 --- a/gcc/gentarget-def.c +++ b/gcc/gentarget-def.c @@ -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"); @@ -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); |