From patchwork Tue Mar 12 17:03:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 160171 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp13401263jad; Tue, 12 Mar 2019 11:05:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqwIKWlFswhVhjvRwHbV1XChdCViWYJiy00JsU4QPwnHOmXi5BZOqevVfS46pWDeQpbKPYC5 X-Received: by 2002:a25:b448:: with SMTP id c8mr27440074ybg.269.1552413907100; Tue, 12 Mar 2019 11:05:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552413907; cv=none; d=google.com; s=arc-20160816; b=rsq6aWji3Q2IGHn6nKa1Bl/LqZACzOC7AnDKrF7OJOenBWJwGxaKM6H4ol1XGYxvk+ Fgbry1XGJooSUh9Z3BLwHuP4CTflvYBb3S4M67kUG6nJmq0R+98I0Ai+NZzMDaTiO3gt 5wfEBpqi6otSEYp7epDgWPGRoglYUVogu61QfgcE1XHG9QZuYBmemsRgJhGft/5KxSG9 DTR6tmdOVrA5qwz4Kgxf1yW/pG9aLbAlyF+KksvQPxABCSecXrkI+grjjZ4hzqMDscoH QmfJh03Jk44BN4P39zxiydwn3D+O/7OS2U5U4wnJBTqMLbtaD437jq/iG1JKw8Qb5pGl LU2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=PUT01px/Uz20GRQJaDRT0J+ujmf7Wf0Ye4RQ0OpusT8=; b=isVMG+2Ce+vGD9fTwQdFC8hDlY9JYQOYc7CJRj5LWge0amY/45ZvaAsayuL3JVtv3m ATpBbdsfxhTY2MJqX1ay+Cx4hkIBL4bnAxreMa5zeGNUJQmt4GtX5l61O+l/zaqa86KA SUjBQwoOVOwvkmWWPtUaLoKovRyMMML+c1MEKqhfkzDjbHfYxrVrvtn1GMfWnxJ1god2 d/oPQEEqn0AbAnFQcAUAHlhPNEtTvBYRBZNAJrXLx8yYFjLt1ytEK87paSACWSbrujPP csmN27NPhokZFwewPtgabkk4LO1GzbDzmXgLOWYejK7LOedYw4nkzbpQxTnsNMmCCDlT nNuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=pMSHDwB1; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t7si5498154ybo.143.2019.03.12.11.05.07 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 12 Mar 2019 11:05:07 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=pMSHDwB1; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:56958 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3lly-0003Gr-JX for patch@linaro.org; Tue, 12 Mar 2019 14:05:06 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51835) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3l3P-0006Hc-2E for qemu-devel@nongnu.org; Tue, 12 Mar 2019 13:19:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3koV-00016l-2n for qemu-devel@nongnu.org; Tue, 12 Mar 2019 13:03:39 -0400 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]:35641) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h3koU-000163-Qd for qemu-devel@nongnu.org; Tue, 12 Mar 2019 13:03:38 -0400 Received: by mail-pg1-x52d.google.com with SMTP id e17so2304023pgd.2 for ; Tue, 12 Mar 2019 10:03: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 :mime-version:content-transfer-encoding; bh=PUT01px/Uz20GRQJaDRT0J+ujmf7Wf0Ye4RQ0OpusT8=; b=pMSHDwB1bNXEq2OQcXRWewymT13Tb1TyuA7CaF/MWQ0z9R8IheAZA+p5M/O1ePmJXm uQRprfzXrt5rDeH1OxZQP9tYErm26l846TGDtAjXbJXoJpGjLcqPDX+fO2wMKOFRB74L 9uuGIVDp5bAKMS8W+KazCXRZXWd6++3YAyj/HMDpDSn2BcCtWJ9ORY0jmfGG6xsV4ZEX w6YyBQfAg+DSPLImk++ehADIuEGATvNGnbVmxMJRZLxm/BwzAgOVV+4mtGkt39ggqA9W biepW4lHCsQm+SLjbKiCusY08wuMj8rl7AS6T+er57R8lV+FbjMwobQQpoLGgapjq6Bl da3A== 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:mime-version:content-transfer-encoding; bh=PUT01px/Uz20GRQJaDRT0J+ujmf7Wf0Ye4RQ0OpusT8=; b=WhxbEdejR7Hg+IWF1J0hBS4ick/N33Q7MUl7uUlsYoh8uvWNAQbG6mfiVQJuPzdTd2 i1BjSeXF2YwWSgAmlqmx/yIjB2sz5UDkotK/Zk61u0CSi3nKrQUjQERiHxX/D68/Wbuy Ety5aZfLDWqpDpnFH6eMV71eoFtQJ/IaOlgQO9sQvol0/YpMDEA+9m2rtlDZstSC6Zds GMaAghSdz0/LA48hoxR6DM2CKiT/ap4SL+s+jfhJntO/P30Xc11Zp71N9wQ4mGAXvjOt RIEQIg4erVY3SddMhZthzuwimIGburPwbCoIbkFEAVjfmd+TUhc3JDeFk7z+Gar1Yd7I R58g== X-Gm-Message-State: APjAAAVpD3+anZTHwy59e3D7p6whg7XvV1fWrFkE4zQqyedIjRFAB2LI P3PDHUvzSiZ5WZJVH/AkcHqKhV01svg= X-Received: by 2002:a65:4bce:: with SMTP id p14mr10984051pgr.68.1552410217444; Tue, 12 Mar 2019 10:03:37 -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 v22sm17514265pfa.49.2019.03.12.10.03.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Mar 2019 10:03:36 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 12 Mar 2019 10:03:23 -0700 Message-Id: <20190312170334.14005-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190312170334.14005-1-richard.henderson@linaro.org> References: <20190312170334.14005-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::52d Subject: [Qemu-devel] [PULL 01/12] MAINTAINERS: Add scripts/decodetree.py to the TCG section 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: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20181110211313.6922-2-f4bug@amsat.org> Signed-off-by: Richard Henderson --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) -- 2.17.2 diff --git a/MAINTAINERS b/MAINTAINERS index d326756079..3426d3369d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -117,6 +117,7 @@ F: cpus.c F: exec.c F: accel/tcg/ F: accel/stubs/tcg-stub.c +F: scripts/decodetree.py F: include/exec/cpu*.h F: include/exec/exec-all.h F: include/exec/helper*.h From patchwork Tue Mar 12 17:03:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 160172 Delivered-To: patch@linaro.org Received: by 2002:ac9:18c7:0:0:0:0:0 with SMTP id i7csp13252366oce; Tue, 12 Mar 2019 11:08:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqyS4liROR0l0wJJpu/iUcgGclFHlJ67y9QeLGyFj3/MkBHZmxY68cwGKFYWqktwTESMvyvD X-Received: by 2002:a25:c78e:: with SMTP id w136mr33498792ybe.358.1552414116010; Tue, 12 Mar 2019 11:08:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552414116; cv=none; d=google.com; s=arc-20160816; b=Gi4LmaV3XgIol0T8KwldIUUSwPjEeyDEZA73tev5+PV4ZnnN5z77qLy3QZuANe1UVR t2VHF2ZMskuduM5xy1C2bp7sywVOxvo7R2C9XWFbIkIXlY7PJDMjgCncnDMAuDTn7BXv t2NusJqo6c+NYY7TUz8ewqn7NJJOd/YUyZvb99KcOTvWoaN7BocQYzVRL81Vl9FUsd29 E1cWJ3OO+toE0L6tg5ZuaMU26OWl2dLLFpkYFABpU1ZdigoCgzcCWDmHSTAZ4M68sT4i ccHsM66RTWS/wBsTRkZnliJayCDawJz3ELnHYm5Kun23E62XYEaDFPFdzZvJI5Ipkjjv PXDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=6ZHAJwXfZDm7adevkZ6nWf5hMn2SlST8Sb6jn0aG3mo=; b=T66VijglOzHZtGSdjoZ8EWisW4Kdt45n+r8UG+KLb6VMI4B/Dggc/5j6Xf5BnBuhdq ORzQprrTlHww5K/2rCkYruT+cr7CtD0TQEkE6n5dKbc0BI4OJhZeka2FyCcANaarHneJ 0UuQDSKFqHz7G4YUBJLwOuFZ4B9Ph5TK/TIeSFaMvmWRveggPc/F7+Xa+1MY1OkFIUHp I8T9Pylsf6EqZMqiz+vMwSQSkZh7kCvOvF1pJVD1jmiuNkptaYQAQLtMtIgmOjep5vZo uDFxZM6daKojWEyog/HCV6Ne2s+uGL1kducrK2WnZuR7uf+M6VFmbhQgOqIR9uqmRmme cx9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=cRmdF+L+; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id k141si5367663ybk.488.2019.03.12.11.08.35 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 12 Mar 2019 11:08:35 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=cRmdF+L+; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:57033 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3lpL-0006zb-Do for patch@linaro.org; Tue, 12 Mar 2019 14:08:35 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51125) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3l3P-0005kf-1Z for qemu-devel@nongnu.org; Tue, 12 Mar 2019 13:19:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3koW-00018G-MY for qemu-devel@nongnu.org; Tue, 12 Mar 2019 13:03:42 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]:45308) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h3koW-00017b-C8 for qemu-devel@nongnu.org; Tue, 12 Mar 2019 13:03:40 -0400 Received: by mail-pf1-x42c.google.com with SMTP id v21so2247075pfm.12 for ; Tue, 12 Mar 2019 10:03:40 -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=6ZHAJwXfZDm7adevkZ6nWf5hMn2SlST8Sb6jn0aG3mo=; b=cRmdF+L+q8F+BK1dQq1K0SgWZP3V2MguUxNUgKa1JLL3AJC5aUXQm5FScprzrSPENT Eeb+XqiDbi9evMYR2KFn0wxGBewEi02XI8xSx4PUj5tdxNQzYhE2iaydoNdvZ/VqcaZS L+j73c0stuIHEoNiKPtoI3SmlM3lpdzHi3hHSKA8Af4T7O2Mhe7mgO/aETB5d5vKyYQn GTrBd86VT0svRO5R/jaxpp/Vaq5ooucAWbrEfjomR8uPWfNDs8pmyI9d6vQlHo0BiDpj hWZ1PHM/VcSYcnV17pUegIEVlOwbaZa+G5ctPtfh+zdfY8a8BtZCoPJxLKjeMefL4H4S dxww== 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=6ZHAJwXfZDm7adevkZ6nWf5hMn2SlST8Sb6jn0aG3mo=; b=Av75dLlDqMxAn4bNAC3etqi+WzsU6yomMZ5o2m3H0HgUvFLqc0OnVZD8L8gjMXiOR7 KC2cZmlmLf92cIx1JEcEWaDqHjssF8yrRF5Hv5Z7vnpw6U4wDovvOpRIJ9o1Yh+AVw0p x5WVGAaiEmzrOoziyyPKT7J4nALSj7S8mwd3StU9RoGGc1T7uYycbVrFOjBYZ3Vpq5zY for+88a4lL5UvB9zlyzqbtcynjbuoKnGTVGUx5CQLq7/2ZFjw6ZNAWRSH4uJmIMHeShK TXSZK7As/KS8zFC1YeWwfoBkd2WyzANsRXoek6fodZbA1Ulu5fwjFKnuMGjhROc2MLCc NQhA== X-Gm-Message-State: APjAAAWbXyKXcr1x9UEzlK0zZWNy3IyrQ8e0CABXLovX9W8qxo1Y3hOE CMEr5J7DQtOZn21POThkBTKNc7RpuKw= X-Received: by 2002:a63:4e1d:: with SMTP id c29mr36447115pgb.433.1552410218683; Tue, 12 Mar 2019 10:03:38 -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 v22sm17514265pfa.49.2019.03.12.10.03.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Mar 2019 10:03:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 12 Mar 2019 10:03:24 -0700 Message-Id: <20190312170334.14005-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190312170334.14005-1-richard.henderson@linaro.org> References: <20190312170334.14005-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::42c Subject: [Qemu-devel] [PULL 02/12] decodetree: Move documentation to docs/devel/decodetree.rst 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: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" One great big block comment isn't the best way to document the syntax of a language. Reviewed-by: Bastian Koppelmann Signed-off-by: Richard Henderson --- MAINTAINERS | 1 + docs/devel/decodetree.rst | 156 ++++++++++++++++++++++++++++++++++++++ docs/devel/index.rst | 2 +- scripts/decodetree.py | 134 +------------------------------- 4 files changed, 159 insertions(+), 134 deletions(-) create mode 100644 docs/devel/decodetree.rst -- 2.17.2 diff --git a/MAINTAINERS b/MAINTAINERS index 3426d3369d..564b8dba6e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -118,6 +118,7 @@ F: exec.c F: accel/tcg/ F: accel/stubs/tcg-stub.c F: scripts/decodetree.py +F: docs/devel/decodetree.rst F: include/exec/cpu*.h F: include/exec/exec-all.h F: include/exec/helper*.h diff --git a/docs/devel/decodetree.rst b/docs/devel/decodetree.rst new file mode 100644 index 0000000000..d9be30b2db --- /dev/null +++ b/docs/devel/decodetree.rst @@ -0,0 +1,156 @@ +======================== +Decodetree Specification +======================== + +A *decodetree* is built from instruction *patterns*. A pattern may +represent a single architectural instruction or a group of same, depending +on what is convenient for further processing. + +Each pattern has both *fixedbits* and *fixedmask*, the combination of which +describes the condition under which the pattern is matched:: + + (insn & fixedmask) == fixedbits + +Each pattern may have *fields*, which are extracted from the insn and +passed along to the translator. Examples of such are registers, +immediates, and sub-opcodes. + +In support of patterns, one may declare *fields*, *argument sets*, and +*formats*, each of which may be re-used to simplify further definitions. + +Fields +====== + +Syntax:: + + field_def := '%' identifier ( unnamed_field )+ ( !function=identifier )? + unnamed_field := number ':' ( 's' ) number + +For *unnamed_field*, the first number is the least-significant bit position +of the field and the second number is the length of the field. If the 's' is +present, the field is considered signed. If multiple ``unnamed_fields`` are +present, they are concatenated. In this way one can define disjoint fields. + +If ``!function`` is specified, the concatenated result is passed through the +named function, taking and returning an integral value. + +FIXME: the fields of the structure into which this result will be stored +is restricted to ``int``. Which means that we cannot expand 64-bit items. + +Field examples: + ++---------------------------+---------------------------------------------+ +| Input | Generated code | ++===========================+=============================================+ +| %disp 0:s16 | sextract(i, 0, 16) | ++---------------------------+---------------------------------------------+ +| %imm9 16:6 10:3 | extract(i, 16, 6) << 3 | extract(i, 10, 3) | ++---------------------------+---------------------------------------------+ +| %disp12 0:s1 1:1 2:10 | sextract(i, 0, 1) << 11 | | +| | extract(i, 1, 1) << 10 | | +| | extract(i, 2, 10) | ++---------------------------+---------------------------------------------+ +| %shimm8 5:s8 13:1 | expand_shimm8(sextract(i, 5, 8) << 1 | | +| !function=expand_shimm8 | extract(i, 13, 1)) | ++---------------------------+---------------------------------------------+ + +Argument Sets +============= + +Syntax:: + + args_def := '&' identifier ( args_elt )+ ( !extern )? + args_elt := identifier + +Each *args_elt* defines an argument within the argument set. +Each argument set will be rendered as a C structure "arg_$name" +with each of the fields being one of the member arguments. + +If ``!extern`` is specified, the backing structure is assumed +to have been already declared, typically via a second decoder. + +Argument set examples:: + + ®3 ra rb rc + &loadstore reg base offset + + +Formats +======= + +Syntax:: + + fmt_def := '@' identifier ( fmt_elt )+ + fmt_elt := fixedbit_elt | field_elt | field_ref | args_ref + fixedbit_elt := [01.-]+ + field_elt := identifier ':' 's'? number + field_ref := '%' identifier | identifier '=' '%' identifier + args_ref := '&' identifier + +Defining a format is a handy way to avoid replicating groups of fields +across many instruction patterns. + +A *fixedbit_elt* describes a contiguous sequence of bits that must +be 1, 0, or don't care. The difference between '.' and '-' +is that '.' means that the bit will be covered with a field or a +final 0 or 1 from the pattern, and '-' means that the bit is really +ignored by the cpu and will not be specified. + +A *field_elt* describes a simple field only given a width; the position of +the field is implied by its position with respect to other *fixedbit_elt* +and *field_elt*. + +If any *fixedbit_elt* or *field_elt* appear, then all bits must be defined. +Padding with a *fixedbit_elt* of all '.' is an easy way to accomplish that. + +A *field_ref* incorporates a field by reference. This is the only way to +add a complex field to a format. A field may be renamed in the process +via assignment to another identifier. This is intended to allow the +same argument set be used with disjoint named fields. + +A single *args_ref* may specify an argument set to use for the format. +The set of fields in the format must be a subset of the arguments in +the argument set. If an argument set is not specified, one will be +inferred from the set of fields. + +It is recommended, but not required, that all *field_ref* and *args_ref* +appear at the end of the line, not interleaving with *fixedbit_elf* or +*field_elt*. + +Format examples:: + + @opr ...... ra:5 rb:5 ... 0 ....... rc:5 + @opi ...... ra:5 lit:8 1 ....... rc:5 + +Patterns +======== + +Syntax:: + + pat_def := identifier ( pat_elt )+ + pat_elt := fixedbit_elt | field_elt | field_ref | args_ref | fmt_ref | const_elt + fmt_ref := '@' identifier + const_elt := identifier '=' number + +The *fixedbit_elt* and *field_elt* specifiers are unchanged from formats. +A pattern that does not specify a named format will have one inferred +from a referenced argument set (if present) and the set of fields. + +A *const_elt* allows a argument to be set to a constant value. This may +come in handy when fields overlap between patterns and one has to +include the values in the *fixedbit_elt* instead. + +The decoder will call a translator function for each pattern matched. + +Pattern examples:: + + addl_r 010000 ..... ..... .... 0000000 ..... @opr + addl_i 010000 ..... ..... .... 0000000 ..... @opi + +which will, in part, invoke:: + + trans_addl_r(ctx, &arg_opr, insn) + +and:: + + trans_addl_i(ctx, &arg_opi, insn) diff --git a/docs/devel/index.rst b/docs/devel/index.rst index 6b11e49caa..ebbab636ce 100644 --- a/docs/devel/index.rst +++ b/docs/devel/index.rst @@ -19,4 +19,4 @@ Contents: migration stable-process testing - + decodetree diff --git a/scripts/decodetree.py b/scripts/decodetree.py index e342d278b8..33e32ee87f 100755 --- a/scripts/decodetree.py +++ b/scripts/decodetree.py @@ -17,139 +17,7 @@ # # Generate a decoding tree from a specification file. -# -# The tree is built from instruction "patterns". A pattern may represent -# a single architectural instruction or a group of same, depending on what -# is convenient for further processing. -# -# Each pattern has "fixedbits" & "fixedmask", the combination of which -# describes the condition under which the pattern is matched: -# -# (insn & fixedmask) == fixedbits -# -# Each pattern may have "fields", which are extracted from the insn and -# passed along to the translator. Examples of such are registers, -# immediates, and sub-opcodes. -# -# In support of patterns, one may declare fields, argument sets, and -# formats, each of which may be re-used to simplify further definitions. -# -# *** Field syntax: -# -# field_def := '%' identifier ( unnamed_field )+ ( !function=identifier )? -# unnamed_field := number ':' ( 's' ) number -# -# For unnamed_field, the first number is the least-significant bit position of -# the field and the second number is the length of the field. If the 's' is -# present, the field is considered signed. If multiple unnamed_fields are -# present, they are concatenated. In this way one can define disjoint fields. -# -# If !function is specified, the concatenated result is passed through the -# named function, taking and returning an integral value. -# -# FIXME: the fields of the structure into which this result will be stored -# is restricted to "int". Which means that we cannot expand 64-bit items. -# -# Field examples: -# -# %disp 0:s16 -- sextract(i, 0, 16) -# %imm9 16:6 10:3 -- extract(i, 16, 6) << 3 | extract(i, 10, 3) -# %disp12 0:s1 1:1 2:10 -- sextract(i, 0, 1) << 11 -# | extract(i, 1, 1) << 10 -# | extract(i, 2, 10) -# %shimm8 5:s8 13:1 !function=expand_shimm8 -# -- expand_shimm8(sextract(i, 5, 8) << 1 -# | extract(i, 13, 1)) -# -# *** Argument set syntax: -# -# args_def := '&' identifier ( args_elt )+ ( !extern )? -# args_elt := identifier -# -# Each args_elt defines an argument within the argument set. -# Each argument set will be rendered as a C structure "arg_$name" -# with each of the fields being one of the member arguments. -# -# If !extern is specified, the backing structure is assumed to -# have been already declared, typically via a second decoder. -# -# Argument set examples: -# -# ®3 ra rb rc -# &loadstore reg base offset -# -# *** Format syntax: -# -# fmt_def := '@' identifier ( fmt_elt )+ -# fmt_elt := fixedbit_elt | field_elt | field_ref | args_ref -# fixedbit_elt := [01.-]+ -# field_elt := identifier ':' 's'? number -# field_ref := '%' identifier | identifier '=' '%' identifier -# args_ref := '&' identifier -# -# Defining a format is a handy way to avoid replicating groups of fields -# across many instruction patterns. -# -# A fixedbit_elt describes a contiguous sequence of bits that must -# be 1, 0, [.-] for don't care. The difference between '.' and '-' -# is that '.' means that the bit will be covered with a field or a -# final [01] from the pattern, and '-' means that the bit is really -# ignored by the cpu and will not be specified. -# -# A field_elt describes a simple field only given a width; the position of -# the field is implied by its position with respect to other fixedbit_elt -# and field_elt. -# -# If any fixedbit_elt or field_elt appear then all bits must be defined. -# Padding with a fixedbit_elt of all '.' is an easy way to accomplish that. -# -# A field_ref incorporates a field by reference. This is the only way to -# add a complex field to a format. A field may be renamed in the process -# via assignment to another identifier. This is intended to allow the -# same argument set be used with disjoint named fields. -# -# A single args_ref may specify an argument set to use for the format. -# The set of fields in the format must be a subset of the arguments in -# the argument set. If an argument set is not specified, one will be -# inferred from the set of fields. -# -# It is recommended, but not required, that all field_ref and args_ref -# appear at the end of the line, not interleaving with fixedbit_elf or -# field_elt. -# -# Format examples: -# -# @opr ...... ra:5 rb:5 ... 0 ....... rc:5 -# @opi ...... ra:5 lit:8 1 ....... rc:5 -# -# *** Pattern syntax: -# -# pat_def := identifier ( pat_elt )+ -# pat_elt := fixedbit_elt | field_elt | field_ref -# | args_ref | fmt_ref | const_elt -# fmt_ref := '@' identifier -# const_elt := identifier '=' number -# -# The fixedbit_elt and field_elt specifiers are unchanged from formats. -# A pattern that does not specify a named format will have one inferred -# from a referenced argument set (if present) and the set of fields. -# -# A const_elt allows a argument to be set to a constant value. This may -# come in handy when fields overlap between patterns and one has to -# include the values in the fixedbit_elt instead. -# -# The decoder will call a translator function for each pattern matched. -# -# Pattern examples: -# -# addl_r 010000 ..... ..... .... 0000000 ..... @opr -# addl_i 010000 ..... ..... .... 0000000 ..... @opi -# -# which will, in part, invoke -# -# trans_addl_r(ctx, &arg_opr, insn) -# and -# trans_addl_i(ctx, &arg_opi, insn) +# See the syntax and semantics in docs/devel/decodetree.rst. # import os From patchwork Tue Mar 12 17:03:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 160175 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp13413231jad; Tue, 12 Mar 2019 11:16:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqyz648+PWrTB0p7VNgOS+Tc+/MJdrAdRf/InyofnioVXwJGUQREnlICkf65DagD5cmSaBvH X-Received: by 2002:a25:750b:: with SMTP id q11mr32095381ybc.195.1552414590176; Tue, 12 Mar 2019 11:16:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552414590; cv=none; d=google.com; s=arc-20160816; b=MzizqsvCkjNbdr0XVJGCSTNNsGK/BfdR7r4y024RToBWabqX4qY4dz6jupi5IOAmlK cTv9CDaQMosNoWlj8rplbczVP5yVyC1efhqvI7ZVVye4QJe3PwedT0uI3fWpqcXczFVD x2RnuuE1+fW+X0WokdlAjWTAaAocJOrOK/ca79nNTmQxwEK1ZTq6Ts0MW2fZ7IKeTlUx XG7/F2TwvLlRaAV1F1adIlGEBT4TmhyW9a5Mzb7Lxh2UCm0YDTf81zFI3rvyPLrZO92f UkUEh5UE5q2U8ixzPWl1UdA0YVM+V6Ua3rjyXcVcZdaSJLf97zZuLvg0lslO4EEEGLcM 3F6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=2rJysuN4kOcM861oITn+8gqeEuwCTb6zNf90hFLC10A=; b=Hs0Qr6NmTCEpZxYJbAcYtdqOBrrjAxHoS0pdU5XG1uYWCtnC/h8QUwiueKE6JLKQEm ocPKFjSh93pr62fKIAXS0Y9IvvcuWQ4yYmtYHrmQoxMhazSPZ4KP9Q6v+knscpnOPPTE a0JM/6hLjnHdub+4CmFoYNs1UZCIMi0ZWcHYO/9pnHtKK46PHzqOWEz2tLwuUJdlK+VE +UO3n3w7JXMUcsDiEF4m0G+2w+Z4Yw7d2UMI3KE4wHJXtMrmvPriBos40OE3x2I5NdKf fVqDara0f2PYmFNkoihtohc49Es7Qs+i61ASdKGhuATtI4puJY9hf8BphH1i24mk444B yCCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="P0/WRJYE"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id k4si5494155ywk.160.2019.03.12.11.16.30 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 12 Mar 2019 11:16:30 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="P0/WRJYE"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:57181 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3lwz-0005WE-IQ for patch@linaro.org; Tue, 12 Mar 2019 14:16:29 -0400 Received: from eggs.gnu.org ([209.51.188.92]:50688) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3l3O-0005OA-Q0 for qemu-devel@nongnu.org; Tue, 12 Mar 2019 13:19:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3koX-00019J-Tc for qemu-devel@nongnu.org; Tue, 12 Mar 2019 13:03:42 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]:44044) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h3koX-00018d-Kk for qemu-devel@nongnu.org; Tue, 12 Mar 2019 13:03:41 -0400 Received: by mail-pf1-x431.google.com with SMTP id a3so2248936pff.11 for ; Tue, 12 Mar 2019 10:03:41 -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=2rJysuN4kOcM861oITn+8gqeEuwCTb6zNf90hFLC10A=; b=P0/WRJYEhx5kprOn9I19vl7u+Ulwf9EnDATaTZKr6L57d4f5qxYOfPV+I5imE5B3/j viUAQhGzb0BBSEQdM8ukUoAcsSHlDyiCWdxEQiJGPwxAKJD9+7UPIzZAdRCwBRBTdKU/ 1BllBy1a6RLDVSuw/Oy20xW69MDpLpbdRZ/GFuAf0JBrkVAHt8+PUI3gQ73Dp3iLloii BQvd0PsClS1/gufx4xMLp35EcRZ9+7vYkraxK/M6v4x6b7Eh+p65VcpRnWalkgBkC7hS wi9IEhf6dX8v126jq/w9HZGs+S+0V0KlA2cxJg3x9UwUzcpFDJmnR1FLTRw2ExlM2fPZ 4rEQ== 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=2rJysuN4kOcM861oITn+8gqeEuwCTb6zNf90hFLC10A=; b=P499Kjfc2npcWu1hqQ6vjZo/OBRV0msQi2Vj6qTlI2Y1FdC8LVxyCFMb/dCeVntK2I Pl9yeSpPbNikWGLLeiaGc96AM9an+ebTobiXb3x0k2GosMKo6uguwm9g9jAVDayC7Ctp der+dafPwbs4XKzqgStPsS2XK3psBAnIf6jxn1jWCXw8rn3N4ruYYo82p+mcBOWSe/gQ h+yi9YAtNpUDUBe9TTtTWMHmqq6klRcAGU6VEDr6oGq2OdLfdx6Tqd5O8w745OAB/a31 BQwIWT1FwQT7FS/VD1lxxxlLJujhEV8QAYcZA3QuqSDl2y8te6L1YfjqBMqJhgUW82nI Ftng== X-Gm-Message-State: APjAAAUfoubNuzDBWjYrBJCBGiKqJAnsKedyH0/NS1B8+c+2B9EzNH5/ 48pYlO+lQn0u748+ME3EsE9BuEWHEKY= X-Received: by 2002:a62:ee0e:: with SMTP id e14mr39749171pfi.201.1552410220161; Tue, 12 Mar 2019 10:03:40 -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 v22sm17514265pfa.49.2019.03.12.10.03.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Mar 2019 10:03:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 12 Mar 2019 10:03:25 -0700 Message-Id: <20190312170334.14005-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190312170334.14005-1-richard.henderson@linaro.org> References: <20190312170334.14005-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::431 Subject: [Qemu-devel] [PULL 03/12] decodetree: Document the usefulness of argument sets 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: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Bastian Koppelmann Signed-off-by: Richard Henderson --- docs/devel/decodetree.rst | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.17.2 diff --git a/docs/devel/decodetree.rst b/docs/devel/decodetree.rst index d9be30b2db..62cb7f687c 100644 --- a/docs/devel/decodetree.rst +++ b/docs/devel/decodetree.rst @@ -69,6 +69,13 @@ with each of the fields being one of the member arguments. If ``!extern`` is specified, the backing structure is assumed to have been already declared, typically via a second decoder. +Argument sets are useful when one wants to define helper functions +for the translator functions that can perform operations on a common +set of arguments. This can ensure, for instance, that the ``AND`` +pattern and the ``OR`` pattern put their operands into the same named +structure, so that a common ``gen_logic_insn`` may be able to handle +the operations common between the two. + Argument set examples:: ®3 ra rb rc From patchwork Tue Mar 12 17:03:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 160173 Delivered-To: patch@linaro.org Received: by 2002:ac9:18c7:0:0:0:0:0 with SMTP id i7csp13254210oce; Tue, 12 Mar 2019 11:10:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqwa8ln2mh8FG6izZsMMb5UvQd0KaZAEP18V4pAHnQusX4HS0ndVrN8a6o138bwxWJk/Xl9J X-Received: by 2002:a25:8106:: with SMTP id o6mr31498344ybk.53.1552414203152; Tue, 12 Mar 2019 11:10:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552414203; cv=none; d=google.com; s=arc-20160816; b=ntI7M1qIouLqNkS+zIgXKs1xWQqgBhxskO/89U9L3suQP4PCtpGXLAgKi1+9dRGKI5 dw9S7Mr4rfpaa/pDIq3oUBC9ive1XHW6iPS75bmpPT6LyfLBTksA+340g5k49T9AJIX9 Rs/iz0MYxjBs5iqiaDjd1qNwOewj2nOrvlIWFlcH4JpcSDQPtohNoVhBITs2ZkP3CoQZ gADIFF5tiAXF2X84e4SDpuspkIStcBAhGsumfrXfbFuxrA/0tn3OJB+Ukyhq6tbeNXpg jvg2CyyawMg9hIpws3oVNgUdwLtXxFAcWAgzxlU9IuRAaIF4xwUqiHPVM1GKfyzeaztv rjog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=dJ9V0cdUMTbTLS+jTfS4ibWwVyEFxtj+1fJtRE1MNSo=; b=Va6jhiuUwTtqrPxp0iGzhfDgUXBOzzRJ0Ci0VANa/gikqQnlGQ8GacgkJKr1kM8B77 W9561ac4Rca+pGWsr40THVzFj5/lOvT/JqH4+KDLTzxCALoVtRSjfz3BNNykoH95CpZX IR5kwIHnk3DgbstIPOYDljAEFzZEvpZFHa8nuLHLgRxUTpR4NI0liB6qizJYQXxA9Gn3 7X+bFAU8B4wyEiSmd4Mu/rU3fckN98ZWUTBS+TV1mLglq5vZJj78vLcSt+auuH5Dt8Ai RQR6I4I0o3m/geiJ0vsddWB7FwMkXUH3The4D8889GEpcQcHMA/gjcbpNQxLSUN20lWe 5Lrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=eKzocNzO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b134si5261715yba.51.2019.03.12.11.10.03 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 12 Mar 2019 11:10:03 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=eKzocNzO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:57041 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3lqk-0007Om-JO for patch@linaro.org; Tue, 12 Mar 2019 14:10:02 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51871) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3l3N-0006Iy-9R for qemu-devel@nongnu.org; Tue, 12 Mar 2019 13:19:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3koa-0001BD-H5 for qemu-devel@nongnu.org; Tue, 12 Mar 2019 13:03:45 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]:42551) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h3koa-0001Ah-9Z for qemu-devel@nongnu.org; Tue, 12 Mar 2019 13:03:44 -0400 Received: by mail-pf1-x42c.google.com with SMTP id n74so2251745pfi.9 for ; Tue, 12 Mar 2019 10:03:44 -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 :mime-version:content-transfer-encoding; bh=dJ9V0cdUMTbTLS+jTfS4ibWwVyEFxtj+1fJtRE1MNSo=; b=eKzocNzOnmi0zgTPOFgvCw6fVgbHCnHfkc/dC/f++AyRb7Q7Vx3M1jj1s6Pp2tMiF2 iybNRqafdsIJuU7LLHrEdlpKuD9CcVfMW+Pv/McsmwIRRQn0YiaKEM4rChXa1d/9DD29 nius7+3DfzLwBluNNkFVfX55l5D2Tc9dbMErHYWLyqcetpbvbPTQrbGCJ3iBpTnLcC+s OxIxHpPm4+YfA6qlmBThKqZbJDiRYBCcJ9ZpTWpBeFhUIdyM/qKLqacKl/GoRVabOLwL u+PkKScvgaNjYsbmlW3vFRhLuyXg/ubdH+luPDdvVOTOBik0A/0w9a7ASJijCNQ5UzZO +Qmg== 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:mime-version:content-transfer-encoding; bh=dJ9V0cdUMTbTLS+jTfS4ibWwVyEFxtj+1fJtRE1MNSo=; b=bru9GO8fKvMR7CyOdumemSC2+4xrnsfLvM1bhUhzC93Xs1mdI8mECK/Dk6Ii2nRaQx kLPghm0sYFyS+kAWfuaC6hULckU7pe5moMuse5Pv0kQfw5OjVIow12WPM2CqCRRrwCGC gLyd8cYdRK75c6mrCyAKKjFF4IS1AC20clQgloqRiHhK/rAGULviRrjYs+o0WIQ2842m jytS5rX9np2DiqIJ3LhQ8kR87Wz5IxngzRF6PCGwFZ2F3HI5tykbAzxcFHggMjSg9KHQ aXIRVs2UhIieBOb7okN59vMWzKKMtN563W/TWaV/8C8YXXFsKYi8hkpSAD9Q55uGsKdE GJDg== X-Gm-Message-State: APjAAAUaXHUnjjsJaI4j9QQS0s+HZTEJErPE0EC1HnnL9bk2kgZ1kApR mX+mFNIS+8JPuDSyK32Pe1ar/N7RlkQ= X-Received: by 2002:a17:902:6f08:: with SMTP id w8mr41112739plk.5.1552410221751; Tue, 12 Mar 2019 10:03: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 v22sm17514265pfa.49.2019.03.12.10.03.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Mar 2019 10:03:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 12 Mar 2019 10:03:26 -0700 Message-Id: <20190312170334.14005-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190312170334.14005-1-richard.henderson@linaro.org> References: <20190312170334.14005-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::42c Subject: [Qemu-devel] [PULL 04/12] decodetree: Ensure build_tree does not include values outside insnmask 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: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Reproduced with "scripts/decodetree.py /dev/null". Reviewed-by: Bastian Koppelmann Reviewed-by: Eduardo Habkost Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- scripts/decodetree.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.17.2 diff --git a/scripts/decodetree.py b/scripts/decodetree.py index 33e32ee87f..e26d8253f2 100755 --- a/scripts/decodetree.py +++ b/scripts/decodetree.py @@ -784,7 +784,7 @@ class Tree: def build_tree(pats, outerbits, outermask): # Find the intersection of all remaining fixedmask. - innermask = ~outermask + innermask = ~outermask & insnmask for i in pats: innermask &= i.fixedmask From patchwork Tue Mar 12 17:03:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 160167 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp13392561jad; Tue, 12 Mar 2019 10:57:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqzsK+KNQkWhlHpJAuxycNFeaktfAVgy7RbxPUa4wbkcCeT5i3UtBCJBEfbIbQZQJ0xEe6P0 X-Received: by 2002:a81:2556:: with SMTP id l83mr30629878ywl.290.1552413439966; Tue, 12 Mar 2019 10:57:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552413439; cv=none; d=google.com; s=arc-20160816; b=NAZ9GKxGl7xWJpyN4Mi6YkYUNMu0lhlbGWOfefjGX9S2l3mVfdP9sx1Hh0tLXb7+B2 XMhhiV//6Lrg22yjvcGz2KS75U4szuui/gUr6jMFn3vh7WbUT1T/C1cKmIQMX5iE5cqV Y86IRa/FYtfrMCZ+ci4tHTqaVwnX/eKWghxjV73TIWjFS3Wrd5jzEWeuyc/xWLdfi1zZ Xi1DO9x5qo7ya4lfP7erkATogSMl6+z10TfHBLZNfa9BDeADnWc63HjEMqg0kkwmJQCL PW0/l35wzb33Sx5GBgBixDVgkqe/Z9Y02Hg5NNPGUHSYxqg3mcMHQ8aSjCZMGQX4JJAw 8ycA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=q7BmrH4sjrNhoBHqeKigtEhx9qwjct0IB15Jx7wduro=; b=yKAECkRmtGkJAWTrgKuFrIYzdm4c1iHGsWFbFEtDeHNo218EfGirOqZz2kbLfyn7Em s77Y8rOlNDnowwxHDZ9RZTA815VM3u2Hie/gzqczsY9KVAUlg/iEEqCHgMvDcVNQe+k7 tqVyaZJPhGLZk5x5IlGvBV66U3B3yiAhDFWV6tzuWa7WRLUhadRSDL9pAZOk9PpA/tFk 1aclSAduEFCAbImdGQiALEM95jtylNqFrdzN1MqyDnKQ1lzL0uf1IH8vuIOMpV2bgvDt OgMeKTG54wX9IF8dxsJNv1gAQzvgNI6KW8v0yodFFerQEOIyGB9LJvVUeZ9901o4+vF8 ZK9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=E9O8eM8P; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 65si5258664ybz.279.2019.03.12.10.57.19 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 12 Mar 2019 10:57:19 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=E9O8eM8P; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:56835 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3leR-00067N-F8 for patch@linaro.org; Tue, 12 Mar 2019 13:57:19 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51483) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3l3N-0005yw-8W for qemu-devel@nongnu.org; Tue, 12 Mar 2019 13:19:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3koa-0001Bc-TQ for qemu-devel@nongnu.org; Tue, 12 Mar 2019 13:03:45 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]:43412) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h3koa-0001At-Ks for qemu-devel@nongnu.org; Tue, 12 Mar 2019 13:03:44 -0400 Received: by mail-pf1-x42b.google.com with SMTP id q17so2254448pfh.10 for ; Tue, 12 Mar 2019 10:03:44 -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 :mime-version:content-transfer-encoding; bh=q7BmrH4sjrNhoBHqeKigtEhx9qwjct0IB15Jx7wduro=; b=E9O8eM8PfIhA+E3vn/WkAVuQUMzX47SPjmcwVyTqBmKAcopmhUDDpN3qsGuK9Q82+x chegLU1RnV3z+L8V/rW9JDAOvnYH9uIrN1Kms+RTa8HNaIzsjUd1Daj/Eu6Yo0emV6Si IWt9gzqY+M1BWHJTyZxBeDVCtdSrogXh7pnNfyDlteMCSQancEYg+bhR7MEMUI2uRF5z jVue087v9Gv93lbXBbLBqSWC2GwNDprGO+88KhPXInjXZBWCd1ui1kuEN9SFg4Zaqejl xRZSPEF+lyvfCWBhcIPpezKCBhSkX6WZHQvCefIDxT3sNzKcm+dUTB1tsdtO08IOjGw7 76jg== 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:mime-version:content-transfer-encoding; bh=q7BmrH4sjrNhoBHqeKigtEhx9qwjct0IB15Jx7wduro=; b=A6d8Hq+0Opum3UqC2NzOmQrO3UvN/OSaXxEIJhhly9cLmOREsV/9ZNRP1IEGofxRFC fWCB3Q/sgxMb0jeTL15QuUBRdPOoqPodBSjfJgwN4bkZFgSUBiyWmGRnmSUtMuFrrUXf 03STbf2zWS6fd7g9YQggcBMBCeUDq16G97PXdCviq+MU3HZUAEjy/eQKSL0AD5H2DeeU jwyG4Lhyeryxj9pM9BK/Rr+VmhBLJOeJDjfa/tg8iY6CCJFYqeq9KykK/85tXGE2mswo Ip6QHN6EZESCDmR/PW36i9PWgKZHvgU9F5gQl3oCaB/bxxAFOPrSmP3ZmqaK4Nq/d317 6VBg== X-Gm-Message-State: APjAAAXJRf1g9Zz0xFesFljUifDWi+Ac4+6WPdfkAMj7HObr5FesoqIC YUj1dMIE3WuL7rHCP6x2OHNpyAQP4bE= X-Received: by 2002:a17:902:7896:: with SMTP id q22mr2936855pll.66.1552410223228; Tue, 12 Mar 2019 10:03:43 -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 v22sm17514265pfa.49.2019.03.12.10.03.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Mar 2019 10:03:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 12 Mar 2019 10:03:27 -0700 Message-Id: <20190312170334.14005-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190312170334.14005-1-richard.henderson@linaro.org> References: <20190312170334.14005-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::42b Subject: [Qemu-devel] [PULL 05/12] decodetree: Do not unconditionaly return from Pattern.output_code 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: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" As a consequence, the 'return false' gets pushed up one level. This will allow us to perform some other action when the translator returns failure. Tested-by: Philippe Mathieu-Daudé Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Bastian Koppelmann Signed-off-by: Richard Henderson --- scripts/decodetree.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) -- 2.17.2 diff --git a/scripts/decodetree.py b/scripts/decodetree.py index e26d8253f2..cc5fa1a8ab 100755 --- a/scripts/decodetree.py +++ b/scripts/decodetree.py @@ -348,8 +348,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, ' = ', f.str_extract(), ';\n') - output(ind, 'return ', translate_prefix, '_', self.name, - '(ctx, &u.f_', arg, ');\n') + output(ind, 'if (', translate_prefix, '_', self.name, + '(ctx, &u.f_', arg, ')) return true;\n') # end Pattern @@ -777,8 +777,8 @@ class Tree: output(ind, ' /* ', str_match_bits(innerbits, innermask), ' */\n') s.output_code(i + 4, extracted, innerbits, innermask) + output(ind, ' return false;\n') output(ind, '}\n') - output(ind, 'return false;\n') # end Tree @@ -932,6 +932,7 @@ def main(): output(i4, '} u;\n\n') t.output_code(4, False, 0, 0) + output(i4, 'return false;\n') output('}\n') From patchwork Tue Mar 12 17:03:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 160174 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp13409378jad; Tue, 12 Mar 2019 11:12:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqyaF1C+R1vNdAj1fxvCJtqYogU6Zo1rmHyr2p8GWRXhuyg4buZIRWEw+oBqwwpITq1d2+g4 X-Received: by 2002:a25:23d8:: with SMTP id j207mr32909066ybj.0.1552414374099; Tue, 12 Mar 2019 11:12:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552414374; cv=none; d=google.com; s=arc-20160816; b=umUUYUbhxEuwZqOrpr0chgnYiibyL04FTlzIWUPZ0Tf8qH25cGncElUAjkgJO3Wb7b FPtvXCaspiUJPAOoMHh46iP1M7hXakBqTUz62mTWnaLd43F224Siq5qVyDRXmeMFuBUV SJduV6MHMHrS9zjcmXSS+l7/yx9VESFbR/zHBR73W2kN2I9FGmRCdSvX9sJtv8juC+5V 4Z5qsOeuBUKZz9oLhQv5OXKsnjaTuxQh8NvCD8EZ/++rA3AgbW9eGqXzJdsymnzfYoZ4 mrVhf83hylAsxLGRGk/OEPSdhPeql/iiXehe1dWpjys2cscAZ59gm8YPYmRkEUOkLfvc AB4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=mQxe/h092OHgR+JCDknw6TQ1AQPxGRDcZ6ug5Wf5Zxc=; b=LX+7ztQSA347Ul2YDGUH+tykTGWguH/82PGhhYOK0V9AxYrvKxlxkOtXJapMONp/CW 1Cnus7l6BznNeq69zP9N+qIDiCundc3Ax1DxHdUmeVfJ4F8duQVjr8iYJsAaNAN3iw+n Lvvh9Op47CX1xCrimnuk0kWd838lMgkffaUG1NjQtXgxvg8RUgOtjs8BLsWtsLt0P09z xFuMukW5jJkIF4SV90O9EpzkW5xDTCA8L27u2M68XIsAIqCEi5LJAIkoTHdUu7ZTPOQa gtmYXwEquWJIfmb5R/bcuOJe+lxXoGLBgQELx7TIdglL847F17646XHUfzYwwc9Tm4iA o0Kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="W/+oQRYM"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id k2si1282563ybm.133.2019.03.12.11.12.53 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 12 Mar 2019 11:12:54 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="W/+oQRYM"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:57097 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3ltV-0001ba-FW for patch@linaro.org; Tue, 12 Mar 2019 14:12:53 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51668) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3l3N-00066w-7h for qemu-devel@nongnu.org; Tue, 12 Mar 2019 13:19:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3kod-0001D6-1w for qemu-devel@nongnu.org; Tue, 12 Mar 2019 13:03:48 -0400 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]:35644) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h3koc-0001CM-IY for qemu-devel@nongnu.org; Tue, 12 Mar 2019 13:03:46 -0400 Received: by mail-pg1-x530.google.com with SMTP id e17so2304306pgd.2 for ; Tue, 12 Mar 2019 10:03:46 -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=mQxe/h092OHgR+JCDknw6TQ1AQPxGRDcZ6ug5Wf5Zxc=; b=W/+oQRYM/70RNkzkBzLY5Y8QAElZxMfdnI1tNCjrQx1ii2yVDWEKy0BFBGOmSkt0nu ZsgJivKkgtrl4VFWKiAcVbyiCnBXvTjYckLFwRIJdJqKsvAI0P9dwMy2NCIVZQhiApIw 65DxLDykbwbVWoKKPNP2aeD9Ma5dAtN6Xc07AgU3ADkniGT0TTg/KFWnEFHYxsKoNLLI 6tkTNuyTTNLXoSvncWuMbg1tbMkx/NHzLlgagPwHB87K3otlcj7Hh1WvhT07uBBcN6vY f87jV61dV0fHlKZzh0YDbOApoBFqV54Dre2P5J22Qr7ec/3HajW5IRw6IuoVAlaTNq8K 8IQA== 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=mQxe/h092OHgR+JCDknw6TQ1AQPxGRDcZ6ug5Wf5Zxc=; b=V9JIr1gGn9fREF0b5arBEq5NSRELqKFOhMb3gcG+mQDgbxiHqPAIo9xRdQuzJ0GkTE ZzklnfaXoSDjLCEEpMrnyJpqW5I5qKHfR+g83aXuJJVc0VwBqqvSO1gtka+yU0rYP4em /bH0EQ/A7MRDyVxO4LevW3CFWiS9oGhx78HIBwD6ifkqlHXXiG6ICrahbov8H57+iM7h BtdLa/gnHD0gtbmq0RoP6me6RtpBavWrTYiisnOq6uU6V8UZS1FhQy7rtaG4FtLpaRi1 9CCQn5PeCnqCEa6Ehc82lWdjY1WsYIITjpFo913AT+O3m1EkjDwGqgJwxsR4NNOn2OEl 3UGQ== X-Gm-Message-State: APjAAAW/3pdKWckHcoJeP9hdHcG58Km/Lu1LKVjZjHvLU+Me1latwuzs MqxLL6ln7q+/mq3yhuSbNF7EieSj1G0= X-Received: by 2002:a17:902:42:: with SMTP id 60mr35423213pla.132.1552410225063; Tue, 12 Mar 2019 10:03:45 -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 v22sm17514265pfa.49.2019.03.12.10.03.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Mar 2019 10:03:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 12 Mar 2019 10:03:28 -0700 Message-Id: <20190312170334.14005-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190312170334.14005-1-richard.henderson@linaro.org> References: <20190312170334.14005-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::530 Subject: [Qemu-devel] [PULL 06/12] decodetree: Allow grouping of overlapping patterns 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: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- docs/devel/decodetree.rst | 58 ++++++ scripts/decodetree.py | 165 +++++++++++++++--- .../decode/err_pattern_group_overlap1.decode | 6 + 3 files changed, 207 insertions(+), 22 deletions(-) create mode 100644 tests/decode/err_pattern_group_overlap1.decode -- 2.17.2 diff --git a/docs/devel/decodetree.rst b/docs/devel/decodetree.rst index 62cb7f687c..44ac621ea8 100644 --- a/docs/devel/decodetree.rst +++ b/docs/devel/decodetree.rst @@ -161,3 +161,61 @@ which will, in part, invoke:: and:: trans_addl_i(ctx, &arg_opi, insn) + +Pattern Groups +============== + +Syntax:: + + group := '{' ( pat_def | group )+ '}' + +A *group* begins with a lone open-brace, with all subsequent lines +indented two spaces, and ending with a lone close-brace. Groups +may be nested, increasing the required indentation of the lines +within the nested group to two spaces per nesting level. + +Unlike ungrouped patterns, grouped patterns are allowed to overlap. +Conflicts are resolved by selecting the patterns in order. If all +of the fixedbits for a pattern match, its translate function will +be called. If the translate function returns false, then subsequent +patterns within the group will be matched. + +The following example from PA-RISC shows specialization of the *or* +instruction:: + + { + { + nop 000010 ----- ----- 0000 001001 0 00000 + copy 000010 00000 r1:5 0000 001001 0 rt:5 + } + or 000010 rt2:5 r1:5 cf:4 001001 0 rt:5 + } + +When the *cf* field is zero, the instruction has no side effects, +and may be specialized. When the *rt* field is zero, the output +is discarded and so the instruction has no effect. When the *rt2* +field is zero, the operation is ``reg[rt] | 0`` and so encodes +the canonical register copy operation. + +The output from the generator might look like:: + + switch (insn & 0xfc000fe0) { + case 0x08000240: + /* 000010.. ........ ....0010 010..... */ + if ((insn & 0x0000f000) == 0x00000000) { + /* 000010.. ........ 00000010 010..... */ + if ((insn & 0x0000001f) == 0x00000000) { + /* 000010.. ........ 00000010 01000000 */ + extract_decode_Fmt_0(&u.f_decode0, insn); + if (trans_nop(ctx, &u.f_decode0)) return true; + } + if ((insn & 0x03e00000) == 0x00000000) { + /* 00001000 000..... 00000010 010..... */ + extract_decode_Fmt_1(&u.f_decode1, insn); + if (trans_copy(ctx, &u.f_decode1)) return true; + } + } + extract_decode_Fmt_2(&u.f_decode2, insn); + if (trans_or(ctx, &u.f_decode2)) return true; + return false; + } diff --git a/scripts/decodetree.py b/scripts/decodetree.py index cc5fa1a8ab..2711c6ca9e 100755 --- a/scripts/decodetree.py +++ b/scripts/decodetree.py @@ -31,6 +31,7 @@ fields = {} arguments = {} formats = {} patterns = [] +allpatterns = [] translate_prefix = 'trans' translate_scope = 'static ' @@ -300,13 +301,7 @@ class General: self.fields = flds def __str__(self): - r = self.name - if self.base: - r = r + ' ' + self.base.name - else: - r = r + ' ' + str(self.fields) - r = r + ' ' + str_match_bits(self.fixedbits, self.fixedmask) - return r + return self.name + ' ' + str_match_bits(self.fixedbits, self.fixedmask) def str1(self, i): return str_indent(i) + self.__str__() @@ -353,6 +348,47 @@ class Pattern(General): # end Pattern +class MultiPattern(General): + """Class representing an overlapping set of instruction patterns""" + + def __init__(self, lineno, pats, fixb, fixm, udfm): + self.file = input_file + self.lineno = lineno + self.pats = pats + self.base = None + self.fixedbits = fixb + self.fixedmask = fixm + self.undefmask = udfm + + def __str__(self): + r = "{" + for p in self.pats: + r = r + ' ' + str(p) + return r + "}" + + def output_decl(self): + for p in self.pats: + p.output_decl() + + def output_code(self, i, extracted, outerbits, outermask): + global translate_prefix + ind = str_indent(i) + for p in self.pats: + if outermask != p.fixedmask: + innermask = p.fixedmask & ~outermask + innerbits = p.fixedbits & ~outermask + output(ind, 'if ((insn & ', + '0x{0:08x}) == 0x{1:08x}'.format(innermask, innerbits), + ') {\n') + output(ind, ' /* ', + str_match_bits(p.fixedbits, p.fixedmask), ' */\n') + p.output_code(i + 4, extracted, p.fixedbits, p.fixedmask) + output(ind, '}\n') + else: + p.output_code(i, extracted, p.fixedbits, p.fixedmask) +#end MultiPattern + + def parse_field(lineno, name, toks): """Parse one instruction field from TOKS at LINENO""" global fields @@ -505,6 +541,7 @@ def parse_generic(lineno, is_format, name, toks): global arguments global formats global patterns + global allpatterns global re_ident global insnwidth global insnmask @@ -649,6 +686,7 @@ def parse_generic(lineno, is_format, name, toks): pat = Pattern(name, lineno, fmt, fixedbits, fixedmask, undefmask, fieldmask, flds) patterns.append(pat) + allpatterns.append(pat) # Validate the masks that we have assembled. if fieldmask & fixedmask: @@ -667,17 +705,66 @@ def parse_generic(lineno, is_format, name, toks): .format(allbits ^ insnmask)) # end parse_general +def build_multi_pattern(lineno, pats): + """Validate the Patterns going into a MultiPattern.""" + global patterns + global insnmask + + if len(pats) < 2: + error(lineno, 'less than two patterns within braces') + + fixedmask = insnmask + undefmask = insnmask + + # Collect fixed/undefmask for all of the children. + # Move the defining lineno back to that of the first child. + for p in pats: + fixedmask &= p.fixedmask + undefmask &= p.undefmask + if p.lineno < lineno: + lineno = p.lineno + + repeat = True + while repeat: + if fixedmask == 0: + error(lineno, 'no overlap in patterns within braces') + fixedbits = None + for p in pats: + thisbits = p.fixedbits & fixedmask + if fixedbits is None: + fixedbits = thisbits + elif fixedbits != thisbits: + fixedmask &= ~(fixedbits ^ thisbits) + break + else: + repeat = False + + mp = MultiPattern(lineno, pats, fixedbits, fixedmask, undefmask) + patterns.append(mp) +# end build_multi_pattern def parse_file(f): """Parse all of the patterns within a file""" + global patterns + # Read all of the lines of the file. Concatenate lines # ending in backslash; discard empty lines and comments. toks = [] lineno = 0 + nesting = 0 + saved_pats = [] + for line in f: lineno += 1 + # Expand and strip spaces, to find indent. + line = line.rstrip() + line = line.expandtabs() + len1 = len(line) + line = line.lstrip() + len2 = len(line) + # Discard comments end = line.find('#') if end >= 0: @@ -687,10 +774,18 @@ def parse_file(f): if len(toks) != 0: # Next line after continuation toks.extend(t) - elif len(t) == 0: - # Empty line - continue else: + # Allow completely blank lines. + if len1 == 0: + continue + indent = len1 - len2 + # Empty line due to comment. + if len(t) == 0: + # Indentation must be correct, even for comment lines. + if indent != nesting: + error(lineno, 'indentation ', indent, ' != ', nesting) + continue + start_lineno = lineno toks = t # Continuation? @@ -698,21 +793,47 @@ def parse_file(f): toks.pop() continue - if len(toks) < 2: - error(lineno, 'short line') - name = toks[0] del toks[0] + # End nesting? + if name == '}': + if nesting == 0: + error(start_lineno, 'mismatched close brace') + if len(toks) != 0: + error(start_lineno, 'extra tokens after close brace') + nesting -= 2 + if indent != nesting: + error(start_lineno, 'indentation ', indent, ' != ', nesting) + pats = patterns + patterns = saved_pats.pop() + build_multi_pattern(lineno, pats) + toks = [] + continue + + # Everything else should have current indentation. + if indent != nesting: + error(start_lineno, 'indentation ', indent, ' != ', nesting) + + # Start nesting? + if name == '{': + if len(toks) != 0: + error(start_lineno, 'extra tokens after open brace') + saved_pats.append(patterns) + patterns = [] + nesting += 2 + toks = [] + continue + # Determine the type of object needing to be parsed. if name[0] == '%': - parse_field(lineno, name[1:], toks) + parse_field(start_lineno, name[1:], toks) elif name[0] == '&': - parse_arguments(lineno, name[1:], toks) + parse_arguments(start_lineno, name[1:], toks) elif name[0] == '@': - parse_generic(lineno, True, name[1:], toks) + parse_generic(start_lineno, True, name[1:], toks) else: - parse_generic(lineno, False, name, toks) + parse_generic(start_lineno, False, name, toks) toks = [] # end parse_file @@ -789,11 +910,10 @@ def build_tree(pats, outerbits, outermask): innermask &= i.fixedmask if innermask == 0: - pnames = [] + text = 'overlapping patterns:' for p in pats: - pnames.append(p.name + ':' + p.file + ':' + str(p.lineno)) - error_with_file(pats[0].file, pats[0].lineno, - 'overlapping patterns:', pnames) + text += '\n' + p.file + ':' + str(p.lineno) + ': ' + str(p) + error_with_file(pats[0].file, pats[0].lineno, text) fullmask = outermask | innermask @@ -846,6 +966,7 @@ def main(): global arguments global formats global patterns + global allpatterns global translate_scope global translate_prefix global output_fd @@ -907,7 +1028,7 @@ def main(): # Make sure that the argument sets are the same, and declare the # function only once. out_pats = {} - for i in patterns: + for i in allpatterns: if i.name in out_pats: p = out_pats[i.name] if i.base.base != p.base.base: diff --git a/tests/decode/err_pattern_group_overlap1.decode b/tests/decode/err_pattern_group_overlap1.decode new file mode 100644 index 0000000000..ebe3030d26 --- /dev/null +++ b/tests/decode/err_pattern_group_overlap1.decode @@ -0,0 +1,6 @@ +one 00000000000000000000000000000000 +{ + two 0000000000000000000000000000000 s:1 + three 000000000000000000000000000000 s:1 0 +} + From patchwork Tue Mar 12 17:03:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 160169 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp13394476jad; Tue, 12 Mar 2019 10:59:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqzT0Ms/qoELp78B0qFyX5yn4SYdyPpCpZFRYyIc5q5VNoM9ZcCeYlkj6qBTPXxIZ5IQnVob X-Received: by 2002:a25:3d2:: with SMTP id 201mr28723278ybd.276.1552413563630; Tue, 12 Mar 2019 10:59:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552413563; cv=none; d=google.com; s=arc-20160816; b=B29IOdjg4YJ5vehAJO236xEK5nfdxcQn+lt9+TURmAapQ/p1+pgVZyjU5nRF5n9vSB I5klzlPKw2nHDuyLdon4QilpqBCydnmGiNgMuuZ8zZQiHe9mE8PFmqhAS+q8rIELjiK6 71PsIET9v752GNlWxMk9mih+RtzB17oJpXaLJM3Z71LtmfMmnTExESBJSiyrH+lqf+nZ 8Y5upz6xqWf9mg7/dXVIxC22CW3M1nDYy6sfjP+B3P7lgzdGwtyWRaICJV4/EEy7i83l Oa/6HBoNNSJydlbmY0syGnQ3DanKux9NNl977BbiyFZyZvw18qynV1JK5XpcdHv6jMJr V5/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=8ulPBZ7h8lwje33FAm/1yxM4mNmEPfuMt2JEIkVfEzs=; b=JjDNptqpetlSW0B6goBWjTM1lNiZ8s7Vh/bRpqnAbcf/Z+4gLZSM60W2G6NK3ysoEN WiU8EORazuohBSoUgEsHBcIRE3rFak+gVnIEdHtA2KMtjRgRjMXV0xlJXL2HFYx0ZUhM GTOGnjOu/wM5v6CY0ZhMGt4ABNdAtt2bQ/hsQqF96LIkSLMJ7hlGYC/I3VE9KAYMx/mN yxIuhSxdfor+kYcruyYRaj7VVzaYYbmqZWWpFaYvaq6QuMtgD4TRbj2U38QrOW9gqUz7 zOmMtZccNDqV+zJNncm2tKfW5ksqPjuhu7VIh2sa7chUt7USniKrkwS2E/scTOIbJpnk ziQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=KrGhuouC; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id z62si5333494ybb.428.2019.03.12.10.59.23 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 12 Mar 2019 10:59:23 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=KrGhuouC; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:56858 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3lgR-0007x7-4K for patch@linaro.org; Tue, 12 Mar 2019 13:59:23 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51578) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3l3N-000633-65 for qemu-devel@nongnu.org; Tue, 12 Mar 2019 13:19:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3koj-0001Hu-PD for qemu-devel@nongnu.org; Tue, 12 Mar 2019 13:03:58 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]:46303) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h3koe-0001DA-RL for qemu-devel@nongnu.org; Tue, 12 Mar 2019 13:03:49 -0400 Received: by mail-pf1-x430.google.com with SMTP id s23so2238446pfe.13 for ; Tue, 12 Mar 2019 10:03:47 -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=8ulPBZ7h8lwje33FAm/1yxM4mNmEPfuMt2JEIkVfEzs=; b=KrGhuouC1wk9YoflPvCezNeHMVj/Spq9J4DrWiBfARwf1tXRDLb/IOYpy/pd/KbICW W6Kdi89Cs0GD8WsjNeaVUtkMk0rCwkTd3k7K3WHKGynPLXAZSp1IsVYLu/SlkejBXWFm lFiIos5bnXbUYqJ1fT/1SbU2Qn3yAP3gkInKGIiC/Pa/yuHsHVol9GZkUzesD5QXDWch SJMWqmeZrShJaeFdGqIM6k1FHmHt/Ojy/0eWSM8G7lQZpGN5q51YZwaQ4VlGkcAiyntW 46rOCqoTQrxm+Nk0iwcehRxzNOgtqt9FIsE6BjVbdpcNwQ4gELd+OyUpeuauM4so/WV8 W7Eg== 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=8ulPBZ7h8lwje33FAm/1yxM4mNmEPfuMt2JEIkVfEzs=; b=A85At6WKwK9C975q0rYWOzyTEocq5e3P2Thvwgqh7ScddD/rKQg8RkXmseN/kKxJb0 ZqgeGF6c49AHERBJWRPGvCsyHwhk4hnd7aBFhOvvFuJTatq/FgOhfTE6hXaxHlY7E+qW Snuh5VM5Mn/Bmqe/UmEVrEkPgdtHRQz5qjuAPNVoV9d4cAaC7J0sZwMYT07OJQhoHon5 mFMEPqbp9d1MsBdLoYePPCtCIFHhmgoz+HATkgIviv7u4XdxVPGuNQM/TCzFBvLWsaL8 rtRaQj9s319BfQ/kKRB5AB3qb19j3CJkncSqEzqu7rYf7CC8oYID249eGZV96ys6rXiQ BFpA== X-Gm-Message-State: APjAAAWOlQzq9yXweUt3oT2l2rHI9ULprRXey4M2mN5jmob7lgixk0rB iha/KhSjcxuSv4Kb/4Y0vnUCD14zBDU= X-Received: by 2002:a17:902:6804:: with SMTP id h4mr40752244plk.115.1552410226368; Tue, 12 Mar 2019 10:03:46 -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 v22sm17514265pfa.49.2019.03.12.10.03.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Mar 2019 10:03:45 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 12 Mar 2019 10:03:29 -0700 Message-Id: <20190312170334.14005-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190312170334.14005-1-richard.henderson@linaro.org> References: <20190312170334.14005-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::430 Subject: [Qemu-devel] [PULL 07/12] test/decode: Add tests for PatternGroups 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: peter.maydell@linaro.org, Bastian Koppelmann Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Bastian Koppelmann This adds one test that supposed to succeed to test deep nesting of pattern groups which is rarely exercised by targets using decode tree. The remaining tests exercise various fail conditions. Signed-off-by: Bastian Koppelmann Message-Id: <20190227120217.20794-1-kbastian@mail.uni-paderborn.de> Signed-off-by: Richard Henderson --- tests/decode/check.sh | 6 ++++++ tests/decode/err_pattern_group_empty.decode | 6 ++++++ tests/decode/err_pattern_group_ident1.decode | 10 +++++++++ tests/decode/err_pattern_group_ident2.decode | 11 ++++++++++ tests/decode/err_pattern_group_nest1.decode | 13 ++++++++++++ tests/decode/succ_pattern_group_nest1.decode | 22 ++++++++++++++++++++ 6 files changed, 68 insertions(+) create mode 100644 tests/decode/err_pattern_group_empty.decode create mode 100644 tests/decode/err_pattern_group_ident1.decode create mode 100644 tests/decode/err_pattern_group_ident2.decode create mode 100644 tests/decode/err_pattern_group_nest1.decode create mode 100644 tests/decode/succ_pattern_group_nest1.decode -- 2.17.2 diff --git a/tests/decode/check.sh b/tests/decode/check.sh index 79a06c37cd..95445a0115 100755 --- a/tests/decode/check.sh +++ b/tests/decode/check.sh @@ -15,4 +15,10 @@ for i in err_*.decode; do fi done +for i in succ_*.decode; do + if ! $PYTHON $DECODETREE $i > /dev/null 2> /dev/null; then + echo FAIL:$i 1>&2 + fi +done + exit $E diff --git a/tests/decode/err_pattern_group_empty.decode b/tests/decode/err_pattern_group_empty.decode new file mode 100644 index 0000000000..abbff6b528 --- /dev/null +++ b/tests/decode/err_pattern_group_empty.decode @@ -0,0 +1,6 @@ +# This work is licensed under the terms of the GNU LGPL, version 2 or later. +# See the COPYING.LIB file in the top-level directory. + +# empty groups are not allowed +{ +} diff --git a/tests/decode/err_pattern_group_ident1.decode b/tests/decode/err_pattern_group_ident1.decode new file mode 100644 index 0000000000..3e65fab2f9 --- /dev/null +++ b/tests/decode/err_pattern_group_ident1.decode @@ -0,0 +1,10 @@ +# This work is licensed under the terms of the GNU LGPL, version 2 or later. +# See the COPYING.LIB file in the top-level directory. + +%sub1 0:8 + +# Make sure that indentation is enforced +{ + top 00000000 00000000 00000000 00000000 + sub1 00000000 00000000 00000000 ........ %sub1 +} diff --git a/tests/decode/err_pattern_group_ident2.decode b/tests/decode/err_pattern_group_ident2.decode new file mode 100644 index 0000000000..bc859233b1 --- /dev/null +++ b/tests/decode/err_pattern_group_ident2.decode @@ -0,0 +1,11 @@ +# This work is licensed under the terms of the GNU LGPL, version 2 or later. +# See the COPYING.LIB file in the top-level directory. + +%sub1 0:8 + +# Make sure that indentation is enforced +{ + top 00000000 00000000 00000000 00000000 + sub1 00000000 00000000 00000000 ........ %sub1 +# comments are suposed to be indented +} diff --git a/tests/decode/err_pattern_group_nest1.decode b/tests/decode/err_pattern_group_nest1.decode new file mode 100644 index 0000000000..92e971c3c5 --- /dev/null +++ b/tests/decode/err_pattern_group_nest1.decode @@ -0,0 +1,13 @@ +# This work is licensed under the terms of the GNU LGPL, version 2 or later. +# See the COPYING.LIB file in the top-level directory. + +%sub1 0:8 +%sub2 8:8 +%sub3 16:8 +%sub4 24:8 + +# Groups with no overlap are supposed to fail +{ + top 00000000 00000000 00000000 00000000 + sub4 ........ ........ ........ ........ %sub1 %sub2 %sub3 %sub4 +} diff --git a/tests/decode/succ_pattern_group_nest1.decode b/tests/decode/succ_pattern_group_nest1.decode new file mode 100644 index 0000000000..77b0f48b49 --- /dev/null +++ b/tests/decode/succ_pattern_group_nest1.decode @@ -0,0 +1,22 @@ +# This work is licensed under the terms of the GNU LGPL, version 2 or later. +# See the COPYING.LIB file in the top-level directory. + +%sub1 0:8 +%sub2 8:8 +%sub3 16:8 +%sub4 24:7 + +# Make sure deep netsting works, as few targets will actually exercise it +{ + top 00000000 00000000 00000000 00000000 + { + sub1 00000000 00000000 00000000 ........ %sub1 + { + sub2 00000000 00000000 ........ ........ %sub1 %sub2 + { + sub3 00000000 ........ ........ ........ %sub1 %sub2 %sub3 + sub4 0....... ........ ........ ........ %sub1 %sub2 %sub3 %sub4 + } + } + } +} From patchwork Tue Mar 12 17:03:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 160170 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp13400548jad; Tue, 12 Mar 2019 11:04:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqz/Q6+E25yERfHzh5CdaKlsPnBAvfSbE7d/bXXwMpm3+4LuBCjcuwAIsHAZpKU8+s8AHZms X-Received: by 2002:a25:d1c2:: with SMTP id i185mr33393282ybg.108.1552413880067; Tue, 12 Mar 2019 11:04:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552413880; cv=none; d=google.com; s=arc-20160816; b=AU6Iqj+/+YZOGRW46q9PrOSbS1t8dDC84tHVF3V6xu4bUprFeL44RBeMHfcC4xu69T JL+FF44n/SUo2JhgIkmhP3gVi5YTKfVEVPE/NSaL1wyTk41PLt+Yd5NNPKgkxeIyQU0Y 4H0srogubk+7QEZLWuisyquffvKDdM3hnQD/JO2zz4426t5C18eHkh1QNKAo/KbObwHB f1vel5HtE7m6SVLBV08BckeSO/xsvGSrHNAXRDndxtl7hdwH090J4csd4YVCMhVA61Jh ocx17Oy5odrIhsDiMTJf82BXfBkTj1dF/5ACn1tw7B037zN790Y9kCRqvZe2TiD4mSo2 w1yQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=vuqDnJauXUOQvzdJ4/CCwB1LBv5EZx2qRDR+YiJgFlc=; b=bPqnzI9xFp0qrtzjgVy5Y4vbx4qbXFV0yqJ0sQapgkoNx/x8ioTdGQLhcQW6z+V12b FlR0YzgLwg6NWOUHrxeN0kR6EMrQsUDLzN2Tt5SjiynsR8j/Mz0RRsTrAodAwBAc8hm0 DEmrM2dR5cClPzdWvYb2A5OrUo8GPxxRtW7HC+OQtTZtUaBSnVydQ40wV88dwzW25QwD xsOsSnb4ki8uPtuTRBt2t4rY3ZdaK2IoIFRoVIFLMDZ3NcQ3T7dmIK3MszG/NvuicPSy XJ7E4z4TukMnB5NhAQM5nu9xa5IW1hOkVVZiTos0yQXeBx5vtrE3jcjiLdpAcisHnwh4 mgFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=c6Jo3zAN; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s78si5500202ybs.454.2019.03.12.11.04.39 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 12 Mar 2019 11:04:40 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=c6Jo3zAN; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:56968 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3llX-0003mZ-Eg for patch@linaro.org; Tue, 12 Mar 2019 14:04:39 -0400 Received: from eggs.gnu.org ([209.51.188.92]:50763) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3l3N-0005UY-3p for qemu-devel@nongnu.org; Tue, 12 Mar 2019 13:19:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3koy-0001Re-KZ for qemu-devel@nongnu.org; Tue, 12 Mar 2019 13:04:09 -0400 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]:43798) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h3kow-0001Dt-ID for qemu-devel@nongnu.org; Tue, 12 Mar 2019 13:04:06 -0400 Received: by mail-pg1-x536.google.com with SMTP id l11so2266985pgq.10 for ; Tue, 12 Mar 2019 10:03:49 -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=vuqDnJauXUOQvzdJ4/CCwB1LBv5EZx2qRDR+YiJgFlc=; b=c6Jo3zANZQMHeEPF1NZ9uI0SvwNy3j3u47ooQMC5bOqpSuVxagYJcKC7MqsOCHeDxY ovD2Lkoi65Z/1hti1Ayrd0ZiLK6esRo9NcgFMMnHr2GNc9CyUOByuivBzDr9GHEpKJjd i8HHa1emgSg2BVS0Vt/8e+mU6VtsLPVNj/6ZkOoqhP+mA/L5rA1bR/VOnQlkEanWpTGf UMrNNFl8VI6rhFC1oco4t/p0HGBDFCAipLMLUonFTH4++BbhO6BW8H97BVcr9tMuQZiH EhIYmzC3rqS+8SCflecmTGM5uAghPb28Xc9UIxniVyKv8oQj9zGivud5oE+h8zOEK0CB kjgA== 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=vuqDnJauXUOQvzdJ4/CCwB1LBv5EZx2qRDR+YiJgFlc=; b=Df0fd6DA4AC3QUaJLPtc/8R+AeBMVR9BETOwkuCSsuupHqaDrzP3xyK8eY0wC/v0w5 VcMAiT3ARnGqXsYQVmtHFeSZZl20OXhi8mYcJAyvSVAm6VYkzDi+HBSj+UsQ+3Q67mBh aBT+ePUfeTKWH5CZ9zUF/2w/2xrRVeEp/rvl0jzzp6ggbPVOX2N2jvtWZUkkTpetSISC U6cx+ZnxMKP3F0IsFBmOiMNyyFCMn2Z10OV8uk4P44CXIoats5kFfjAp4NlQHfGxdDW6 QsUgj0gQ4YqRoD6YJm822lY6FHo9wyaxnig3NJNYPYNc1MDVFN+6VtktaEWuxHEw+LEh 6vbA== X-Gm-Message-State: APjAAAXfNoriPflZZQNHQc0f3zSx707QWLp1wI01VmTqNjOzY/hGZUIM fqIiZ9ZOg/37gG2QVFo4oxLx6D6AOQw= X-Received: by 2002:aa7:9289:: with SMTP id j9mr39968124pfa.130.1552410227722; Tue, 12 Mar 2019 10:03:47 -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 v22sm17514265pfa.49.2019.03.12.10.03.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Mar 2019 10:03:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 12 Mar 2019 10:03:30 -0700 Message-Id: <20190312170334.14005-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190312170334.14005-1-richard.henderson@linaro.org> References: <20190312170334.14005-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::536 Subject: [Qemu-devel] [PULL 08/12] decodetree: Add --static-decode option 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: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Like --decode, but do not drop 'static' qualifier. Signed-off-by: Richard Henderson --- scripts/decodetree.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) -- 2.17.2 diff --git a/scripts/decodetree.py b/scripts/decodetree.py index 2711c6ca9e..6067e940ab 100755 --- a/scripts/decodetree.py +++ b/scripts/decodetree.py @@ -979,7 +979,8 @@ def main(): decode_scope = 'static ' - long_opts = ['decode=', 'translate=', 'output=', 'insnwidth='] + long_opts = ['decode=', 'translate=', 'output=', 'insnwidth=', + 'static-decode='] try: (opts, args) = getopt.getopt(sys.argv[1:], 'o:w:', long_opts) except getopt.GetoptError as err: @@ -990,6 +991,8 @@ def main(): elif o == '--decode': decode_function = a decode_scope = '' + elif o == '--static-decode': + decode_function = a elif o == '--translate': translate_prefix = a translate_scope = '' From patchwork Tue Mar 12 17:03:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 160166 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp13391377jad; Tue, 12 Mar 2019 10:55:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqwNpff3yU0aYNB3boOQDMo3MiZWS2JC9HH/p/1r8olfyX8WY9UQIf4geCy+wGRrNyicGjFZ X-Received: by 2002:a81:6f8a:: with SMTP id k132mr30892760ywc.469.1552413359530; Tue, 12 Mar 2019 10:55:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552413359; cv=none; d=google.com; s=arc-20160816; b=QOgxIgE9GkclzvThJ1BsTRir94TVhY8w4r6Lc/qNFKvx9e8E4LTqOWtSeMb9uCt4To cRFYoXCi1Kq2az80TmnrXMPXBrOVjhLlqPqf1f48Z/PM9JPbX5Sh2woh8ZZX1uPfJ60d Pu0CeYc43YgmCIJeZSWFcMD+uwtnC1l10wVaacaEWdKTWWWuqUSjcno+EVhTAZovDk5d jpLmsFjIltR0OeUTZa9khfjjUaAuYRxCOg64EItLePUlLiFRAKJ9McVOg1g+2g/xmLMB 2PQvbP6oHgAA9uryQBp0H66pPBKJ28gU7by5d4e6jPpLenjeArrhZLJUcn7wi1TmNJ1o D3bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=oPNQCKMG+eFcSWSqQcxVkSY17qb8SVF1eeKGaPzpR/U=; b=LGFNqm/VMZOMRm8qVsPntXbOKv7g48LDfnT7OKMj14ow3XAcgjq3u7QNwcFit1adz4 kU5opav+Ccg/FQuOe+6XErum8Xyt8FzqMcrqEBJvvimu9PzjxULHwES7cfWi/0rwr1Ht 4eiqcnfZkztKEuskCZvVCgGctpAyC6KjRpTavX3u5dzdyq3tQDskrZ14nevwTEqYVuJM 73P3eUrxDa/RTk08xZLRCNBLin6mySC6LyoIFY22HpS/Zg6BoIkb2weJQAASMDm/UWg9 WDm+iAjy9z6hvDKjr+4lDQbths+cDmuQlP0G1h19/0ivdX77o0ildCBIeeR9THsMsPqc rlQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=nsZLFTRD; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id r126si5515454ybr.448.2019.03.12.10.55.59 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 12 Mar 2019 10:55:59 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=nsZLFTRD; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:56781 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3ld8-00041I-UU for patch@linaro.org; Tue, 12 Mar 2019 13:55:59 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51919) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3l3K-0006LV-Lo for qemu-devel@nongnu.org; Tue, 12 Mar 2019 13:19:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3koy-0001S1-Nq for qemu-devel@nongnu.org; Tue, 12 Mar 2019 13:04:09 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]:46304) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h3kow-0001FK-Ma for qemu-devel@nongnu.org; Tue, 12 Mar 2019 13:04:08 -0400 Received: by mail-pf1-x431.google.com with SMTP id s23so2238520pfe.13 for ; Tue, 12 Mar 2019 10:03:50 -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=oPNQCKMG+eFcSWSqQcxVkSY17qb8SVF1eeKGaPzpR/U=; b=nsZLFTRDGrnfnZfZYu0KdUmP9/etuvvm6PwTYDdtlWaZ9oVEBeu6oM0Vl4eFZb/E7a FSulfKmOgcmTwz9hovaahyAbEVhE5jOIQYlmiuDHVRgovltJmvWe9GNPpeGlJONa83M2 JqxArSUdSLBbM9gDf0S1j8Vl869+x4xkGTEop3J7w4jkA3/ZRDrlrghese6uSqPcnTDj Ov3phFGSHiRIOvSaV+gslAZJdMlB6eFCRyO3hJsVveml2Wz28heJr5VDPXas6YLZ+aBF WUo57C3fvYETx1/i3R7CIZyHYxcdiSpOCexFwyKkwNF8R9U8oPaR4ZfFus2WYzletiRF M+bg== 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=oPNQCKMG+eFcSWSqQcxVkSY17qb8SVF1eeKGaPzpR/U=; b=FoaquuMG8daWjgfhnCRZN0CQtj/tOU6EYnw1n7qWUPma9cQT0CKoevvbhwUq34P4/l BjGi5Q9dYdFVnNxIhvlCV4TT9kHF7MTUnSqGYH7YqUwprgtXpfWFesaw5qcvdXdseHG2 +UZoprs9p4cD/RxZcMvc+zvZP1oZ5hOwptLm5S9Yrv6I6ASQXq6jHO/c87I5lRKBHBwD hUOd1JOYSh4Oaizbb0ZYb4+rPxTTtttQEBz9h7dvrHgT/w06+WlHVQwxC7TqYRQUQCWK rGg+i/Rh1q3RGmiaoqjij+p9a+dxNuX1mYNdL1cNzs56YJzrY8KaOf3Y5dEzuR2ZgVHN PB1w== X-Gm-Message-State: APjAAAVrofcwPnx/Bki2ZJITcnyGN9mOe7+78eEu46OeI4tTYcM/wYfz vKNmMqlJ2yr9xpMYF5MyYJRLt539H2U= X-Received: by 2002:a17:902:2ac8:: with SMTP id j66mr41674808plb.335.1552410228893; Tue, 12 Mar 2019 10:03:48 -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 v22sm17514265pfa.49.2019.03.12.10.03.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Mar 2019 10:03:48 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 12 Mar 2019 10:03:31 -0700 Message-Id: <20190312170334.14005-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190312170334.14005-1-richard.henderson@linaro.org> References: <20190312170334.14005-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::431 Subject: [Qemu-devel] [PULL 09/12] decodetree: Produce clean output for an empty input file 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: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This is interesting for bisection, where an output file is plumbed, but does not yet have patterns. Signed-off-by: Richard Henderson --- scripts/decodetree.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) -- 2.17.2 diff --git a/scripts/decodetree.py b/scripts/decodetree.py index 6067e940ab..6e7ba278be 100755 --- a/scripts/decodetree.py +++ b/scripts/decodetree.py @@ -1049,15 +1049,16 @@ def main(): '(DisasContext *ctx, ', insntype, ' insn)\n{\n') i4 = str_indent(4) - output(i4, 'union {\n') - for n in sorted(arguments.keys()): - f = arguments[n] - output(i4, i4, f.struct_name(), ' f_', f.name, ';\n') - output(i4, '} u;\n\n') - t.output_code(4, False, 0, 0) + if len(allpatterns) != 0: + output(i4, 'union {\n') + for n in sorted(arguments.keys()): + f = arguments[n] + output(i4, i4, f.struct_name(), ' f_', f.name, ';\n') + output(i4, '} u;\n\n') + t.output_code(4, False, 0, 0) + output(i4, 'return false;\n') - output('}\n') if output_file: From patchwork Tue Mar 12 17:03:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 160161 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp13383788jad; Tue, 12 Mar 2019 10:47:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqwNDx+ct7qXHgigZD5PKAHZ3LQLbIROiSItSm9/2o5eJfXsVu7hsn0T8R2OGUMrNTGThPPk X-Received: by 2002:a81:5e03:: with SMTP id s3mr30577197ywb.44.1552412857725; Tue, 12 Mar 2019 10:47:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552412857; cv=none; d=google.com; s=arc-20160816; b=Kze3mCxoaHPNcO8y0VnL7xCSrHyEyVdFwYQqjD3FSGzKu8BtolEA+k4slJB0infVDq dwc1jwbgQX4ELhLUzpPPdA+CpQG9X5EkNQpQNJMkfZ2DJKbKh2OxokGE4ymyGRnFiikB T417WfRL4QKCe3ib0bZF5gdb6kSuY4uxGpzKL6dLijPZniSRUhWufYnnykwPUZjl+Juv 5SOylyZm/pXixa2rB+bbbtZ5mVHX3R48ergTtPTUpEAaXt+t6CeKEYlP6cE9dDvm6OA1 eanfVBxwYKksoNefhZ1qpNAgiRzRKoGg37+e8DkTNtzivchCPtOEMwY5lLPCuJOe4xlE mJzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=juWEfS7NZ8OWLNIMee0mKuVA5Db/G1PLvQaDN8eMxSI=; b=PkuSJvJAW8XrGzMTO8XUdzwcgam7SEzaUIwpjTWWO+W6vUjK4vRG7OGGs7xgCP6a8S +85W/ec5hSfX4xubfn/Is1ak3LDTI4XV6qS6T4Ry8i1dQ2bWn0bXt8GJSHie1ubiSR1M ON3RW4ivPFuGniMN9/o5WkfH4Sp6+09Fj7mg86ZlQH/Iq3tUszWWTkpJJHahfnk6fED+ jvssNM1OjJEY060at935XT3uyDWn+Sz3Tnkj5DrI2iMYd1HLGEIYj9ALMl3f4klbbeYO pMq8hQshRtSzRZrGoHU67Y9oeYZ+Ha8Wc2FzziULEczVBpAbsG57NrmawknYRa5aWmlx MnAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=JVwXhhXb; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 11si5270465ywx.197.2019.03.12.10.47.37 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 12 Mar 2019 10:47:37 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=JVwXhhXb; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:56674 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3lV2-0005Mb-Tv for patch@linaro.org; Tue, 12 Mar 2019 13:47:36 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51578) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3l3K-000633-Ph for qemu-devel@nongnu.org; Tue, 12 Mar 2019 13:18:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3koy-0001Rk-Lf for qemu-devel@nongnu.org; Tue, 12 Mar 2019 13:04:09 -0400 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]:43789) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h3kow-0001GP-LA for qemu-devel@nongnu.org; Tue, 12 Mar 2019 13:04:06 -0400 Received: by mail-pg1-x52c.google.com with SMTP id l11so2267095pgq.10 for ; Tue, 12 Mar 2019 10:03:51 -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=juWEfS7NZ8OWLNIMee0mKuVA5Db/G1PLvQaDN8eMxSI=; b=JVwXhhXbMQK59lA5k50B2oIvhlkrTp0fNOSbHMsKRQ6df9gpmqydRRHr4VDd4LR+cY oKQUbayT6jPjvKQ5uJuTsrQBoFYKIEJ6QrIBXkE0EHOxGNv4+xDxrPjdwdn1Jn7BpXh9 KvaHE3zImN1xTYtyfFgNjSQjYF3yBhDgYBIDJ38MQr2N7ES4STWXgmjXV4+JEB0i8jW8 iR6uhbcVU8IJVIM78F74SR5BsQCYd60nIdDYhj+PSr0EVBMxByHUsfXie76+EET6hcCI FB0g2E7kug1L/f5AOYqhKmkNfE6MSFg/2eSg2nwwlx9XydThQmeEjAu18B+XpanYP+yG GSIA== 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=juWEfS7NZ8OWLNIMee0mKuVA5Db/G1PLvQaDN8eMxSI=; b=cSyreJ96/sYeprUNKUj0pHsDZzGgwbwRRaCahu4L3xpylgw8DJm/uEyZ2RF26tuW6M dkLZzzTH708kO3emWbkeuKfTTmyZmuGe4Oyc+zbXiv8qByZsHP+1xsQH0BIf2a4AA2X1 cdkr40d8E9vY28Dx67sBy1HD067kvHvxUAWPHP9CPZTRT007hufWo5UmhdFO+ch4QkCF bhe6pzHIdpuF9L9ZqjfsvYcF9fIDLhb6dtC9afyiF+QElVq53OuVns650KjNC4H6UJ+I rTWjl48s2B03kGJVd/H8gciAvObPtDHwMBWlb4lii9WlJNHjktmbx1oRJyfz+9PtVhFq ioZA== X-Gm-Message-State: APjAAAVO5B427YhiDuFc/oWwdzGbBfl0WqOK4I11O6sHyiNzj29uzT8I QM9K+Y/8bllplplq44GCsZgvdYhl29U= X-Received: by 2002:a63:4f61:: with SMTP id p33mr36093394pgl.303.1552410230169; Tue, 12 Mar 2019 10:03:50 -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 v22sm17514265pfa.49.2019.03.12.10.03.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Mar 2019 10:03:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 12 Mar 2019 10:03:32 -0700 Message-Id: <20190312170334.14005-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190312170334.14005-1-richard.henderson@linaro.org> References: <20190312170334.14005-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::52c Subject: [Qemu-devel] [PULL 10/12] decodetree: Allow +- to begin a number initializing a field 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: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- scripts/decodetree.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.17.2 diff --git a/scripts/decodetree.py b/scripts/decodetree.py index 6e7ba278be..f6f58e2fec 100755 --- a/scripts/decodetree.py +++ b/scripts/decodetree.py @@ -589,7 +589,7 @@ def parse_generic(lineno, is_format, name, toks): continue # 'Foo=number' sets an argument field to a constant value - if re_fullmatch(re_ident + '=[0-9]+', t): + if re_fullmatch(re_ident + '=[+-]?[0-9]+', t): (fname, value) = t.split('=') value = int(value) flds = add_field(lineno, flds, fname, ConstField(value)) From patchwork Tue Mar 12 17:03:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 160164 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp13388804jad; Tue, 12 Mar 2019 10:53:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqzYNr27Nqs8PTiBjgMeLP+LZxmrIFtd0tKhDKvLr29w52XipWlh9rC+xkCo1be3e3pMW6ii X-Received: by 2002:a81:9955:: with SMTP id q82mr19889823ywg.416.1552413186716; Tue, 12 Mar 2019 10:53:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552413186; cv=none; d=google.com; s=arc-20160816; b=n+UuM+he7WEZahPPUCBp36G+Bk+TYeTToMlD4/79mRHCRDpGH0EoZ6HEANpA3rgdgB TFzEHLWohujW2vVpZcv5gUdCJBAGfONJcoOUUgbY9inMg0v5HrqNvfHEkGeGsq+LxsNp baC/6jRPneq7vyk3syuFaBtS7750R2UBpJPAG+OhJvD2N/1g51IU9gNccGxO4sG+URRe sc70bQRMnHh+LQfZzskXPKO8oiM+rp708aX6dwEqXIbycyafJfHyQntG4UylXNPiawH5 IePLcK+uVff/D3aoDRDg84z+Xh1cCJt4QlxUu8vWWnb4ZSrHeVI1Yv3HG1tj2ly/gKyK OOcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=mqxLPtkQySU2IDq6kuvPZ0RBBVrxjaoE5KbcgZVTzHQ=; b=TXCH4UIfLwpqISY3fG5vKaVxgoRAzwAOdHD8bgZG6Zu2wsVpoRnZN0Gfjd9NB1TtNt vu3XJ7tre+8SdqCmO/7lhnTE3s1xS0Za74cVcriSTpBcfsBpnAirnkL+zdud/OPRk1jz 4wSeGOEcM4AxzXNluZ4Iek6Ambd+i2mtACIUZczxgcVwNJhXcEg0DaUMxOQW7TV3jty9 GJkzCabZDGcvUZBtCnb3+T6eXyFhPCw0ubvbjACCjpVy1lZPspj77SK6YxyMmfP5idxW kkGCFcxw9KMM+LpK+qu7lK86atU7pnCGkpnQg3Yk61suUoMXjmQ1OfSkbMNWGc2XEmjf 8W3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=RFOFpVv+; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v68si6283583ybi.163.2019.03.12.10.53.06 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 12 Mar 2019 10:53:06 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=RFOFpVv+; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:56755 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3laM-0001b5-5x for patch@linaro.org; Tue, 12 Mar 2019 13:53:06 -0400 Received: from eggs.gnu.org ([209.51.188.92]:50688) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3l3K-0005OA-DI for qemu-devel@nongnu.org; Tue, 12 Mar 2019 13:18:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3koy-0001SI-Tg for qemu-devel@nongnu.org; Tue, 12 Mar 2019 13:04:09 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]:41050) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h3koy-0001HA-KP for qemu-devel@nongnu.org; Tue, 12 Mar 2019 13:04:08 -0400 Received: by mail-pf1-x429.google.com with SMTP id d25so2256518pfn.8 for ; Tue, 12 Mar 2019 10:03:52 -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=mqxLPtkQySU2IDq6kuvPZ0RBBVrxjaoE5KbcgZVTzHQ=; b=RFOFpVv+IurhlYc3YAyocf4XTf3YCAo6P38WO8VE/D8K6JZtWm5Zwnrl3y2GujoB3Z L9Twqsf4JbgAR72rHJJkz/ehuKtnPpacYz6HRK47vvE3X4W6GB2dHOXsi5LTZqaVX+3J N0S74T1PmMwDPglB7KHBySJ8oUeanP1z4s9fQ3UqSed6GSe0sm1eCojFTDcbMpsfp9BR Ah28eWpxre1QYeIT7rsue0bYyARfd/5xoggo0t1yoD0rZz7MLcbV/Y4nFKA0kORZEYYc 5wzT6nl0lcTG/pVL6Y0YBthIVW0A3s8PoVFI367liKUJNZ/apJ+ioM5ryUrP/RXpMT44 bHIw== 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=mqxLPtkQySU2IDq6kuvPZ0RBBVrxjaoE5KbcgZVTzHQ=; b=E7a05xIju50xJDjXIIT3ADeaBuNxFdKZewp1KdjF0GqhKTMT92zexOnMdLTv/VWhbU fuX2nLIjduwb07OKjiNfiDse1SYgbvlgmm0eWPfG+Ro7u3ZR8Cea5PFN+azNcFLNptOY +lZ9hjyVtciSJnuExllw5fXGq5kQC9rTiADDGHqz6OmTDUyg7J0Ntn4R/ev9hcq1WujN iOyPWNywbV37uXdWg3tleMHcxNhjWyxZkFejMDHwPpc4DPJzQ2RN7hlhPt8pkMhaWLMO a+nVB7IwP80VPDakqXZHMwicCOOWNNgaM1iSTupwgfxWdySNaITLCGBA5LFbRqPZfOy+ ss3Q== X-Gm-Message-State: APjAAAVsBghwpK8sWMHRd8MFMO4e5jnDQ9V7yV5bJKQ21z2+gmNU869j YpttI90yq9tDshtKYriMKglzlptt/XY= X-Received: by 2002:a62:4553:: with SMTP id s80mr39164183pfa.141.1552410231556; Tue, 12 Mar 2019 10:03:51 -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 v22sm17514265pfa.49.2019.03.12.10.03.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Mar 2019 10:03:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 12 Mar 2019 10:03:33 -0700 Message-Id: <20190312170334.14005-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190312170334.14005-1-richard.henderson@linaro.org> References: <20190312170334.14005-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::429 Subject: [Qemu-devel] [PULL 11/12] decodetree: Prefix extract function names with decode_function 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: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This makes it easier to name Formats within multiple decode files. Signed-off-by: Richard Henderson --- scripts/decodetree.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.17.2 diff --git a/scripts/decodetree.py b/scripts/decodetree.py index f6f58e2fec..ac158b42d0 100755 --- a/scripts/decodetree.py +++ b/scripts/decodetree.py @@ -312,7 +312,8 @@ class Format(General): """Class representing an instruction format""" def extract_name(self): - return 'extract_' + self.name + global decode_function + return decode_function + '_extract_' + self.name def output_extract(self): output('static void ', self.extract_name(), '(', From patchwork Tue Mar 12 17:03:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 160168 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp13394056jad; Tue, 12 Mar 2019 10:58:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqxJV3bCPkTj98ml88m+/Rhts65ZaDrsaEETS6bzR1+Al6EzSc1BkfLZAEZFy0gPT17S9qrP X-Received: by 2002:a81:6f87:: with SMTP id k129mr1415932ywc.322.1552413535335; Tue, 12 Mar 2019 10:58:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552413535; cv=none; d=google.com; s=arc-20160816; b=1GAQJ0gMGmpurjEAVpL+ybWQ9isrwZPojTTHDRFHfHe2YOYpfZEoTsNX+oJtiQELZc slirCP9i9J71bPo6N74OTwwsIfAIn/H6D+zHv/iej9VPPT/vhTqKZs0wgMP6gVw569Cb RvlUUO2VOiPv5cb9lC+cwI9NFCybYjloGRQ9GVnIuWkiXWfxgxG/FQ/fZJna3YaHSt3w FQakJNAnc/nPxDB4rzFJ3+cGwMqTt70sXbg8RGyym2eDk86dOPZwtzNwZFFR4hc9lLn3 Y6EAWxsje46pd0jffC9ZQzlwPhv0glKGJHrT1a8YEWcU/5K/kAda9YPqctnwmA0tWqdg lKvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=U8jWfxjTB06zNjuAV7mfMguhymjQ42j8YO1WeS5mESc=; b=nZhnxroSlIR+HxH/pnttpa20orOkdb2U2IkdMhNLlNSihg0g5sxOVj4tgJ53GUGPUt bwdRYyKLLGA36DA+3FK2OUcHJ+dL2ttsDeUk3a96NjEBg8wDheJj0d7NwUpQpslBOAfC ZZZeFBBUN+Uo2xjAHjlrX5HCBOPXHvgtG6MSYUGB2QR2UikwEwTF3zhu4Hxi5eiaGC8u bn73ex3HNCTCNygHDmhlUkLBR7ymhNEVnwcomHGtn0KH4HrvbvuHIb2U8OeBd53BteQ3 tes+GmpKk4ib4tzmbOadc6XWOcDs3MCksHfmFeQIFzOt4gEjfJ3fiuLVCbPf4rlHNvv0 jUDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=xsH7aTH1; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x1si5339530ybj.360.2019.03.12.10.58.55 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 12 Mar 2019 10:58:55 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=xsH7aTH1; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:56844 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3lfy-0006eR-Qx for patch@linaro.org; Tue, 12 Mar 2019 13:58:54 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51529) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3l3N-00061D-4t for qemu-devel@nongnu.org; Tue, 12 Mar 2019 13:19:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3kow-0001QP-IK for qemu-devel@nongnu.org; Tue, 12 Mar 2019 13:04:08 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]:38143) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h3kou-0001Hy-Dc for qemu-devel@nongnu.org; Tue, 12 Mar 2019 13:04:06 -0400 Received: by mail-pf1-x436.google.com with SMTP id n125so2268756pfn.5 for ; Tue, 12 Mar 2019 10:03:54 -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=U8jWfxjTB06zNjuAV7mfMguhymjQ42j8YO1WeS5mESc=; b=xsH7aTH1ypem/GskMg+ekwHrPBadXraRVOJIwXzTC7EFMqjRd5z8+kqZeNnyd4zi2m wpUblVuSEh5+eSHUwqbyUqJNXpBhmbwQnJ1ZFZ7GRSHfUTMivMnKXB71VvxkKjuCHP4X kPv6WpdOhvj8Ca+1G5C7+TPuiarcaLsg1ewzN4GAJzUFRHZQOQAeSBjs1dWhf70C7Yf/ w1Z/ZXc4OS6pBP7FiRfAjZXYh3V3saQQLtCL64ql+fUJBtyTcSzoXXUBxp21txm9oTYq AGFQ40vEU5+jGn9t3Snwo+/7imA/eFHeCUQoSyALughRULvBH/QqwVkmzoUZUKFVL3AG yeNA== 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=U8jWfxjTB06zNjuAV7mfMguhymjQ42j8YO1WeS5mESc=; b=czq9/jwCIZM28I6HqcXoFlMBYgIlPAUWaPm5Tymj/zkL+CD9T4Fzc2/MVs+IL805RR +yS7n+vAqB4p7tdLerMXcN0L/cDwZoDW9Nv2RNu8jkQsyDF/YtJXhfevtix/5Na1a7Yj Bnm0wnsiKTlS4d42PaEP/XqR30ovcd9eT6UV89J68Mfha7MYEiIcxEJ5AJWDx2cetMzZ EC5FenroBZV74k2dCP9HY+Y757rxEt9AJH2fHC2CqqMYgVqQTJNnm2QSrumtKg7p7Wr/ fltAnwqSUEN0u1wfDTK18U+Aqk3eU2XpwlGNIFoLdioRmBuovJjPsz13mfVdJXbGQDFw nzUw== X-Gm-Message-State: APjAAAXrVTKuz+2q7TbMbW4z+XgDEflzdGUiLVyYrH82roVQ0IBwL5pu gageCAZlB6AKOQqcAovLaQ7RS/KXfRA= X-Received: by 2002:aa7:8a59:: with SMTP id n25mr4908227pfa.251.1552410232995; Tue, 12 Mar 2019 10:03:52 -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 v22sm17514265pfa.49.2019.03.12.10.03.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Mar 2019 10:03:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 12 Mar 2019 10:03:34 -0700 Message-Id: <20190312170334.14005-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190312170334.14005-1-richard.henderson@linaro.org> References: <20190312170334.14005-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::436 Subject: [Qemu-devel] [PULL 12/12] decodetree: Properly diagnose fields overflowing an insn 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: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Previously this would result in an exception for shifting the field mask by a negative number. Signed-off-by: Richard Henderson --- scripts/decodetree.py | 2 ++ tests/decode/err_width1.decode | 5 +++++ tests/decode/err_width2.decode | 5 +++++ tests/decode/err_width3.decode | 5 +++++ tests/decode/err_width4.decode | 5 +++++ 5 files changed, 22 insertions(+) create mode 100644 tests/decode/err_width1.decode create mode 100644 tests/decode/err_width2.decode create mode 100644 tests/decode/err_width3.decode create mode 100644 tests/decode/err_width4.decode -- 2.17.2 diff --git a/scripts/decodetree.py b/scripts/decodetree.py index ac158b42d0..aa790b596a 100755 --- a/scripts/decodetree.py +++ b/scripts/decodetree.py @@ -622,6 +622,8 @@ def parse_generic(lineno, is_format, name, toks): sign = True flen = flen[1:] shift = int(flen, 10) + if shift + width > insnwidth: + error(lineno, 'field {0} exceeds insnwidth'.format(fname)) f = Field(sign, insnwidth - width - shift, shift) flds = add_field(lineno, flds, fname, f) fixedbits <<= shift diff --git a/tests/decode/err_width1.decode b/tests/decode/err_width1.decode new file mode 100644 index 0000000000..0c14f6d73b --- /dev/null +++ b/tests/decode/err_width1.decode @@ -0,0 +1,5 @@ +# This work is licensed under the terms of the GNU LGPL, version 2 or later. +# See the COPYING.LIB file in the top-level directory. + +# Diagnose too many bits (33 of 32) +one 000000000000000000000000000000000 diff --git a/tests/decode/err_width2.decode b/tests/decode/err_width2.decode new file mode 100644 index 0000000000..47f0acf322 --- /dev/null +++ b/tests/decode/err_width2.decode @@ -0,0 +1,5 @@ +# This work is licensed under the terms of the GNU LGPL, version 2 or later. +# See the COPYING.LIB file in the top-level directory. + +# Diagnose too few bits (31 of 32) +one 0000000000000000000000000000000 diff --git a/tests/decode/err_width3.decode b/tests/decode/err_width3.decode new file mode 100644 index 0000000000..c5fb6b3699 --- /dev/null +++ b/tests/decode/err_width3.decode @@ -0,0 +1,5 @@ +# This work is licensed under the terms of the GNU LGPL, version 2 or later. +# See the COPYING.LIB file in the top-level directory. + +# Diagnose too many bits (33 of 32) +one 0 s:32 diff --git a/tests/decode/err_width4.decode b/tests/decode/err_width4.decode new file mode 100644 index 0000000000..1588a63698 --- /dev/null +++ b/tests/decode/err_width4.decode @@ -0,0 +1,5 @@ +# This work is licensed under the terms of the GNU LGPL, version 2 or later. +# See the COPYING.LIB file in the top-level directory. + +# Diagnose too few bits (31 of 32) +one 0 s:30