From nobody Wed Oct 22 04:11:10 2025 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.zohomail.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; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1519836846815899.2558584051319; Wed, 28 Feb 2018 08:54:06 -0800 (PST) Received: from localhost ([::1]:45529 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1er4zV-0004hN-Kv for importer@patchew.org; Wed, 28 Feb 2018 11:54:05 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46125) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1er4u1-0000g3-Fr for qemu-devel@nongnu.org; Wed, 28 Feb 2018 11:48:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1er4tz-00073p-1M for qemu-devel@nongnu.org; Wed, 28 Feb 2018 11:48:25 -0500 Received: from mail-pg0-x244.google.com ([2607:f8b0:400e:c05::244]:39019) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1er4ty-00072W-SM for qemu-devel@nongnu.org; Wed, 28 Feb 2018 11:48:22 -0500 Received: by mail-pg0-x244.google.com with SMTP id w16so253009pgv.6 for ; Wed, 28 Feb 2018 08:48:22 -0800 (PST) Received: from cloudburst.twiddle.net (97-113-169-147.tukw.qwest.net. [97.113.169.147]) by smtp.gmail.com with ESMTPSA id p9sm4123698pgs.89.2018.02.28.08.48.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2018 08:48:20 -0800 (PST) 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=t4S8hXXojsgeimGUR2ZbYe3j+CW2I+6abRgSF3z2TVg=; b=jD4NC+J+eOpWZm7LMIHD/YoYAcDLXmixPayy/90eO/Xi+q1VxqIsrUTFK3xvAV3B/6 13jxlCVFiUa1Cy9lkjFVhtOLSwc+JJ2jXpo6Mg/TV2jXiAhGdwCF24JjDyqxZrnmxJZl UMOva6AjzRnPBm+9UTM1Q+ZqoYFNQiQe41oRI= 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=t4S8hXXojsgeimGUR2ZbYe3j+CW2I+6abRgSF3z2TVg=; b=NyO1RABxqzmeXXdwFwGCU/NM+ejfzWzUlz6DUeHfG0IKrxi9A2uz9MKc78rRKQ2yu1 H+jgdo1SSx5PKg0wNvZLj7pKHkKHYp2X8eyn8vE6gpNni1M05kFbvpedYrtlptBRBEnk OchStr+rvB8O2OPmZCePUjPxvNirBRV2XpN7DHjNH0xWU8UQ6UWk/K69bw/knbHGgu9R oDMFdvi5qcd8pvlWHCaPzcYiwOXdxbROIR5hhe5RqLi4wn1VrIe6mL9T81lUkEVc0Yjv 6XB5exD/2dhcJeRFx7YmBJyjLcsarzcgKYZ59BvcYE+XDTA401s6FE1RPtDTvfM1jPS1 66Bg== X-Gm-Message-State: APf1xPCC9IHDssrB/Uuw5n74Rm7Z53abewjTfmF5Cv/wI6IejnWeyA6K Xf5PXzXMRIDVNdSx0hZR7M7ZemTtQxM= X-Google-Smtp-Source: AH8x226NC5uMItyIKGte7FXiDbVyzoVQ3LlTk3c3vlzmhZHyVfTfCH2ETMxXsvXs4omdkFZvoGbORg== X-Received: by 10.99.37.7 with SMTP id l7mr14802382pgl.311.1519836501520; Wed, 28 Feb 2018 08:48:21 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 28 Feb 2018 08:48:14 -0800 Message-Id: <20180228164816.24110-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180228164816.24110-1-richard.henderson@linaro.org> References: <20180228164816.24110-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::244 Subject: [Qemu-devel] [PATCH] decodetree: Propagate return value from translate subroutines 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: qemu-arm@nongnu.org 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" Allow the translate subroutines to return false for invalid insns. At present we can of course invoke an invalid insn exception from within the translate subroutine, but in the short term this consolidates code. In the long term it would allow the decodetree language to support overlapping patterns for ISA extensions. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- Since this makes an ABI change to the translate functions called by the decode function, let's make it now before there are any in-tree users. My SVE branch over-decodes in quite a lot of cases -- e.g. things like the 2-bit size field must be 1-3 for fp operands, and so size=3D=3D0 is unallocated. Returning false for these cases allows the actual call to unallocated_encoding to be done in one place instead of hundreds. Longer term, I'm thinking of how to handle decode of overlapping ISA extensions. One could allow (specific) overlapping patterns and prioritize them in some way (e.g. first in file is first matched). My thought is that trans_insn_a would check a cpu feature bit and return false if not enabled. Then trans_insn_b would be given its chance to handle the insn. r~ --- scripts/decodetree.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/decodetree.py b/scripts/decodetree.py index 6a33f8f8dd..41301c84aa 100755 --- a/scripts/decodetree.py +++ b/scripts/decodetree.py @@ -461,7 +461,7 @@ class Pattern(General): global translate_prefix output('typedef ', self.base.base.struct_name(), ' arg_', self.name, ';\n') - output(translate_scope, 'void ', translate_prefix, '_', self.name, + output(translate_scope, 'bool ', translate_prefix, '_', self.name, '(DisasContext *ctx, arg_', self.name, ' *a, ', insntype, ' insn);\n') =20 @@ -474,9 +474,8 @@ class Pattern(General): output(ind, self.base.extract_name(), '(&u.f_', arg, ', insn);= \n') for n, f in self.fields.items(): output(ind, 'u.f_', arg, '.', n, ' =3D ', f.str_extract(), ';\= n') - output(ind, translate_prefix, '_', self.name, + output(ind, 'return ', translate_prefix, '_', self.name, '(ctx, &u.f_', arg, ', insn);\n') - output(ind, 'return true;\n') # end Pattern =20 =20 --=20 2.14.3