From nobody Mon Feb 9 08:36:12 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1552813867690715.1675941660749; Sun, 17 Mar 2019 02:11:07 -0700 (PDT) Received: from localhost ([127.0.0.1]:52111 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h5Rom-0007FM-8y for importer@patchew.org; Sun, 17 Mar 2019 05:10:56 -0400 Received: from eggs.gnu.org ([209.51.188.92]:47658) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h5Rmd-0005c2-PE for qemu-devel@nongnu.org; Sun, 17 Mar 2019 05:08:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h5Rmb-00046G-R1 for qemu-devel@nongnu.org; Sun, 17 Mar 2019 05:08:43 -0400 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]:40642) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h5Rmb-00045a-AD for qemu-devel@nongnu.org; Sun, 17 Mar 2019 05:08:41 -0400 Received: by mail-pg1-x541.google.com with SMTP id u9so9319655pgo.7 for ; Sun, 17 Mar 2019 02:08:41 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-188-82.tukw.qwest.net. [97.113.188.82]) by smtp.gmail.com with ESMTPSA id b85sm19378435pfj.56.2019.03.17.02.08.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Mar 2019 02:08:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=673pHgTWT8QRtFd/5n9jHy6LBEG0yAkhBqL83UHJaJU=; b=zvV93P6WHCkatLgm91FJiuCHRbbz+mxXfVpoKQaGjDBA8lk3MTMqqeU6XM/ztvvLnh VdxO3nsDKRsIfj8nG/A9ZzMNAgRixl3GXSM1DYsCiynxYuSeF4w3w5oTLjwm+1/XdNwD JTteGC3pJKTMJ4GoAiYEzeA6DIVw5HiR5Tgr0JJeNXTqLvYl+7qScE7xlsK/iB5KXqVl 3SNv6gpqJwpT1hpy20PH6t+3rT79FplvJk1GQ1/urC3DVnLC+pEEMsfpd5kwp35618mO Gzd01k/cdgKnB7L8kF7853UfKJ4rUKp+z1MKpYG+AGVPHKWUvfGRTJIBsTWNO54oj/Ds EQYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=673pHgTWT8QRtFd/5n9jHy6LBEG0yAkhBqL83UHJaJU=; b=i/2GBfGKYUl2IZeaaAVyiycKgq2F3wDwKCprYW961J8PmkftGLhyG4e/hq75z4v3xu kBz5KfYbWKLRWapYnmv0lf7Y0lWtv7/4WfPcGzy9kwhRDa9AMkiIKxHGnCdGmtubNzB3 bA1VukJPvO9zkVVcwhaaU0Ai4bh4Y+AHGd8oifmHe4lbuJQnkyUC1At5af3LtJoObwqT ARSj31RNgi5iZ2MEXeFefr+Jd90tsDBLOEoXFsJJcu0bDAk4RgWsqGyDepcmAYlHMF09 HBMkeSLd7AW83/pL0XVLA+4GA3hzG4txnePQTD/jkRTZ6JqLJs1dVxyLqOTCWggQiDPh uXhA== X-Gm-Message-State: APjAAAXaKFYVeQ7Vv6TraKHeo/DB9eZe9x1NbPo3jc3i2zJDNs9CK0uw 1VQ6zuruLfuXieCUTv0zYvA4hBZ9fqY= X-Google-Smtp-Source: APXvYqy3Jsk7di1/FQPY2REqEuqXsjRx0OfAFstSlc1yW6JnqD6XzwHac7ZY4YllE9tsm3P+EwRrLA== X-Received: by 2002:a65:60c1:: with SMTP id r1mr12076302pgv.137.1552813719715; Sun, 17 Mar 2019 02:08:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sun, 17 Mar 2019 02:08:23 -0700 Message-Id: <20190317090834.5552-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190317090834.5552-1-richard.henderson@linaro.org> References: <20190317090834.5552-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::541 Subject: [Qemu-devel] [PATCH for-4.1 v2 02/13] tcg: Return bool success from tcg_out_mov 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: mark.cave-ayland@ilande.co.uk, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This patch merely changes the interface, aborting on all failures, of which there are currently none. Signed-off-by: Richard Henderson Reviewed-by: David Gibson --- tcg/aarch64/tcg-target.inc.c | 5 +++-- tcg/arm/tcg-target.inc.c | 7 +++++-- tcg/i386/tcg-target.inc.c | 5 +++-- tcg/mips/tcg-target.inc.c | 3 ++- tcg/ppc/tcg-target.inc.c | 3 ++- tcg/riscv/tcg-target.inc.c | 5 +++-- tcg/s390/tcg-target.inc.c | 3 ++- tcg/sparc/tcg-target.inc.c | 3 ++- tcg/tcg.c | 14 ++++++++++---- tcg/tci/tcg-target.inc.c | 3 ++- 10 files changed, 34 insertions(+), 17 deletions(-) diff --git a/tcg/aarch64/tcg-target.inc.c b/tcg/aarch64/tcg-target.inc.c index d57f9e500f..6ba9050d9a 100644 --- a/tcg/aarch64/tcg-target.inc.c +++ b/tcg/aarch64/tcg-target.inc.c @@ -938,10 +938,10 @@ static void tcg_out_ldst(TCGContext *s, AArch64Insn i= nsn, TCGReg rd, tcg_out_ldst_r(s, insn, rd, rn, TCG_TYPE_I64, TCG_REG_TMP); } =20 -static void tcg_out_mov(TCGContext *s, TCGType type, TCGReg ret, TCGReg ar= g) +static bool tcg_out_mov(TCGContext *s, TCGType type, TCGReg ret, TCGReg ar= g) { if (ret =3D=3D arg) { - return; + return true; } switch (type) { case TCG_TYPE_I32: @@ -970,6 +970,7 @@ static void tcg_out_mov(TCGContext *s, TCGType type, TC= GReg ret, TCGReg arg) default: g_assert_not_reached(); } + return true; } =20 static void tcg_out_ld(TCGContext *s, TCGType type, TCGReg ret, diff --git a/tcg/arm/tcg-target.inc.c b/tcg/arm/tcg-target.inc.c index 2245a8aeb9..b303befa50 100644 --- a/tcg/arm/tcg-target.inc.c +++ b/tcg/arm/tcg-target.inc.c @@ -2250,10 +2250,13 @@ static inline bool tcg_out_sti(TCGContext *s, TCGTy= pe type, TCGArg val, return false; } =20 -static inline void tcg_out_mov(TCGContext *s, TCGType type, +static inline bool tcg_out_mov(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg) { - tcg_out_dat_reg(s, COND_AL, ARITH_MOV, ret, 0, arg, SHIFT_IMM_LSL(0)); + if (ret !=3D arg) { + tcg_out_dat_reg(s, COND_AL, ARITH_MOV, ret, 0, arg, SHIFT_IMM_LSL(= 0)); + } + return true; } =20 static inline void tcg_out_movi(TCGContext *s, TCGType type, diff --git a/tcg/i386/tcg-target.inc.c b/tcg/i386/tcg-target.inc.c index e0670e5098..7100cf7ac3 100644 --- a/tcg/i386/tcg-target.inc.c +++ b/tcg/i386/tcg-target.inc.c @@ -808,12 +808,12 @@ static inline void tgen_arithr(TCGContext *s, int sub= op, int dest, int src) tcg_out_modrm(s, OPC_ARITH_GvEv + (subop << 3) + ext, dest, src); } =20 -static void tcg_out_mov(TCGContext *s, TCGType type, TCGReg ret, TCGReg ar= g) +static bool tcg_out_mov(TCGContext *s, TCGType type, TCGReg ret, TCGReg ar= g) { int rexw =3D 0; =20 if (arg =3D=3D ret) { - return; + return true; } switch (type) { case TCG_TYPE_I64: @@ -851,6 +851,7 @@ static void tcg_out_mov(TCGContext *s, TCGType type, TC= GReg ret, TCGReg arg) default: g_assert_not_reached(); } + return true; } =20 static void tcg_out_dup_vec(TCGContext *s, TCGType type, unsigned vece, diff --git a/tcg/mips/tcg-target.inc.c b/tcg/mips/tcg-target.inc.c index 8a92e916dd..f31ebb43bf 100644 --- a/tcg/mips/tcg-target.inc.c +++ b/tcg/mips/tcg-target.inc.c @@ -558,13 +558,14 @@ static inline void tcg_out_dsra(TCGContext *s, TCGReg= rd, TCGReg rt, TCGArg sa) tcg_out_opc_sa64(s, OPC_DSRA, OPC_DSRA32, rd, rt, sa); } =20 -static inline void tcg_out_mov(TCGContext *s, TCGType type, +static inline bool tcg_out_mov(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg) { /* Simple reg-reg move, optimising out the 'do nothing' case */ if (ret !=3D arg) { tcg_out_opc_reg(s, OPC_OR, ret, arg, TCG_REG_ZERO); } + return true; } =20 static void tcg_out_movi(TCGContext *s, TCGType type, diff --git a/tcg/ppc/tcg-target.inc.c b/tcg/ppc/tcg-target.inc.c index 773690f1d9..ec8e336be8 100644 --- a/tcg/ppc/tcg-target.inc.c +++ b/tcg/ppc/tcg-target.inc.c @@ -566,12 +566,13 @@ static bool patch_reloc(tcg_insn_unit *code_ptr, int = type, static void tcg_out_mem_long(TCGContext *s, int opi, int opx, TCGReg rt, TCGReg base, tcg_target_long offset); =20 -static void tcg_out_mov(TCGContext *s, TCGType type, TCGReg ret, TCGReg ar= g) +static bool tcg_out_mov(TCGContext *s, TCGType type, TCGReg ret, TCGReg ar= g) { tcg_debug_assert(TCG_TARGET_REG_BITS =3D=3D 64 || type =3D=3D TCG_TYPE= _I32); if (ret !=3D arg) { tcg_out32(s, OR | SAB(arg, ret, arg)); } + return true; } =20 static inline void tcg_out_rld(TCGContext *s, int op, TCGReg ra, TCGReg rs, diff --git a/tcg/riscv/tcg-target.inc.c b/tcg/riscv/tcg-target.inc.c index b785f4acb7..e2bf1c2c6e 100644 --- a/tcg/riscv/tcg-target.inc.c +++ b/tcg/riscv/tcg-target.inc.c @@ -515,10 +515,10 @@ static bool patch_reloc(tcg_insn_unit *code_ptr, int = type, * TCG intrinsics */ =20 -static void tcg_out_mov(TCGContext *s, TCGType type, TCGReg ret, TCGReg ar= g) +static bool tcg_out_mov(TCGContext *s, TCGType type, TCGReg ret, TCGReg ar= g) { if (ret =3D=3D arg) { - return; + return true; } switch (type) { case TCG_TYPE_I32: @@ -528,6 +528,7 @@ static void tcg_out_mov(TCGContext *s, TCGType type, TC= GReg ret, TCGReg arg) default: g_assert_not_reached(); } + return true; } =20 static void tcg_out_movi(TCGContext *s, TCGType type, TCGReg rd, diff --git a/tcg/s390/tcg-target.inc.c b/tcg/s390/tcg-target.inc.c index 7db90b3bae..eb22188d1d 100644 --- a/tcg/s390/tcg-target.inc.c +++ b/tcg/s390/tcg-target.inc.c @@ -548,7 +548,7 @@ static void tcg_out_sh32(TCGContext* s, S390Opcode op, = TCGReg dest, tcg_out_insn_RS(s, op, dest, sh_reg, 0, sh_imm); } =20 -static void tcg_out_mov(TCGContext *s, TCGType type, TCGReg dst, TCGReg sr= c) +static bool tcg_out_mov(TCGContext *s, TCGType type, TCGReg dst, TCGReg sr= c) { if (src !=3D dst) { if (type =3D=3D TCG_TYPE_I32) { @@ -557,6 +557,7 @@ static void tcg_out_mov(TCGContext *s, TCGType type, TC= GReg dst, TCGReg src) tcg_out_insn(s, RRE, LGR, dst, src); } } + return true; } =20 static const S390Opcode lli_insns[4] =3D { diff --git a/tcg/sparc/tcg-target.inc.c b/tcg/sparc/tcg-target.inc.c index 7a61839dc1..83295955a7 100644 --- a/tcg/sparc/tcg-target.inc.c +++ b/tcg/sparc/tcg-target.inc.c @@ -407,12 +407,13 @@ static void tcg_out_arithc(TCGContext *s, TCGReg rd, = TCGReg rs1, | (val2const ? INSN_IMM13(val2) : INSN_RS2(val2))); } =20 -static inline void tcg_out_mov(TCGContext *s, TCGType type, +static inline bool tcg_out_mov(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg) { if (ret !=3D arg) { tcg_out_arith(s, ret, arg, TCG_REG_G0, ARITH_OR); } + return true; } =20 static inline void tcg_out_sethi(TCGContext *s, TCGReg ret, uint32_t arg) diff --git a/tcg/tcg.c b/tcg/tcg.c index 6f320a4849..34ee06564f 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -102,7 +102,7 @@ static const char *target_parse_constraint(TCGArgConstr= aint *ct, const char *ct_str, TCGType typ= e); static void tcg_out_ld(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg= 1, intptr_t arg2); -static void tcg_out_mov(TCGContext *s, TCGType type, TCGReg ret, TCGReg ar= g); +static bool tcg_out_mov(TCGContext *s, TCGType type, TCGReg ret, TCGReg ar= g); static void tcg_out_movi(TCGContext *s, TCGType type, TCGReg ret, tcg_target_long arg); static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, @@ -3368,7 +3368,9 @@ static void tcg_reg_alloc_mov(TCGContext *s, const TC= GOp *op) allocated_regs, preferred_regs, ots->indirect_base); } - tcg_out_mov(s, otype, ots->reg, ts->reg); + if (!tcg_out_mov(s, otype, ots->reg, ts->reg)) { + abort(); + } } ots->val_type =3D TEMP_VAL_REG; ots->mem_coherent =3D 0; @@ -3468,7 +3470,9 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCG= Op *op) i_allocated_regs, 0); reg =3D tcg_reg_alloc(s, arg_ct->u.regs, i_allocated_regs, o_preferred_regs, ts->indirect_base); - tcg_out_mov(s, ts->type, reg, ts->reg); + if (!tcg_out_mov(s, ts->type, reg, ts->reg)) { + abort(); + } } new_args[i] =3D reg; const_args[i] =3D 0; @@ -3625,7 +3629,9 @@ static void tcg_reg_alloc_call(TCGContext *s, TCGOp *= op) if (ts->val_type =3D=3D TEMP_VAL_REG) { if (ts->reg !=3D reg) { tcg_reg_free(s, reg, allocated_regs); - tcg_out_mov(s, ts->type, reg, ts->reg); + if (!tcg_out_mov(s, ts->type, reg, ts->reg)) { + abort(); + } } } else { TCGRegSet arg_set =3D 0; diff --git a/tcg/tci/tcg-target.inc.c b/tcg/tci/tcg-target.inc.c index 0015a98485..992d50cb1e 100644 --- a/tcg/tci/tcg-target.inc.c +++ b/tcg/tci/tcg-target.inc.c @@ -509,7 +509,7 @@ static void tcg_out_ld(TCGContext *s, TCGType type, TCG= Reg ret, TCGReg arg1, old_code_ptr[1] =3D s->code_ptr - old_code_ptr; } =20 -static void tcg_out_mov(TCGContext *s, TCGType type, TCGReg ret, TCGReg ar= g) +static bool tcg_out_mov(TCGContext *s, TCGType type, TCGReg ret, TCGReg ar= g) { uint8_t *old_code_ptr =3D s->code_ptr; tcg_debug_assert(ret !=3D arg); @@ -521,6 +521,7 @@ static void tcg_out_mov(TCGContext *s, TCGType type, TC= GReg ret, TCGReg arg) tcg_out_r(s, ret); tcg_out_r(s, arg); old_code_ptr[1] =3D s->code_ptr - old_code_ptr; + return true; } =20 static void tcg_out_movi(TCGContext *s, TCGType type, --=20 2.17.2