Queued TCG patches

-----BEGIN PGP SIGNATURE-----
 
 iQEcBAABAgAGBQJa8xfNAAoJEGTfOOivfiFf1FoIAI5Fs+aIvIc6hOAw4e6HnVX9
 qq4DCQq35V/EafXsvq6g3rdflVseX1L1YekHm1mzJK5+DriaSs2v26p37grQ4+r2
 jLVIji8rac5kDopdXY27bEfGZtMYFyZQ15/u+mjUIJJ+JhaaUxZE4fFeBi9GGqYw
 VPSxQgMPATQvHw7NCgB82Xdxl7Ze+Oh+wdPkbRVIb4SfhwME+HbwJsWeTvi0oYyf
 slnftOOhJVI57AnF09GGDZje9fGEb0+j10Wcp+iGkXB2PKoeGSDO0NRtJ4hE2kNB
 MJCIxauVTICXYG9ouDbGGf6+Nv2ZC7IdHw1h3ZGoPjHh8gat4JlJ3PMTP4ZAMhk=
 =NU0u
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/rth/tags/tcg-next-pull-request' into staging

Queued TCG patches

# gpg: Signature made Wed 09 May 2018 16:46:21 BST
# gpg:                using RSA key 64DF38E8AF7E215F
# gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>"
# Primary key fingerprint: 7A48 1E78 868B 4DB6 A85A  05C0 64DF 38E8 AF7E 215F

* remotes/rth/tags/tcg-next-pull-request:
  tcg: Limit the number of ops in a TB
  tcg/i386: Fix dup_vec in non-AVX2 codepath

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2018-05-11 14:41:38 +01:00
commit 6d7cde809d
3 changed files with 13 additions and 4 deletions

View File

@ -854,11 +854,11 @@ static void tcg_out_dup_vec(TCGContext *s, TCGType type, unsigned vece,
switch (vece) {
case MO_8:
/* ??? With zero in a register, use PSHUFB. */
tcg_out_vex_modrm(s, OPC_PUNPCKLBW, r, 0, a);
tcg_out_vex_modrm(s, OPC_PUNPCKLBW, r, a, a);
a = r;
/* FALLTHRU */
case MO_16:
tcg_out_vex_modrm(s, OPC_PUNPCKLWD, r, 0, a);
tcg_out_vex_modrm(s, OPC_PUNPCKLWD, r, a, a);
a = r;
/* FALLTHRU */
case MO_32:
@ -867,7 +867,7 @@ static void tcg_out_dup_vec(TCGContext *s, TCGType type, unsigned vece,
tcg_out8(s, 0);
break;
case MO_64:
tcg_out_vex_modrm(s, OPC_PUNPCKLQDQ, r, 0, a);
tcg_out_vex_modrm(s, OPC_PUNPCKLQDQ, r, a, a);
break;
default:
g_assert_not_reached();

View File

@ -866,6 +866,7 @@ void tcg_func_start(TCGContext *s)
/* No temps have been previously allocated for size or locality. */
memset(s->free_temps, 0, sizeof(s->free_temps));
s->nb_ops = 0;
s->nb_labels = 0;
s->current_frame_offset = s->frame_start;
@ -1956,6 +1957,7 @@ void tcg_op_remove(TCGContext *s, TCGOp *op)
{
QTAILQ_REMOVE(&s->ops, op, link);
QTAILQ_INSERT_TAIL(&s->free_ops, op, link);
s->nb_ops--;
#ifdef CONFIG_PROFILER
atomic_set(&s->prof.del_op_count, s->prof.del_op_count + 1);
@ -1975,6 +1977,7 @@ static TCGOp *tcg_op_alloc(TCGOpcode opc)
}
memset(op, 0, offsetof(TCGOp, link));
op->opc = opc;
s->nb_ops++;
return op;
}

View File

@ -655,6 +655,7 @@ struct TCGContext {
int nb_globals;
int nb_temps;
int nb_indirects;
int nb_ops;
/* goto_tb support */
tcg_insn_unit *code_buf;
@ -844,7 +845,12 @@ static inline TCGOp *tcg_last_op(void)
/* Test for whether to terminate the TB for using too many opcodes. */
static inline bool tcg_op_buf_full(void)
{
return false;
/* This is not a hard limit, it merely stops translation when
* we have produced "enough" opcodes. We want to limit TB size
* such that a RISC host can reasonably use a 16-bit signed
* branch within the TB.
*/
return tcg_ctx->nb_ops >= 8000;
}
/* pool based memory allocation */