aboutsummaryrefslogtreecommitdiff
path: root/tcg/tcg-op.c
diff options
context:
space:
mode:
authorPranith Kumar <bobby.prani@gmail.com>2016-07-14 16:20:13 -0400
committerRichard Henderson <rth@twiddle.net>2016-09-16 08:12:11 -0700
commitf65e19bc2c9e8358e634d309606144ac2a3c2936 (patch)
tree261b19dd382c67ff35f21ff53d64c58f03126764 /tcg/tcg-op.c
parentbe2208e2a50f4b50980d92c26f2e12cb2bda4afc (diff)
Introduce TCGOpcode for memory barrier
This commit introduces the TCGOpcode for memory barrier instruction. This opcode takes an argument which is the type of memory barrier which should be generated. Signed-off-by: Pranith Kumar <bobby.prani@gmail.com> Message-Id: <20160714202026.9727-2-bobby.prani@gmail.com> Signed-off-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'tcg/tcg-op.c')
-rw-r--r--tcg/tcg-op.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c
index 0243c99094..291d50bb7d 100644
--- a/tcg/tcg-op.c
+++ b/tcg/tcg-op.c
@@ -148,6 +148,23 @@ void tcg_gen_op6(TCGContext *ctx, TCGOpcode opc, TCGArg a1, TCGArg a2,
tcg_emit_op(ctx, opc, pi);
}
+void tcg_gen_mb(TCGBar mb_type)
+{
+ bool emit_barriers = true;
+
+#ifndef CONFIG_USER_ONLY
+ /* TODO: When MTTCG is available for system mode, we will check
+ * the following condition and enable emit_barriers
+ * (qemu_tcg_mttcg_enabled() && smp_cpus > 1)
+ */
+ emit_barriers = false;
+#endif
+
+ if (emit_barriers) {
+ tcg_gen_op1(&tcg_ctx, INDEX_op_mb, mb_type);
+ }
+}
+
/* 32 bit ops */
void tcg_gen_addi_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2)