From nobody Mon Feb 9 23:00:26 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 149801370003839.25693547744288; Tue, 20 Jun 2017 19:55:00 -0700 (PDT) Received: from localhost ([::1]:51553 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dNVnG-00030J-KQ for importer@patchew.org; Tue, 20 Jun 2017 22:54:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33861) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dNVhD-0006Q9-ST for qemu-devel@nongnu.org; Tue, 20 Jun 2017 22:48:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dNVhB-0002LJ-W7 for qemu-devel@nongnu.org; Tue, 20 Jun 2017 22:48:43 -0400 Received: from mail-qk0-x242.google.com ([2607:f8b0:400d:c09::242]:35639) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dNVhB-0002LE-P5 for qemu-devel@nongnu.org; Tue, 20 Jun 2017 22:48:41 -0400 Received: by mail-qk0-x242.google.com with SMTP id 16so8295539qkg.2 for ; Tue, 20 Jun 2017 19:48:41 -0700 (PDT) Received: from bigtime.twiddle.net.com (97-113-165-157.tukw.qwest.net. [97.113.165.157]) by smtp.gmail.com with ESMTPSA id l53sm2478939qta.56.2017.06.20.19.48.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Jun 2017 19:48:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=qzLz4uxKLeOxZF5QJcB/seQ2qqD4Jf8WFDnVxPhGLi4=; b=lhASnBkDUUoLG4lnYFdGWzqluAEUtbmmqmrL2wNqGg36H5fd7cQhqxy1IIvsnBp3gV ShD/gwKqM8BJnWcuSF7eScbUhAuu4sJe/ZpEvHjeDnvEFdh82Uf/K16BrZCtduAz8b6Z COlFRFEk7kqE3HsSg5mx4Z9QD3RHMaJk5WwV403z2oBJHXDsEl65uTa88Bo+WYterfQr XI+o05kkkAjR8A2RETla/JM0bsvqiEJfI8BSwI0WHNFw37+Gu97UItTHpqSbveltbwBn vbGDxPpMzQHVG84QNz164e4XWZAYBmJLCVLgS7tYlvjBJja7wqvLIk/kxdmoA5rbMqG7 +SYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=qzLz4uxKLeOxZF5QJcB/seQ2qqD4Jf8WFDnVxPhGLi4=; b=NmAXgGWWoyvwUt4RDtmERtGT9pMKu/AN27qmKVHM1KV/E3mQRw9pEX2B923vG6PUHR Ff3YUdZonIcfl+R6j1CUmQOkHU+xvw/Imb3esKEyCcjqYRu1ujWvdyLu5/SBf2xkIbcp iFYclsFyu+0nLRhb8qRVHDrsyWPS/ohYikkEWyAbCRd0tlzo22kyKWB5ANrhqrKdto6B tGvvmFGywpH3u8PCDCTMNt5XtbuOGt6oxHM5EQODB5FwCOpSQro7/dbExYYYFhhUDiZM nx3bdKKTd2NZlpPmT/3Kp64HIpwDWgL6xokXWIraqdAO98bz9FpBZfJVTwtMuLooi2iU 3aPA== X-Gm-Message-State: AKS2vOzQX1jEAx640Gse76P3Nu6ez3iis+oA5ffwkpOZo+lkWaZ15dEM 2KYefkXgHqriQERCqMs= X-Received: by 10.55.116.66 with SMTP id p63mr34802769qkc.250.1498013320580; Tue, 20 Jun 2017 19:48:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 20 Jun 2017 19:48:18 -0700 Message-Id: <20170621024831.26019-4-rth@twiddle.net> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170621024831.26019-1-rth@twiddle.net> References: <20170621024831.26019-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::242 Subject: [Qemu-devel] [PATCH 03/16] tcg: Propagate args to op->args in tcg.c X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: aurelien@aurel32.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson --- tcg/tcg.c | 121 ++++++++++++++++++++++++++++++----------------------------= ---- 1 file changed, 58 insertions(+), 63 deletions(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index 298aa0c..be5b69c 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1054,14 +1054,12 @@ void tcg_dump_ops(TCGContext *s) for (oi =3D s->gen_op_buf[0].next; oi !=3D 0; oi =3D op->next) { int i, k, nb_oargs, nb_iargs, nb_cargs; const TCGOpDef *def; - const TCGArg *args; TCGOpcode c; int col =3D 0; =20 op =3D &s->gen_op_buf[oi]; c =3D op->opc; def =3D &tcg_op_defs[c]; - args =3D op->args; =20 if (c =3D=3D INDEX_op_insn_start) { col +=3D qemu_log("%s ----", oi !=3D s->gen_op_buf[0].next ? "= \n" : ""); @@ -1069,9 +1067,9 @@ void tcg_dump_ops(TCGContext *s) for (i =3D 0; i < TARGET_INSN_START_WORDS; ++i) { target_ulong a; #if TARGET_LONG_BITS > TCG_TARGET_REG_BITS - a =3D ((target_ulong)args[i * 2 + 1] << 32) | args[i * 2]; + a =3D deposit64(op->args[i * 2], 32, 32, op->args[i * 2 + = 1]); #else - a =3D args[i]; + a =3D op->args[i]; #endif col +=3D qemu_log(" " TARGET_FMT_lx, a); } @@ -1083,14 +1081,14 @@ void tcg_dump_ops(TCGContext *s) =20 /* function name, flags, out args */ col +=3D qemu_log(" %s %s,$0x%" TCG_PRIlx ",$%d", def->name, - tcg_find_helper(s, args[nb_oargs + nb_iargs]), - args[nb_oargs + nb_iargs + 1], nb_oargs); + tcg_find_helper(s, op->args[nb_oargs + nb_iarg= s]), + op->args[nb_oargs + nb_iargs + 1], nb_oargs); for (i =3D 0; i < nb_oargs; i++) { col +=3D qemu_log(",%s", tcg_get_arg_str_idx(s, buf, sizeo= f(buf), - args[i])); + op->args[i])); } for (i =3D 0; i < nb_iargs; i++) { - TCGArg arg =3D args[nb_oargs + i]; + TCGArg arg =3D op->args[nb_oargs + i]; const char *t =3D ""; if (arg !=3D TCG_CALL_DUMMY_ARG) { t =3D tcg_get_arg_str_idx(s, buf, sizeof(buf), arg); @@ -1110,14 +1108,14 @@ void tcg_dump_ops(TCGContext *s) col +=3D qemu_log(","); } col +=3D qemu_log("%s", tcg_get_arg_str_idx(s, buf, sizeof= (buf), - args[k++])); + op->args[k++])); } for (i =3D 0; i < nb_iargs; i++) { if (k !=3D 0) { col +=3D qemu_log(","); } col +=3D qemu_log("%s", tcg_get_arg_str_idx(s, buf, sizeof= (buf), - args[k++])); + op->args[k++])); } switch (c) { case INDEX_op_brcond_i32: @@ -1128,10 +1126,11 @@ void tcg_dump_ops(TCGContext *s) case INDEX_op_brcond_i64: case INDEX_op_setcond_i64: case INDEX_op_movcond_i64: - if (args[k] < ARRAY_SIZE(cond_name) && cond_name[args[k]])= { - col +=3D qemu_log(",%s", cond_name[args[k++]]); + if (op->args[k] < ARRAY_SIZE(cond_name) + && cond_name[op->args[k]]) { + col +=3D qemu_log(",%s", cond_name[op->args[k++]]); } else { - col +=3D qemu_log(",$0x%" TCG_PRIlx, args[k++]); + col +=3D qemu_log(",$0x%" TCG_PRIlx, op->args[k++]); } i =3D 1; break; @@ -1140,7 +1139,7 @@ void tcg_dump_ops(TCGContext *s) case INDEX_op_qemu_ld_i64: case INDEX_op_qemu_st_i64: { - TCGMemOpIdx oi =3D args[k++]; + TCGMemOpIdx oi =3D op->args[k++]; TCGMemOp op =3D get_memop(oi); unsigned ix =3D get_mmuidx(oi); =20 @@ -1165,14 +1164,15 @@ void tcg_dump_ops(TCGContext *s) case INDEX_op_brcond_i32: case INDEX_op_brcond_i64: case INDEX_op_brcond2_i32: - col +=3D qemu_log("%s$L%d", k ? "," : "", arg_label(args[k= ])->id); + col +=3D qemu_log("%s$L%d", k ? "," : "", + arg_label(op->args[k])->id); i++, k++; break; default: break; } for (; i < nb_cargs; i++, k++) { - col +=3D qemu_log("%s$0x%" TCG_PRIlx, k ? "," : "", args[k= ]); + col +=3D qemu_log("%s$0x%" TCG_PRIlx, k ? "," : "", op->ar= gs[k]); } } if (op->life) { @@ -1433,7 +1433,6 @@ static void liveness_pass_1(TCGContext *s, uint8_t *t= emp_state) TCGArg arg; =20 TCGOp * const op =3D &s->gen_op_buf[oi]; - TCGArg * const args =3D op->args; TCGOpcode opc =3D op->opc; const TCGOpDef *def =3D &tcg_op_defs[opc]; =20 @@ -1446,12 +1445,12 @@ static void liveness_pass_1(TCGContext *s, uint8_t = *temp_state) =20 nb_oargs =3D op->callo; nb_iargs =3D op->calli; - call_flags =3D args[nb_oargs + nb_iargs + 1]; + call_flags =3D op->args[nb_oargs + nb_iargs + 1]; =20 /* pure functions can be removed if their result is unused= */ if (call_flags & TCG_CALL_NO_SIDE_EFFECTS) { for (i =3D 0; i < nb_oargs; i++) { - arg =3D args[i]; + arg =3D op->args[i]; if (temp_state[arg] !=3D TS_DEAD) { goto do_not_remove_call; } @@ -1462,7 +1461,7 @@ static void liveness_pass_1(TCGContext *s, uint8_t *t= emp_state) =20 /* output args are dead */ for (i =3D 0; i < nb_oargs; i++) { - arg =3D args[i]; + arg =3D op->args[i]; if (temp_state[arg] & TS_DEAD) { arg_life |=3D DEAD_ARG << i; } @@ -1485,7 +1484,7 @@ static void liveness_pass_1(TCGContext *s, uint8_t *t= emp_state) =20 /* record arguments that die in this helper */ for (i =3D nb_oargs; i < nb_iargs + nb_oargs; i++) { - arg =3D args[i]; + arg =3D op->args[i]; if (arg !=3D TCG_CALL_DUMMY_ARG) { if (temp_state[arg] & TS_DEAD) { arg_life |=3D DEAD_ARG << i; @@ -1494,7 +1493,7 @@ static void liveness_pass_1(TCGContext *s, uint8_t *t= emp_state) } /* input arguments are live for preceding opcodes */ for (i =3D nb_oargs; i < nb_iargs + nb_oargs; i++) { - arg =3D args[i]; + arg =3D op->args[i]; if (arg !=3D TCG_CALL_DUMMY_ARG) { temp_state[arg] &=3D ~TS_DEAD; } @@ -1506,7 +1505,7 @@ static void liveness_pass_1(TCGContext *s, uint8_t *t= emp_state) break; case INDEX_op_discard: /* mark the temporary as dead */ - temp_state[args[0]] =3D TS_DEAD; + temp_state[op->args[0]] =3D TS_DEAD; break; =20 case INDEX_op_add2_i32: @@ -1527,15 +1526,15 @@ static void liveness_pass_1(TCGContext *s, uint8_t = *temp_state) the low part. The result can be optimized to a simple add or sub. This happens often for x86_64 guest when the cpu mode is set to 32 bit. */ - if (temp_state[args[1]] =3D=3D TS_DEAD) { - if (temp_state[args[0]] =3D=3D TS_DEAD) { + if (temp_state[op->args[1]] =3D=3D TS_DEAD) { + if (temp_state[op->args[0]] =3D=3D TS_DEAD) { goto do_remove; } /* Replace the opcode and adjust the args in place, leaving 3 unused args at the end. */ op->opc =3D opc =3D opc_new; - args[1] =3D args[2]; - args[2] =3D args[4]; + op->args[1] =3D op->args[2]; + op->args[2] =3D op->args[4]; /* Fall through and mark the single-word operation live. = */ nb_iargs =3D 2; nb_oargs =3D 1; @@ -1565,21 +1564,21 @@ static void liveness_pass_1(TCGContext *s, uint8_t = *temp_state) do_mul2: nb_iargs =3D 2; nb_oargs =3D 2; - if (temp_state[args[1]] =3D=3D TS_DEAD) { - if (temp_state[args[0]] =3D=3D TS_DEAD) { + if (temp_state[op->args[1]] =3D=3D TS_DEAD) { + if (temp_state[op->args[0]] =3D=3D TS_DEAD) { /* Both parts of the operation are dead. */ goto do_remove; } /* The high part of the operation is dead; generate the lo= w. */ op->opc =3D opc =3D opc_new; - args[1] =3D args[2]; - args[2] =3D args[3]; - } else if (temp_state[args[0]] =3D=3D TS_DEAD && have_opc_new2= ) { + op->args[1] =3D op->args[2]; + op->args[2] =3D op->args[3]; + } else if (temp_state[op->args[0]] =3D=3D TS_DEAD && have_opc_= new2) { /* The low part of the operation is dead; generate the hig= h. */ op->opc =3D opc =3D opc_new2; - args[0] =3D args[1]; - args[1] =3D args[2]; - args[2] =3D args[3]; + op->args[0] =3D op->args[1]; + op->args[1] =3D op->args[2]; + op->args[2] =3D op->args[3]; } else { goto do_not_remove; } @@ -1597,7 +1596,7 @@ static void liveness_pass_1(TCGContext *s, uint8_t *t= emp_state) implies side effects */ if (!(def->flags & TCG_OPF_SIDE_EFFECTS) && nb_oargs !=3D 0) { for (i =3D 0; i < nb_oargs; i++) { - if (temp_state[args[i]] !=3D TS_DEAD) { + if (temp_state[op->args[i]] !=3D TS_DEAD) { goto do_not_remove; } } @@ -1607,7 +1606,7 @@ static void liveness_pass_1(TCGContext *s, uint8_t *t= emp_state) do_not_remove: /* output args are dead */ for (i =3D 0; i < nb_oargs; i++) { - arg =3D args[i]; + arg =3D op->args[i]; if (temp_state[arg] & TS_DEAD) { arg_life |=3D DEAD_ARG << i; } @@ -1629,14 +1628,14 @@ static void liveness_pass_1(TCGContext *s, uint8_t = *temp_state) =20 /* record arguments that die in this opcode */ for (i =3D nb_oargs; i < nb_oargs + nb_iargs; i++) { - arg =3D args[i]; + arg =3D op->args[i]; if (temp_state[arg] & TS_DEAD) { arg_life |=3D DEAD_ARG << i; } } /* input arguments are live for preceding opcodes */ for (i =3D nb_oargs; i < nb_oargs + nb_iargs; i++) { - temp_state[args[i]] &=3D ~TS_DEAD; + temp_state[op->args[i]] &=3D ~TS_DEAD; } } break; @@ -1671,7 +1670,6 @@ static bool liveness_pass_2(TCGContext *s, uint8_t *t= emp_state) =20 for (oi =3D s->gen_op_buf[0].next; oi !=3D 0; oi =3D oi_next) { TCGOp *op =3D &s->gen_op_buf[oi]; - TCGArg *args =3D op->args; TCGOpcode opc =3D op->opc; const TCGOpDef *def =3D &tcg_op_defs[opc]; TCGLifeData arg_life =3D op->life; @@ -1683,7 +1681,7 @@ static bool liveness_pass_2(TCGContext *s, uint8_t *t= emp_state) if (opc =3D=3D INDEX_op_call) { nb_oargs =3D op->callo; nb_iargs =3D op->calli; - call_flags =3D args[nb_oargs + nb_iargs + 1]; + call_flags =3D op->args[nb_oargs + nb_iargs + 1]; } else { nb_iargs =3D def->nb_iargs; nb_oargs =3D def->nb_oargs; @@ -1704,7 +1702,7 @@ static bool liveness_pass_2(TCGContext *s, uint8_t *t= emp_state) =20 /* Make sure that input arguments are available. */ for (i =3D nb_oargs; i < nb_iargs + nb_oargs; i++) { - arg =3D args[i]; + arg =3D op->args[i]; /* Note this unsigned test catches TCG_CALL_ARG_DUMMY too. */ if (arg < nb_globals) { dir =3D dir_temps[arg]; @@ -1714,11 +1712,10 @@ static bool liveness_pass_2(TCGContext *s, uint8_t = *temp_state) ? INDEX_op_ld_i32 : INDEX_op_ld_i64); TCGOp *lop =3D tcg_op_insert_before(s, op, lopc, 3); - TCGArg *largs =3D lop->args; =20 - largs[0] =3D dir; - largs[1] =3D temp_idx(s, its->mem_base); - largs[2] =3D its->mem_offset; + lop->args[0] =3D dir; + lop->args[1] =3D temp_idx(s, its->mem_base); + lop->args[2] =3D its->mem_offset; =20 /* Loaded, but synced with memory. */ temp_state[arg] =3D TS_MEM; @@ -1730,11 +1727,11 @@ static bool liveness_pass_2(TCGContext *s, uint8_t = *temp_state) No action is required except keeping temp_state up to date so that we reload when needed. */ for (i =3D nb_oargs; i < nb_iargs + nb_oargs; i++) { - arg =3D args[i]; + arg =3D op->args[i]; if (arg < nb_globals) { dir =3D dir_temps[arg]; if (dir !=3D 0) { - args[i] =3D dir; + op->args[i] =3D dir; changes =3D true; if (IS_DEAD_ARG(i)) { temp_state[arg] =3D TS_DEAD; @@ -1765,7 +1762,7 @@ static bool liveness_pass_2(TCGContext *s, uint8_t *t= emp_state) =20 /* Outputs become available. */ for (i =3D 0; i < nb_oargs; i++) { - arg =3D args[i]; + arg =3D op->args[i]; if (arg >=3D nb_globals) { continue; } @@ -1773,7 +1770,7 @@ static bool liveness_pass_2(TCGContext *s, uint8_t *t= emp_state) if (dir =3D=3D 0) { continue; } - args[i] =3D dir; + op->args[i] =3D dir; changes =3D true; =20 /* The output is now live and modified. */ @@ -1786,11 +1783,10 @@ static bool liveness_pass_2(TCGContext *s, uint8_t = *temp_state) ? INDEX_op_st_i32 : INDEX_op_st_i64); TCGOp *sop =3D tcg_op_insert_after(s, op, sopc, 3); - TCGArg *sargs =3D sop->args; =20 - sargs[0] =3D dir; - sargs[1] =3D temp_idx(s, its->mem_base); - sargs[2] =3D its->mem_offset; + sop->args[0] =3D dir; + sop->args[1] =3D temp_idx(s, its->mem_base); + sop->args[2] =3D its->mem_offset; =20 temp_state[arg] =3D TS_MEM; } @@ -2614,7 +2610,6 @@ int tcg_gen_code(TCGContext *s, TranslationBlock *tb) num_insns =3D -1; for (oi =3D s->gen_op_buf[0].next; oi !=3D 0; oi =3D oi_next) { TCGOp * const op =3D &s->gen_op_buf[oi]; - TCGArg * const args =3D op->args; TCGOpcode opc =3D op->opc; const TCGOpDef *def =3D &tcg_op_defs[opc]; TCGLifeData arg_life =3D op->life; @@ -2627,11 +2622,11 @@ int tcg_gen_code(TCGContext *s, TranslationBlock *t= b) switch (opc) { case INDEX_op_mov_i32: case INDEX_op_mov_i64: - tcg_reg_alloc_mov(s, def, args, arg_life); + tcg_reg_alloc_mov(s, def, op->args, arg_life); break; case INDEX_op_movi_i32: case INDEX_op_movi_i64: - tcg_reg_alloc_movi(s, args, arg_life); + tcg_reg_alloc_movi(s, op->args, arg_life); break; case INDEX_op_insn_start: if (num_insns >=3D 0) { @@ -2641,22 +2636,22 @@ int tcg_gen_code(TCGContext *s, TranslationBlock *t= b) for (i =3D 0; i < TARGET_INSN_START_WORDS; ++i) { target_ulong a; #if TARGET_LONG_BITS > TCG_TARGET_REG_BITS - a =3D ((target_ulong)args[i * 2 + 1] << 32) | args[i * 2]; + a =3D deposit64(op->args[i * 2], 32, 32, op->args[i * 2 + = 1]); #else - a =3D args[i]; + a =3D op->args[i]; #endif s->gen_insn_data[num_insns][i] =3D a; } break; case INDEX_op_discard: - temp_dead(s, &s->temps[args[0]]); + temp_dead(s, &s->temps[op->args[0]]); break; case INDEX_op_set_label: tcg_reg_alloc_bb_end(s, s->reserved_regs); - tcg_out_label(s, arg_label(args[0]), s->code_ptr); + tcg_out_label(s, arg_label(op->args[0]), s->code_ptr); break; case INDEX_op_call: - tcg_reg_alloc_call(s, op->callo, op->calli, args, arg_life); + tcg_reg_alloc_call(s, op->callo, op->calli, op->args, arg_life= ); break; default: /* Sanity check that we've not introduced any unhandled opcode= s. */ @@ -2666,7 +2661,7 @@ int tcg_gen_code(TCGContext *s, TranslationBlock *tb) /* Note: in order to speed up the code, it would be much faster to have specialized register allocator functions for some common argument patterns */ - tcg_reg_alloc_op(s, def, opc, args, arg_life); + tcg_reg_alloc_op(s, def, opc, op->args, arg_life); break; } #ifdef CONFIG_DEBUG_TCG --=20 2.9.4