From patchwork Tue Jun 9 16:24:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 187675 Delivered-To: patch@linaro.org Received: by 2002:a54:30ca:0:0:0:0:0 with SMTP id e10csp560984ecs; Tue, 9 Jun 2020 09:26:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwDjQ0RUOv49RVRrtnLqVK07qrIYOgeKTgGzCQO9EIlzin1oI2JiDL4AThUS16lbaynsxLa X-Received: by 2002:a25:1145:: with SMTP id 66mr7577846ybr.120.1591719964699; Tue, 09 Jun 2020 09:26:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591719964; cv=none; d=google.com; s=arc-20160816; b=wSjxzhghQgC8AvR6P0OXCbCrA42rz1Sn7cnTxZh4XDnypodY5RXjWGIPRNjGyQluz7 3W3OEU/IInh5RYMrxcSJzpDrRnk/89sN/QrGcEJYV2tdXLHtdonaDME81O0nH+VzS202 mCcsjKmdcTdVyk6JerYLdmhIpvFaP6LDkrmBhQXHa/+1F2JM4r7k/afeGXX2QHJFpULb mHbF7303Go1cTSJuhBH2q6j6O+z1LM/f5N849bjodiGWlGGQ1LAZ4qXfESEEtHTkSMU3 bbp4xJO0r9ZVnLL2zyb9uc2NuLtTyCevrp83kenYe65n3C/uG+pO4yL2GEMUFTVNdJRO fRiA== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=b/XVcjpntbxdGusUz05j9FBinJNgwBz4HL/Wlk1yj2E=; b=hvdOXgPSrVFJgaNtspQgKLGfdVDTx1/5PZUbcwNg7wlfyBuAFTM3XscoWSFJmYxcUr swf6X46co1yPN23ymGMcmnamyUO/KNZyNQPoMoSft1LtWmtO9egchLiV+qkQph09eXAb BCJzf/wL5ybTnxMZUmbk8PT/RzizYnF+KKG1y2F9jRtPKx220D53uHwr6/zlxttMbsgw bZEPoSHE8H/Mvm9wTgdmauQrU2JpGDRyeEqiorStMqbu8+HofmXLTwl9k72crnu3zO14 lqlDzyLw+JUMukr3kC5yeQkFBml/LhFK44dBeh69fWysw2Py0ZquOHXU/t5ffUfFQ5wO grkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="PIb/mC8H"; 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=pass (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 d186si2866753ybb.470.2020.06.09.09.26.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Jun 2020 09:26:04 -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=pass header.i=@linaro.org header.s=google header.b="PIb/mC8H"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:46638 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jih4e-00006W-1o for patch@linaro.org; Tue, 09 Jun 2020 12:26:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47030) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jih3o-00006E-9N for qemu-devel@nongnu.org; Tue, 09 Jun 2020 12:25:12 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]:46078) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jih3l-0000Se-Gl for qemu-devel@nongnu.org; Tue, 09 Jun 2020 12:25:11 -0400 Received: by mail-pf1-x42e.google.com with SMTP id a127so10272443pfa.12 for ; Tue, 09 Jun 2020 09:25:09 -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=b/XVcjpntbxdGusUz05j9FBinJNgwBz4HL/Wlk1yj2E=; b=PIb/mC8HdNmYPaLb3g9FR4yCIpXUSdSiUEms8FMGgyunc0fLEQDWP3DoOehkjNTvMQ m/DQAP9UUXVg8QHtjyjV+0NHw31anafNbrPXW+mA8RvzfCNExpGtuwnTLbR+Ioo6l1nn u0W5Va006Jpwuh5kWLVdbBIjiztTZHqPCS3BqIwHfQjBiAcS6p/9dUJ59AAtKT2Y+OOf UnRSQGkpKKeC+1b3FQyyyYLemXTyt32eMVuvAyeH9YK4AIL02BNFY5Ksu9AQ4k9YiLC9 Z034UI47Gl1853hHC1VM9SbdgBwghMwCCFxNgENb0etr6uqlzEDpSBO24y4jzDg0USH0 3uEA== 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=b/XVcjpntbxdGusUz05j9FBinJNgwBz4HL/Wlk1yj2E=; b=bF57v3ma3+DUxHMitYRh+2U6pUI0LznswWUS+FpxahbTYU5QB//pkmJB5xWwe6+7a0 glthtB3QWM49OgnojsDV0ddBFn1ujnK4XCVgDOnW3wIRJpa7F1dNMYHEhcKXp0eL3mXQ ITpJwbtV+m5V82FxJWcO1Uh91F7Iw5OUiE7veqAqtAtv/ZQFPfgfS6q/hfUTwQerWhN2 RAIJbslTLD1dgcKtAjAaUlS1QrjoLMJh9ObvBHCyUKINNGfqJXBLa7WliggK/bKw9HWH GJy35jYAEZ2kIfv6PUgNQvBM19q4lSmqjgUooioEMnOq/iIRQw+XBAr92tLjD7xVMSyv NwSA== X-Gm-Message-State: AOAM532wey18FyND5u2jCfZb79+ndpXis2HalQX54xLdgnMuSJDV6IYe Wct/rr+SA5sV5d2Dmi2E9ASiKJaEc3I= X-Received: by 2002:a63:d318:: with SMTP id b24mr23270750pgg.403.1591719907745; Tue, 09 Jun 2020 09:25:07 -0700 (PDT) Received: from localhost.localdomain (174-21-143-238.tukw.qwest.net. [174.21.143.238]) by smtp.gmail.com with ESMTPSA id s188sm7580101pfb.118.2020.06.09.09.25.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2020 09:25:06 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 1/9] decodetree: Tidy error_with_file Date: Tue, 9 Jun 2020 09:24:56 -0700 Message-Id: <20200609162504.780080-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200609162504.780080-1-richard.henderson@linaro.org> References: <20200609162504.780080-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42e.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" Use proper varargs to print the arguments. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- scripts/decodetree.py | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) -- 2.25.1 diff --git a/scripts/decodetree.py b/scripts/decodetree.py index f9d204aa36..b559db3086 100755 --- a/scripts/decodetree.py +++ b/scripts/decodetree.py @@ -51,23 +51,27 @@ def error_with_file(file, lineno, *args): global output_file global output_fd + prefix = '' + if file: + prefix += '{0}:'.format(file) if lineno: - r = '{0}:{1}: error:'.format(file, lineno) - elif input_file: - r = '{0}: error:'.format(file) - else: - r = 'error:' - for a in args: - r += ' ' + str(a) - r += '\n' - sys.stderr.write(r) + prefix += '{0}:'.format(lineno) + if prefix: + prefix += ' ' + print(prefix, end='error: ', file=sys.stderr) + print(*args, file=sys.stderr) + if output_file and output_fd: output_fd.close() os.remove(output_file) exit(1) +# end error_with_file + def error(lineno, *args): - error_with_file(input_file, lineno, args) + error_with_file(input_file, lineno, *args) +# end error + def output(*args): global output_fd From patchwork Tue Jun 9 16:24:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 187673 Delivered-To: patch@linaro.org Received: by 2002:a54:30ca:0:0:0:0:0 with SMTP id e10csp560487ecs; Tue, 9 Jun 2020 09:25:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzBv8JcRZvIT4+nabCPxHCuSvwL58NRw2g+IBbykRZZeUS9ilt6uCytXJBjYjnGDJ1DHvGH X-Received: by 2002:a25:81c4:: with SMTP id n4mr7752039ybm.370.1591719931070; Tue, 09 Jun 2020 09:25:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591719931; cv=none; d=google.com; s=arc-20160816; b=rBRNe3MWYDP0KNfqDya8B4C9T+ye28MBsC8PQ7iF37sgltOShkPl50XZUYXGF74WhB 7e336yyvwcuvwT/azNopgL9UbQi+5KRYd467vai/MH71z1Uem75dTgWONSvLLdHacdH3 ZFs0OJL7b3AzPNA55biv9kMlF2xERk4lYIPFMpw26Ay1/D/WLd2g9VXUpGveOSHodonO Zb9jUQxBRJVG4xHuUNW/hMiXtmGFZ63Z6oUMM8R7N2cO885R/NLXbUtDUau+fEFCwyN+ saEc/5sRkjqjIO3tjIP717RXcpG4myFAUeV6B9iz+DTDQEdD0hCkyZeTmE2lHmloGSIG ClHA== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=fuj4+EzL4ACqWfECVnWjXkyBK0NkdZBLVsNebnwCJQ0=; b=TPwystTMcxBNIjruKIwpr6/X3Nbg21EIM78xx4EVt8BJYrW1DxR7WSErf3HEP6VSMG Cg0YeeaIRhxWPQTWapGznbD8pRSafu8tAckam4/tJGNXxkTNCMyVfrawo96kM/E9fmqm QuWYHkq5AuPs2ULCJmatff+NqM/ZkW8GuxNhoYgEvu5JUld8QEi9AvKKkYz8znN8XQxc IRnUU7niRZcqIL23YnpCAccsDvIp+ySH7gu38juNh9/vC1f+1nkwXqvKvBk9yw0f2rcA qYcIWx4MIX4KPBpbvYWzgTqeZsKCJjS0kUPZDOSlvBfZFMuae0WERsoauZjduHQ6UQ7l RQtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uExIaGHG; 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=pass (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 c133si2814848ybb.294.2020.06.09.09.25.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Jun 2020 09:25:31 -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=pass header.i=@linaro.org header.s=google header.b=uExIaGHG; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:46642 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jih46-00006Y-EI for patch@linaro.org; Tue, 09 Jun 2020 12:25:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47028) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jih3o-00006D-5l for qemu-devel@nongnu.org; Tue, 09 Jun 2020 12:25:12 -0400 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]:37169) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jih3m-0000Sr-VV for qemu-devel@nongnu.org; Tue, 09 Jun 2020 12:25:11 -0400 Received: by mail-pg1-x530.google.com with SMTP id d10so10533867pgn.4 for ; Tue, 09 Jun 2020 09:25:10 -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=fuj4+EzL4ACqWfECVnWjXkyBK0NkdZBLVsNebnwCJQ0=; b=uExIaGHGbhx1qtHMuG+SO2cDXVYerh2dCTmlb7xnzDT8+CbIpnNP6ikTa+loHGo/ia MXdkMynralLbTG2Y+sz7NCbY1ZZ1EtTjsNcqHKcJrQmTe0uOpBdUEDSpHWRIbdQLflt4 l32i2ZpgpfnhoH9H0TW1BrGFMGEpNnrQaPZVIsmeD+MG/kpr3xVNYdtKxrBAX8EJLerM Oho4pLPMqY2jsIZJVCvG07ADNcvDmyoLZ5/mCuBPbNLw2Btnlslr99rahniRVRJIuAjW 7lcuuSn4yPqgfFJ5BF+rqiLNp+Gt2pbT7a0ZFtGzycVm22FOcxxRszyw9SpQoIGZR45i yK0w== 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=fuj4+EzL4ACqWfECVnWjXkyBK0NkdZBLVsNebnwCJQ0=; b=bEle7ueDJzb1REAhpTSeLoyA0HX642WMsv+fWQs8NBxhAU8dqtM2a8AOS1XriAMI6/ imAKeH6OlcVq7nL4rxEjkY3Y52q2CmYafJ55wkj07I5x/GJZYwQ3D/wNFBP2TE1SfPAZ eqDUVdyjGyDURr8CrRhXS7GconqVfCy4nCX3SN8SMUnYYg3/ehAcfAV02lkZUKpLU4k4 hDOoT45fDfISzdEQGaFKOKS4LfJCb02AIvjnY7azhFAzq3ac9sDiEw0YZTJikdELqM1I vQFE0PIDIFD7qJsXQXzD3NIKUZpWzlWhsDl/s0yIgpV52/hBthKUFQufaVLJXU/iioia Faow== X-Gm-Message-State: AOAM533eOQhRTC8NbxbOYS8Lsqh+b8/HBNjfq155CmVWgOzML/R2Y5qP bMk9Sxx7NlivyhrXn+yWPrL56iVB2yY= X-Received: by 2002:a63:5d19:: with SMTP id r25mr24723423pgb.360.1591719909156; Tue, 09 Jun 2020 09:25:09 -0700 (PDT) Received: from localhost.localdomain (174-21-143-238.tukw.qwest.net. [174.21.143.238]) by smtp.gmail.com with ESMTPSA id s188sm7580101pfb.118.2020.06.09.09.25.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2020 09:25:08 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 2/9] decodetree: Rename MultiPattern to IncMultiPattern Date: Tue, 9 Jun 2020 09:24:57 -0700 Message-Id: <20200609162504.780080-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200609162504.780080-1-richard.henderson@linaro.org> References: <20200609162504.780080-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::530; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x530.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" Name the current node for "inclusive" multi-pattern, in preparation for adding a node for "exclusive" multi-pattern. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- scripts/decodetree.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) -- 2.25.1 diff --git a/scripts/decodetree.py b/scripts/decodetree.py index b559db3086..7af6b3056d 100755 --- a/scripts/decodetree.py +++ b/scripts/decodetree.py @@ -371,7 +371,7 @@ class Pattern(General): # end Pattern -class MultiPattern(General): +class IncMultiPattern(General): """Class representing an overlapping set of instruction patterns""" def __init__(self, lineno, pats, fixb, fixm, udfm, w): @@ -410,7 +410,7 @@ class MultiPattern(General): output(ind, '}\n') else: p.output_code(i, extracted, p.fixedbits, p.fixedmask) -#end MultiPattern +#end IncMultiPattern def parse_field(lineno, name, toks): @@ -751,8 +751,8 @@ 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.""" +def build_incmulti_pattern(lineno, pats): + """Validate the Patterns going into a IncMultiPattern.""" global patterns global insnmask @@ -792,9 +792,9 @@ def build_multi_pattern(lineno, pats): else: repeat = False - mp = MultiPattern(lineno, pats, fixedbits, fixedmask, undefmask, width) + mp = IncMultiPattern(lineno, pats, fixedbits, fixedmask, undefmask, width) patterns.append(mp) -# end build_multi_pattern +# end build_incmulti_pattern def parse_file(f): """Parse all of the patterns within a file""" @@ -860,7 +860,7 @@ def parse_file(f): error(start_lineno, 'indentation ', indent, ' != ', nesting) pats = patterns patterns = saved_pats.pop() - build_multi_pattern(lineno, pats) + build_incmulti_pattern(lineno, pats) toks = [] continue From patchwork Tue Jun 9 16:24:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 187679 Delivered-To: patch@linaro.org Received: by 2002:a54:30ca:0:0:0:0:0 with SMTP id e10csp563086ecs; Tue, 9 Jun 2020 09:29:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxTZGnHlWKJhLAk/dGTS6XxGcQcC5AP64e2ylQBE58i1fjShVLeHMQAlOZvemAoztzfZAE2 X-Received: by 2002:a25:c401:: with SMTP id u1mr8010334ybf.91.1591720144845; Tue, 09 Jun 2020 09:29:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591720144; cv=none; d=google.com; s=arc-20160816; b=nAvCynNfy27NPTvT2Ikx/9PbOLBgz8U4nt61OEtsToEdrtxXXNgD7gi7LEbjmVz1SW tYiPOIRSVpeRbyP0Cg0T0Tu5tVqfzSuOFfgBNFbCu8rFssXcsk6pzw1Efped3d2myNOg BTKzLUNi3NLdNoKaQCLGAGsv2DZiMjueowsekN3jK/y6MazPDZ+k5DetnFKw5kyIJ11W Nn/LUPLeB4lQLl8WOa6G+q/9QpAYjjqyam2Nw4o7fMCwh/niKP+su41+q3gufYbv85FT vzHVd98LhYEOuJNo6T/hOfvkR61zzUyb6fxZbcrPAjIk6MS7KmkTbKxXwqPJPNNWKPCM ZFFQ== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Pya0L8DMOCjwgXBO0A8MFuLM5jSzTOZ88OjOprsge18=; b=s94IDaZ+DtiK+Kx67Xzjb20SLXcOOrKjRS/59CLNGXYxHlHYSWPh0c42KdtNB2po6Q STBD/20JgpO4ThVJ1EPSloZqjK1DfVr9EgBLg0ktXQWKdlZJ4LSlQSe1Gi+9JBis+XuL aLjQm/e7fYYl23R3Xh8nz8uajp/hRHgk/TqPhBRfkICBSNN22HKn2cFD+GbPIWsIpKgB eOqOxyO94mGvO1Q21BCV0N0+KRtOEdFmfMb2vFsUIM5ZbSh7oidIGap+D8CwJBBoEu2f 3uMcCvxkzu2KDf8b3l3G25B/+gqmh9uJYhBun51Pu344k7Sg7mBpF51lynst0/5t3s5b 5NhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=U+VsWnue; 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=pass (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 14si2709679ybj.54.2020.06.09.09.29.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Jun 2020 09:29:04 -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=pass header.i=@linaro.org header.s=google header.b=U+VsWnue; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:58146 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jih7Y-00050Q-4u for patch@linaro.org; Tue, 09 Jun 2020 12:29:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47040) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jih3p-000070-Hx for qemu-devel@nongnu.org; Tue, 09 Jun 2020 12:25:13 -0400 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]:40681) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jih3o-0000TR-DX for qemu-devel@nongnu.org; Tue, 09 Jun 2020 12:25:13 -0400 Received: by mail-pl1-x630.google.com with SMTP id t16so8229826plo.7 for ; Tue, 09 Jun 2020 09:25:11 -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=Pya0L8DMOCjwgXBO0A8MFuLM5jSzTOZ88OjOprsge18=; b=U+VsWnueeL0xPWTjn43ahwwDTz7u5oyjiwYln2FVm5xQVoBGt8R1/d8um9leJGCLPs CWukIVh3WoKSaJ3FFOTTgIayzjglZ0Y3LnYy0mSyuXF9qlNX5/rkc9xZJqUeYyW3ey1T tYE4ZmSoqpJCWBp+KDJoQeRjVOXzEEU5/sxSLdKnfJnaO55kbWg+C12BUh//+blSvsyG 8fwf8sIQzCZKrgi1wCdinN1qt9HlvLCb6CsZZtOfrBl1r80SPdm/N/7P2whAAqrWK7Pk f+oFpvOMMQZFJ37qFoyWgkIYqykOID7axsdgFc1PGaacLbUcvXU4O3UaDccLk2Zno6FW 2uDw== 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=Pya0L8DMOCjwgXBO0A8MFuLM5jSzTOZ88OjOprsge18=; b=CqIQYsWgkorh0U2E9DqFBpbxiLRUnwpz7DEwDyxfRYLBF/8LKjFtNz+vVi11ckbMU4 v7RTUyto7Livvk7dfqk5yXCNftqNhdzzAZ9TpCozKJqWDVFNilmqTiWmS4R/xTlaUsZl fqSpdY/1bDTaiUN5g2xQf4SMhjFIvRlul950o4ULIeQ/pK/xKLYO13P34t3oyKWHznhw yP8p6h/v4gVInwxkcwUHuosvom8J5SSCt80xGQKzCqI4iZ8xSG1pdGlfovLEbLjDXWOE HmslglA2FkBI7/LvKMyz8H/2Ie/elOJ538qZQENXbDSLfvtkjGjFhd7/ZbeG8V934vA/ 1vTg== X-Gm-Message-State: AOAM5304aChNTHBG8MraMA+oA4eDMbwOXlujotFh6xIqv3Y6Jd0k2ZBO lRShDMDG+ndRPlTR5gZKQvI7QYDt4N4= X-Received: by 2002:a17:90b:283:: with SMTP id az3mr5760784pjb.232.1591719910441; Tue, 09 Jun 2020 09:25:10 -0700 (PDT) Received: from localhost.localdomain (174-21-143-238.tukw.qwest.net. [174.21.143.238]) by smtp.gmail.com with ESMTPSA id s188sm7580101pfb.118.2020.06.09.09.25.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2020 09:25:09 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 3/9] decodetree: Split out MultiPattern from IncMultiPattern Date: Tue, 9 Jun 2020 09:24:58 -0700 Message-Id: <20200609162504.780080-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200609162504.780080-1-richard.henderson@linaro.org> References: <20200609162504.780080-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::630; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x630.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- scripts/decodetree.py | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) -- 2.25.1 diff --git a/scripts/decodetree.py b/scripts/decodetree.py index 7af6b3056d..ea313bcdea 100755 --- a/scripts/decodetree.py +++ b/scripts/decodetree.py @@ -371,7 +371,32 @@ class Pattern(General): # end Pattern -class IncMultiPattern(General): +class MultiPattern(General): + """Class representing a set of instruction patterns""" + + def __init__(self, lineno, pats): + self.file = input_file + self.lineno = lineno + self.pats = pats + self.base = None + self.fixedbits = 0 + self.fixedmask = 0 + self.undefmask = 0 + self.width = None + + def __str__(self): + r = 'group' + if self.fixedbits is not None: + r += ' ' + str_match_bits(self.fixedbits, self.fixedmask) + return r + + def output_decl(self): + for p in self.pats: + p.output_decl() +# end MultiPattern + + +class IncMultiPattern(MultiPattern): """Class representing an overlapping set of instruction patterns""" def __init__(self, lineno, pats, fixb, fixm, udfm, w): @@ -384,16 +409,6 @@ class IncMultiPattern(General): self.undefmask = udfm self.width = w - 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) From patchwork Tue Jun 9 16:24:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 187677 Delivered-To: patch@linaro.org Received: by 2002:a54:30ca:0:0:0:0:0 with SMTP id e10csp562164ecs; Tue, 9 Jun 2020 09:27:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHPHnPOfRi2F99Yx7g1sZvMHWm3slDpAxKS0boblI3SSRUiRVOYKqTLtLrXhIYuyf5QI3M X-Received: by 2002:a25:8384:: with SMTP id t4mr7223402ybk.430.1591720064687; Tue, 09 Jun 2020 09:27:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591720064; cv=none; d=google.com; s=arc-20160816; b=PC7RbSJFXLqg0z23S2/KDWu1t43/BxgcGkyLesa9owSJ2BoE8g4Ek/Wgyumq9vpSuI KlEJofyWySn1geSUkcMDszJ/iRyj/XpohK4ppOoYNg1sYl7zAp7N1Q02ddOs3p8HDBe7 Vv/T+N+LbQPzbgQuYCsQri1VvFe9OmteHAVgkPiv7v4tTtKNvSH8nVPuaodXwPfve1X5 KYPsp4IA+QiWuZXopm5C18VpTF8Ml8577OYF3atS3+tdbz6xHiAb4ShuAC2Imt+nFdrR M7Q9+fqHzhG4XTqQOubt+60j89pwclAvjHx6QgXm6s75wi4x7o61nLBZ/J0461vUiB+d zOlQ== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=D9iJwfXIlrrZhBoa0zYBpMpQDudGom24uMHOfJzYaos=; b=qTqqmkD3zEwGQQR2oc5kxFo18pt6yySrRr88duaIqRZUX8Q5Smw0GpgBzr4kNvDaR+ YVgw6jnR2fqnMEmn8YvrdSy5mRMjiwO2fg+lkWF/x9d5FVmk53mWIYJvVcsTR3iC2bKQ o2AImKF3eB5ZXWewMkZS6yCDWQKyNjC82yCFLL18SAG2GwlLMYvkNK7keGPWqe/Yv6Z7 ey5q0iQDk2t1JQUvY66RsRc7Yui4IwXRbh5p5k9QN/nPg0+76uV3j2CLja5PNnOY0ufy kqMMpVUYs8FyAycUjQV5SiVuytDbBUfow3GWXsSmyalcyPADXd01VwjWoPWWoZe8/wtf a1YQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SSKioLzg; 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=pass (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 l186si3216540ybc.457.2020.06.09.09.27.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Jun 2020 09:27:44 -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=pass header.i=@linaro.org header.s=google header.b=SSKioLzg; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:54814 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jih6G-0003aA-1E for patch@linaro.org; Tue, 09 Jun 2020 12:27:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47052) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jih3q-00008q-JC for qemu-devel@nongnu.org; Tue, 09 Jun 2020 12:25:14 -0400 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]:43848) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jih3p-0000Ti-Ff for qemu-devel@nongnu.org; Tue, 09 Jun 2020 12:25:14 -0400 Received: by mail-pl1-x631.google.com with SMTP id g12so8231369pll.10 for ; Tue, 09 Jun 2020 09:25:12 -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=D9iJwfXIlrrZhBoa0zYBpMpQDudGom24uMHOfJzYaos=; b=SSKioLzg15b5lY0y9ok3Z8QBQAD9YoHL+TVOXRhHO6EAK9a7uTrCBthkJJNY4KeM7e pZYIdtEzK8qAec+chAzKSWPEmBEl/0HeSn8rzn+CtZ2OrljPY2b+cKoSMWmY34vYUvnk JUnE52lcSRxaHTsUbtqwbP70d65x2/g7U7gc5xwDAZxRreK0YFbULHxOijW40Uz4oybb IXl4GYHLOz+HwSyUCY1pL06aNeoMc/WfiBcX02qNoqaJNyTDVpXbNSk15TxG3T64I2KG aO1FrZ57E0A6SsG2AvjslfxpFAsdF/Tt/1fAg7MDbbQ33OUnrLefZXQfni5JANA4fNQF Na+g== 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=D9iJwfXIlrrZhBoa0zYBpMpQDudGom24uMHOfJzYaos=; b=IROX4cCbi8jK5lLW8yHfsT4iUuP/HvzBsW4I4GS5E+YQLzKI+CIRl+igAsX5Vanix4 zxWzpW2aqU+1MyucbH+iWvXwmhX00lYREN57RkqMkMRY4HCo4+28xBdj4ysMo3XxQieF iwSsWvdg54LJhZwwMD7d0jnJ6euAeZDxHPZdhrTOMGhSW8KsYwfhp+wgy2Wb2P5TVHpI LR3/8Yr7T+YeRiKWtdxQa/TtfdSpqDieVCEcCfrpaPdQc1SotRFjfSasLXHEhUWri7DF K2GiQwznVRH+edy2BFi4RJ26VvuSa3rddoR7TpV6Ngn/HeL/q7+5f1gyvEJNT7MxJCzh pG0Q== X-Gm-Message-State: AOAM5318FgmuKWFqkzmqiQ8uPavd7JA7yw5xgYeHFK4JWqMSLBfiGjtb m6PX/oW8KCu6iPril4TYonZhRY7Al+M= X-Received: by 2002:a17:90a:c293:: with SMTP id f19mr5550170pjt.91.1591719911610; Tue, 09 Jun 2020 09:25:11 -0700 (PDT) Received: from localhost.localdomain (174-21-143-238.tukw.qwest.net. [174.21.143.238]) by smtp.gmail.com with ESMTPSA id s188sm7580101pfb.118.2020.06.09.09.25.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2020 09:25:11 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 4/9] decodetree: Allow group covering the entire insn space Date: Tue, 9 Jun 2020 09:24:59 -0700 Message-Id: <20200609162504.780080-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200609162504.780080-1-richard.henderson@linaro.org> References: <20200609162504.780080-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::631; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x631.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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 an edge case for sure, but the logic that disallowed this case was faulty. Further, a few fixes scattered about can allow this to work. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- ...est1.decode => succ_pattern_group_nest2.decode} | 2 +- scripts/decodetree.py | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) rename tests/decode/{err_pattern_group_nest1.decode => succ_pattern_group_nest2.decode} (85%) -- 2.25.1 diff --git a/tests/decode/err_pattern_group_nest1.decode b/tests/decode/succ_pattern_group_nest2.decode similarity index 85% rename from tests/decode/err_pattern_group_nest1.decode rename to tests/decode/succ_pattern_group_nest2.decode index 92e971c3c5..8d5ab4b2d3 100644 --- a/tests/decode/err_pattern_group_nest1.decode +++ b/tests/decode/succ_pattern_group_nest2.decode @@ -6,7 +6,7 @@ %sub3 16:8 %sub4 24:8 -# Groups with no overlap are supposed to fail +# Group with complete overlap of the two patterns { top 00000000 00000000 00000000 00000000 sub4 ........ ........ ........ ........ %sub1 %sub2 %sub3 %sub4 diff --git a/scripts/decodetree.py b/scripts/decodetree.py index ea313bcdea..3307c74c30 100755 --- a/scripts/decodetree.py +++ b/scripts/decodetree.py @@ -124,6 +124,7 @@ def is_pow2(x): def ctz(x): """Return the number of times 2 factors into X.""" + assert x != 0 r = 0 while ((x >> r) & 1) == 0: r += 1 @@ -131,6 +132,8 @@ def ctz(x): def is_contiguous(bits): + if bits == 0: + return -1 shift = ctz(bits) if is_pow2((bits >> shift) + 1): return shift @@ -793,9 +796,8 @@ def build_incmulti_pattern(lineno, pats): error(lineno, 'width mismatch in patterns within braces') repeat = True - while repeat: - if fixedmask == 0: - error(lineno, 'no overlap in patterns within braces') + fixedbits = 0 + while repeat and fixedmask != 0: fixedbits = None for p in pats: thisbits = p.fixedbits & fixedmask @@ -978,6 +980,12 @@ def build_tree(pats, outerbits, outermask): innermask &= i.fixedmask if innermask == 0: + # Edge condition: One pattern covers the entire insnmask + if len(pats) == 1: + t = Tree(outermask, innermask) + t.subs.append((0, pats[0])) + return t + text = 'overlapping patterns:' for p in pats: text += '\n' + p.file + ':' + str(p.lineno) + ': ' + str(p) From patchwork Tue Jun 9 16:25:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 187682 Delivered-To: patch@linaro.org Received: by 2002:a54:30ca:0:0:0:0:0 with SMTP id e10csp568001ecs; Tue, 9 Jun 2020 09:36:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyoHUC/Xxu13w1ask6es2ou+Kc/9x1Xy/YYTkafPfqPerAJNwP6XL9ghwl8AQlGbxDgTw62 X-Received: by 2002:a25:810e:: with SMTP id o14mr7567045ybk.453.1591720562854; Tue, 09 Jun 2020 09:36:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591720562; cv=none; d=google.com; s=arc-20160816; b=QgUvV5NEFb+xPvP0BZ7V7Fi+b4wGm1hftEzExOkDmUgSs+9IdcXt9JDgDJ5GAIKMJe WHWUBGeBnKCfG+4svjsjD+3lwYKuIlPydT97AJgRMIT4eZ+eqh5BJ6MIlurAfFVdhcZW BAanRsmlDAydI05r2V46ilF5fzOndmk+ExrbLKH935VqcTsG7hyy8MtdmMegDC0eO3zN 2QGuoBU+x7zv4mmJZ37pgX+gdIKZ9Bs2ZLBPjR1dCKD5FkVYc0P8DwaGBb3PXdtkYaQC bZovjuRoDNHAAPR076hNJGwmbl3WanBWNI7qrCSHYjR6JY8eO6WuvSC4TSALKVXf5Suh lxzQ== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=vTBtqxUpy9WkyuXZwOdXZa6I5esZFyA9WphOj0ye99o=; b=Wmw3dTFgY2Jia5pnKCTxTkBY7sPqYr0SAY/Atn1IzSAPhkhO4iGFhlWBP5SKChPmUb t5BnQhLrWxXtVwfnZb6lJhtkHu776fRfBnD/kT6tjSz7proy1JGIFGbmjHAMVL7jktx9 JaFW6+RTo1IZ0B8RC3s+zZXTW4Ku8+MSm+jKmo4RfTYtakPu0rE5oUYM1wHzpRGfBdLx lenAVCPP5Dkjj8+80lU8TQDBq1CrqO/gfNsaX+ssJDCgLj2nh8e26nRwNEoDvFHCFXVC bxDj2MSzw4yF8tjvGve6fnLTc2A34SAcWwhAX+QurqFnA0nRDrI4eIehXXssXjptiJVw 0guQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eZ6SXRTV; 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=pass (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 k125si3009276ybf.269.2020.06.09.09.36.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Jun 2020 09:36:02 -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=pass header.i=@linaro.org header.s=google header.b=eZ6SXRTV; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49996 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jihEI-0005K0-34 for patch@linaro.org; Tue, 09 Jun 2020 12:36:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47086) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jih3u-0000Gc-Rh for qemu-devel@nongnu.org; Tue, 09 Jun 2020 12:25:18 -0400 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]:40751) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jih3r-0000U9-7d for qemu-devel@nongnu.org; Tue, 09 Jun 2020 12:25:18 -0400 Received: by mail-pg1-x529.google.com with SMTP id e18so487002pgn.7 for ; Tue, 09 Jun 2020 09:25:14 -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=vTBtqxUpy9WkyuXZwOdXZa6I5esZFyA9WphOj0ye99o=; b=eZ6SXRTV115YwAmdENSYcxs7DpEutxCjzyqjTznnWFKZEP7jM3vxI3FC6QbGZMB9yG liQziy+ahbb+PzYlHvdowVC37QR3Mp5lhlp0fEuEaWQhirRF69O+WBhHvpvymU49kcCc On9FGfmCyvfmMiZTmJiTRo77yXFBw7SoQFv4fluez8NN/8IuGH6wamjBrxqXGLs4tHQG 3qctfdgKUVHJJXK6Y+TA0K0HkNjF8orNDvgMVHCeNDVeck//WZUxRnQ478hY5k/phxwy Pa8bBXK34xP0GsIfzKX6xu/Tx0H2NzO6dZYaMP8kT9QTVEH9R3ZJBfQs1yAIpaEfG9LB vhRA== 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=vTBtqxUpy9WkyuXZwOdXZa6I5esZFyA9WphOj0ye99o=; b=s6dX8zqMr9xgIoGB77GAFNrLtuMYVG8HQXIiRJA5LiF+Ei5ywVCuQ/UBDSYi04CyhV IfVOogJZxjYF/XH6ojt4HVfbutmUTlq8+ShN6X0LSo/aYppWcYiP6e6JOp7+2wYMElPW UZZXJ6DDtxXPfc3XOtngmYbUdl45RvBxOe70+GHmTxLR126WbccvGuG1zdlOGcXQXRfB +4D80FVE7Vxp6LH3ycTgx+QXjgU1530Rhi1f6Ywfkr5+6Ix6OEtiC3xabpfKJcn/MD5F 2Rrag20xkHT9DNCke/1gPIqnAsSdhjSGUMvIHKEAW+LscnL/z/tVYoGE2IYr4QAMTUj4 R9Ew== X-Gm-Message-State: AOAM533qdgRKSeTGkH8iPlHKLLQ+LZB3J7a6X0cKNicrnF6KFujOhEun +jIb28LrNZ1erALegcY+0Jt2JAuWWFI= X-Received: by 2002:a62:7c49:: with SMTP id x70mr20933899pfc.66.1591719912911; Tue, 09 Jun 2020 09:25:12 -0700 (PDT) Received: from localhost.localdomain (174-21-143-238.tukw.qwest.net. [174.21.143.238]) by smtp.gmail.com with ESMTPSA id s188sm7580101pfb.118.2020.06.09.09.25.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2020 09:25:12 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 5/9] decodetree: Move semantic propagation into classes Date: Tue, 9 Jun 2020 09:25:00 -0700 Message-Id: <20200609162504.780080-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200609162504.780080-1-richard.henderson@linaro.org> References: <20200609162504.780080-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::529; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x529.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" Create ExcMultiPattern to hold an set of non-overlapping patterns. The body of build_tree, prop_format become member functions on this class. Add minimal member functions to Pattern and MultiPattern to allow recusion through the tree. Move the bulk of build_incmulti_pattern to prop_masks and prop_width in MultiPattern, since we will need this for both kinds of containers. Only perform prop_width for variablewidth. Remove global patterns variable, and pass down container object into parse_file from main. No functional change in all of this. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- scripts/decodetree.py | 464 +++++++++++++++++++++++------------------- 1 file changed, 253 insertions(+), 211 deletions(-) -- 2.25.1 diff --git a/scripts/decodetree.py b/scripts/decodetree.py index 3307c74c30..0ba01e049c 100755 --- a/scripts/decodetree.py +++ b/scripts/decodetree.py @@ -31,7 +31,6 @@ variablewidth = False fields = {} arguments = {} formats = {} -patterns = [] allpatterns = [] anyextern = False @@ -371,16 +370,27 @@ class Pattern(General): output(ind, 'u.f_', arg, '.', n, ' = ', f.str_extract(), ';\n') output(ind, 'if (', translate_prefix, '_', self.name, '(ctx, &u.f_', arg, ')) return true;\n') + + # Normal patterns do not have children. + def build_tree(self): + return + def prop_masks(self): + return + def prop_format(self): + return + def prop_width(self): + return + # end Pattern class MultiPattern(General): """Class representing a set of instruction patterns""" - def __init__(self, lineno, pats): + def __init__(self, lineno): self.file = input_file self.lineno = lineno - self.pats = pats + self.pats = [] self.base = None self.fixedbits = 0 self.fixedmask = 0 @@ -396,22 +406,63 @@ class MultiPattern(General): def output_decl(self): for p in self.pats: p.output_decl() + + def prop_masks(self): + global insnmask + + fixedmask = insnmask + undefmask = insnmask + + # Collect fixedmask/undefmask for all of the children. + for p in self.pats: + p.prop_masks() + fixedmask &= p.fixedmask + undefmask &= p.undefmask + + # Widen fixedmask until all fixedbits match + repeat = True + fixedbits = 0 + while repeat and fixedmask != 0: + fixedbits = None + for p in self.pats: + thisbits = p.fixedbits & fixedmask + if fixedbits is None: + fixedbits = thisbits + elif fixedbits != thisbits: + fixedmask &= ~(fixedbits ^ thisbits) + break + else: + repeat = False + + self.fixedbits = fixedbits + self.fixedmask = fixedmask + self.undefmask = undefmask + + def build_tree(self): + for p in self.pats: + p.build_tree() + + def prop_format(self): + for p in self.pats: + p.build_tree() + + def prop_width(self): + width = None + for p in self.pats: + p.prop_width() + if width is None: + width = p.width + elif width != p.width: + error_with_file(self.file, self.lineno, + 'width mismatch in patterns within braces') + self.width = width + # end MultiPattern class IncMultiPattern(MultiPattern): """Class representing an overlapping set of instruction patterns""" - def __init__(self, lineno, pats, fixb, fixm, udfm, w): - self.file = input_file - self.lineno = lineno - self.pats = pats - self.base = None - self.fixedbits = fixb - self.fixedmask = fixm - self.undefmask = udfm - self.width = w - def output_code(self, i, extracted, outerbits, outermask): global translate_prefix ind = str_indent(i) @@ -431,6 +482,153 @@ class IncMultiPattern(MultiPattern): #end IncMultiPattern +class Tree: + """Class representing a node in a decode tree""" + + def __init__(self, fm, tm): + self.fixedmask = fm + self.thismask = tm + self.subs = [] + self.base = None + + def str1(self, i): + ind = str_indent(i) + r = '{0}{1:08x}'.format(ind, self.fixedmask) + if self.format: + r += ' ' + self.format.name + r += ' [\n' + for (b, s) in self.subs: + r += '{0} {1:08x}:\n'.format(ind, b) + r += s.str1(i + 4) + '\n' + r += ind + ']' + return r + + def __str__(self): + return self.str1(0) + + def output_code(self, i, extracted, outerbits, outermask): + ind = str_indent(i) + + # If we identified all nodes below have the same format, + # extract the fields now. + if not extracted and self.base: + output(ind, self.base.extract_name(), + '(ctx, &u.f_', self.base.base.name, ', insn);\n') + extracted = True + + # Attempt to aid the compiler in producing compact switch statements. + # If the bits in the mask are contiguous, extract them. + sh = is_contiguous(self.thismask) + if sh > 0: + # Propagate SH down into the local functions. + def str_switch(b, sh=sh): + return '(insn >> {0}) & 0x{1:x}'.format(sh, b >> sh) + + def str_case(b, sh=sh): + return '0x{0:x}'.format(b >> sh) + else: + def str_switch(b): + return 'insn & 0x{0:08x}'.format(b) + + def str_case(b): + return '0x{0:08x}'.format(b) + + output(ind, 'switch (', str_switch(self.thismask), ') {\n') + for b, s in sorted(self.subs): + assert (self.thismask & ~s.fixedmask) == 0 + innermask = outermask | self.thismask + innerbits = outerbits | b + output(ind, 'case ', str_case(b), ':\n') + output(ind, ' /* ', + str_match_bits(innerbits, innermask), ' */\n') + s.output_code(i + 4, extracted, innerbits, innermask) + output(ind, ' return false;\n') + output(ind, '}\n') +# end Tree + + +class ExcMultiPattern(MultiPattern): + """Class representing a non-overlapping set of instruction patterns""" + + def output_code(self, i, extracted, outerbits, outermask): + # Defer everything to our decomposed Tree node + self.tree.output_code(i, extracted, outerbits, outermask) + + @staticmethod + def __build_tree(pats, outerbits, outermask): + # Find the intersection of all remaining fixedmask. + innermask = ~outermask & insnmask + for i in pats: + innermask &= i.fixedmask + + if innermask == 0: + # Edge condition: One pattern covers the entire insnmask + if len(pats) == 1: + t = Tree(outermask, innermask) + t.subs.append((0, pats[0])) + return t + + text = 'overlapping patterns:' + for p in pats: + text += '\n' + p.file + ':' + str(p.lineno) + ': ' + str(p) + error_with_file(pats[0].file, pats[0].lineno, text) + + fullmask = outermask | innermask + + # Sort each element of pats into the bin selected by the mask. + bins = {} + for i in pats: + fb = i.fixedbits & innermask + if fb in bins: + bins[fb].append(i) + else: + bins[fb] = [i] + + # We must recurse if any bin has more than one element or if + # the single element in the bin has not been fully matched. + t = Tree(fullmask, innermask) + + for b, l in bins.items(): + s = l[0] + if len(l) > 1 or s.fixedmask & ~fullmask != 0: + s = ExcMultiPattern.__build_tree(l, b | outerbits, fullmask) + t.subs.append((b, s)) + + return t + + def build_tree(self): + super().prop_format() + self.tree = self.__build_tree(self.pats, self.fixedbits, + self.fixedmask) + + @staticmethod + def __prop_format(tree): + """Propagate Format objects into the decode tree""" + + # Depth first search. + for (b, s) in tree.subs: + if isinstance(s, Tree): + ExcMultiPattern.__prop_format(s) + + # If all entries in SUBS have the same format, then + # propagate that into the tree. + f = None + for (b, s) in tree.subs: + if f is None: + f = s.base + if f is None: + return + if f is not s.base: + return + tree.base = f + + def prop_format(self): + super().prop_format() + self.__prop_format(self.tree) + +# end ExcMultiPattern + + def parse_field(lineno, name, toks): """Parse one instruction field from TOKS at LINENO""" global fields @@ -587,18 +785,19 @@ def infer_format(arg, fieldmask, flds, width): # end infer_format -def parse_generic(lineno, is_format, name, toks): +def parse_generic(lineno, parent_pat, name, toks): """Parse one instruction format from TOKS at LINENO""" global fields global arguments global formats - global patterns global allpatterns global re_ident global insnwidth global insnmask global variablewidth + is_format = parent_pat is None + fixedmask = 0 fixedbits = 0 undefmask = 0 @@ -749,7 +948,7 @@ def parse_generic(lineno, is_format, name, toks): error(lineno, 'field {0} not initialized'.format(f)) pat = Pattern(name, lineno, fmt, fixedbits, fixedmask, undefmask, fieldmask, flds, width) - patterns.append(pat) + parent_pat.pats.append(pat) allpatterns.append(pat) # Validate the masks that we have assembled. @@ -769,61 +968,16 @@ def parse_generic(lineno, is_format, name, toks): .format(allbits ^ insnmask)) # end parse_general -def build_incmulti_pattern(lineno, pats): - """Validate the Patterns going into a IncMultiPattern.""" - 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 - - width = None - for p in pats: - if width is None: - width = p.width - elif width != p.width: - error(lineno, 'width mismatch in patterns within braces') - - repeat = True - fixedbits = 0 - while repeat and fixedmask != 0: - 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 = IncMultiPattern(lineno, pats, fixedbits, fixedmask, undefmask, width) - patterns.append(mp) -# end build_incmulti_pattern - -def parse_file(f): +def parse_file(f, parent_pat): """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 = [] + nesting_pats = [] for line in f: lineno += 1 @@ -868,16 +1022,20 @@ def parse_file(f): # 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') + if len(parent_pat.pats) < 2: + error(lineno, 'less than two patterns within braces') + + try: + parent_pat = nesting_pats.pop() + except: + error(lineno, 'mismatched close brace') + nesting -= 2 if indent != nesting: - error(start_lineno, 'indentation ', indent, ' != ', nesting) - pats = patterns - patterns = saved_pats.pop() - build_incmulti_pattern(lineno, pats) + error(lineno, 'indentation ', indent, ' != ', nesting) + toks = [] continue @@ -889,8 +1047,12 @@ def parse_file(f): if name == '{': if len(toks) != 0: error(start_lineno, 'extra tokens after open brace') - saved_pats.append(patterns) - patterns = [] + + nested_pat = IncMultiPattern(start_lineno) + parent_pat.pats.append(nested_pat) + nesting_pats.append(parent_pat) + parent_pat = nested_pat + nesting += 2 toks = [] continue @@ -901,121 +1063,13 @@ def parse_file(f): elif name[0] == '&': parse_arguments(start_lineno, name[1:], toks) elif name[0] == '@': - parse_generic(start_lineno, True, name[1:], toks) + parse_generic(start_lineno, None, name[1:], toks) else: - parse_generic(start_lineno, False, name, toks) + parse_generic(start_lineno, parent_pat, name, toks) toks = [] # end parse_file -class Tree: - """Class representing a node in a decode tree""" - - def __init__(self, fm, tm): - self.fixedmask = fm - self.thismask = tm - self.subs = [] - self.base = None - - def str1(self, i): - ind = str_indent(i) - r = '{0}{1:08x}'.format(ind, self.fixedmask) - if self.format: - r += ' ' + self.format.name - r += ' [\n' - for (b, s) in self.subs: - r += '{0} {1:08x}:\n'.format(ind, b) - r += s.str1(i + 4) + '\n' - r += ind + ']' - return r - - def __str__(self): - return self.str1(0) - - def output_code(self, i, extracted, outerbits, outermask): - ind = str_indent(i) - - # If we identified all nodes below have the same format, - # extract the fields now. - if not extracted and self.base: - output(ind, self.base.extract_name(), - '(ctx, &u.f_', self.base.base.name, ', insn);\n') - extracted = True - - # Attempt to aid the compiler in producing compact switch statements. - # If the bits in the mask are contiguous, extract them. - sh = is_contiguous(self.thismask) - if sh > 0: - # Propagate SH down into the local functions. - def str_switch(b, sh=sh): - return '(insn >> {0}) & 0x{1:x}'.format(sh, b >> sh) - - def str_case(b, sh=sh): - return '0x{0:x}'.format(b >> sh) - else: - def str_switch(b): - return 'insn & 0x{0:08x}'.format(b) - - def str_case(b): - return '0x{0:08x}'.format(b) - - output(ind, 'switch (', str_switch(self.thismask), ') {\n') - for b, s in sorted(self.subs): - assert (self.thismask & ~s.fixedmask) == 0 - innermask = outermask | self.thismask - innerbits = outerbits | b - output(ind, 'case ', str_case(b), ':\n') - output(ind, ' /* ', - str_match_bits(innerbits, innermask), ' */\n') - s.output_code(i + 4, extracted, innerbits, innermask) - output(ind, ' return false;\n') - output(ind, '}\n') -# end Tree - - -def build_tree(pats, outerbits, outermask): - # Find the intersection of all remaining fixedmask. - innermask = ~outermask & insnmask - for i in pats: - innermask &= i.fixedmask - - if innermask == 0: - # Edge condition: One pattern covers the entire insnmask - if len(pats) == 1: - t = Tree(outermask, innermask) - t.subs.append((0, pats[0])) - return t - - text = 'overlapping patterns:' - for p in pats: - text += '\n' + p.file + ':' + str(p.lineno) + ': ' + str(p) - error_with_file(pats[0].file, pats[0].lineno, text) - - fullmask = outermask | innermask - - # Sort each element of pats into the bin selected by the mask. - bins = {} - for i in pats: - fb = i.fixedbits & innermask - if fb in bins: - bins[fb].append(i) - else: - bins[fb] = [i] - - # We must recurse if any bin has more than one element or if - # the single element in the bin has not been fully matched. - t = Tree(fullmask, innermask) - - for b, l in bins.items(): - s = l[0] - if len(l) > 1 or s.fixedmask & ~fullmask != 0: - s = build_tree(l, b | outerbits, fullmask) - t.subs.append((b, s)) - - return t -# end build_tree - - class SizeTree: """Class representing a node in a size decode tree""" @@ -1157,28 +1211,6 @@ def build_size_tree(pats, width, outerbits, outermask): # end build_size_tree -def prop_format(tree): - """Propagate Format objects into the decode tree""" - - # Depth first search. - for (b, s) in tree.subs: - if isinstance(s, Tree): - prop_format(s) - - # If all entries in SUBS have the same format, then - # propagate that into the tree. - f = None - for (b, s) in tree.subs: - if f is None: - f = s.base - if f is None: - return - if f is not s.base: - return - tree.base = f -# end prop_format - - def prop_size(tree): """Propagate minimum widths up the decode size tree""" @@ -1199,7 +1231,6 @@ def prop_size(tree): def main(): global arguments global formats - global patterns global allpatterns global translate_scope global translate_prefix @@ -1246,18 +1277,29 @@ def main(): if len(args) < 1: error(0, 'missing input file') + + toppat = ExcMultiPattern(0) + for filename in args: input_file = filename f = open(filename, 'r') - parse_file(f) + parse_file(f, toppat) f.close() - if variablewidth: - stree = build_size_tree(patterns, 8, 0, 0) - prop_size(stree) + # We do not want to compute masks for toppat, because those masks + # are used as a starting point for build_tree. For toppat, we must + # insist that decode begins from naught. + for i in toppat.pats: + i.prop_masks() - dtree = build_tree(patterns, 0, 0) - prop_format(dtree) + toppat.build_tree() + toppat.prop_format() + + if variablewidth: + for i in toppat.pats: + i.prop_width() + stree = build_size_tree(toppat.pats, 8, 0, 0) + prop_size(stree) if output_file: output_fd = open(output_file, 'w') @@ -1316,7 +1358,7 @@ def main(): f = arguments[n] output(i4, i4, f.struct_name(), ' f_', f.name, ';\n') output(i4, '} u;\n\n') - dtree.output_code(4, False, 0, 0) + toppat.output_code(4, False, 0, 0) output(i4, 'return false;\n') output('}\n') From patchwork Tue Jun 9 16:25:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 187680 Delivered-To: patch@linaro.org Received: by 2002:a54:30ca:0:0:0:0:0 with SMTP id e10csp563650ecs; Tue, 9 Jun 2020 09:29:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDT7kVxx774N/gO1S2ZEG2tTZtTXK39JOfyVziJ4FXVx6LHlSbdh6bWZQodvIbWDOsmF0J X-Received: by 2002:a05:6902:4e9:: with SMTP id w9mr7231885ybs.311.1591720196209; Tue, 09 Jun 2020 09:29:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591720196; cv=none; d=google.com; s=arc-20160816; b=nk7/nBkRmMFZb5z4Og3KaboHdqMindFKCIaONunfCmJiFGKifNXkLMeCWhZK3d1Vjk KHkSXCZtUseaAQQoZpF4hYYR6Z1+5kTGFafiWjCi/cJQ2xjgDJ9BkgFNsS3mcXW7Kxug UcMkQjJ/acgt0IB2Syoa2d/i74XwaJkrcTG0Q4hbPNwmnbQj2Be+mTI3eWCrLnzKMls7 0M1f/v1Ja9OQU5aP0YEnzyyjHRu/eBXTxUxCgkiHyf94cOuZfXtWeKE67j0xu1KNwZQZ aosYjRNBNxhovSh4fghplrZoMwuv9JKoSW8B1LYUus7OCyumzQmk+6BuJ6tGrYB/BrDE 0qbA== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=+utQoTLUzPPlGyk84vqSkSI1IEc8oNkKhMpAe11BE/0=; b=vR7ix8ZvenWNLZtbCGWYgNAE0NYRee1C4liw9Pm3rsSw346c+aSHqMSi5QVRVazHD/ vmEptHl9ftuaRS4AMxHP9ddhriTkLKm43rJO81bAwXX06rAuK6yDUkZMapfykNZU0mAk iJBzHgZ2maTOoU+f7+PuiBibdpV6MeAuNS0Pu8fOxr8P5GufB3qK0ygDYs6zoOMxF3ag dX4r5tQVddAx9NZ90gT4HGqsvf/WYTzbXqxRTEI7pl2zwCKrPsq2XVfFNaeoOR6rNdHD dT9xSSQF0whjN+fPplUjY1We77WpADkhHW1Ek0fLFOsOSrUQxONmRupB+p+lAemF1f8c f/nQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jw8PR3y9; 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=pass (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 188si2756181ybq.274.2020.06.09.09.29.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Jun 2020 09:29:56 -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=pass header.i=@linaro.org header.s=google header.b=jw8PR3y9; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:34910 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jih8N-000781-K3 for patch@linaro.org; Tue, 09 Jun 2020 12:29:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47074) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jih3t-0000Du-3I for qemu-devel@nongnu.org; Tue, 09 Jun 2020 12:25:17 -0400 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]:36650) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jih3r-0000UM-TQ for qemu-devel@nongnu.org; Tue, 09 Jun 2020 12:25:16 -0400 Received: by mail-pj1-x1030.google.com with SMTP id q24so1631475pjd.1 for ; Tue, 09 Jun 2020 09:25:15 -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=+utQoTLUzPPlGyk84vqSkSI1IEc8oNkKhMpAe11BE/0=; b=jw8PR3y9V5Xa/5bOnmXERg83JB6cjNV7kFHAJFLnzvWme9G0vNky5sZt3Fp13J7JTt OcOmPN9/j37LxDedFOfKeBtKzGqDAv8FLl6AG8y5KRHwI5vv6qwE54Y+kwDx4l9f2Mw7 bk06ot5r7NywCoakswwjaygPlKi9gHGk8FUvrGfoTKSlDNCRDF8b6wbGyRtUVOoRqtnv GNMTVoc+zIIphz692L1n7iWhsZMxmIxdJkgTPMfv0Gi+gKgNw7XZ7xbr+NUbtZZ1Mp0G 2OoQcLA8D+/1IXAv4ArYq6zqpE8Kw1BUzprxuT8xabjfJnR367sivimud9Hw2u+YP1jb 8TnQ== 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=+utQoTLUzPPlGyk84vqSkSI1IEc8oNkKhMpAe11BE/0=; b=jiclsF0aRx7JgymGaVCfCcJD09SdU2TzvOABdx7Gm0h7E3m5Wg01DqWMUe348j3J3N c7ueiQ0S4/hxnet9D80snuYgcixtLUbyDdxkd1cI5DxusWf0iDtnO4OI628Mje+KHQYD WjlAFd1IiJvYI/gmzuzzME4dNWUETD4ILHGlCkR5gBDCwHGOpXWWsje2d7s7bsGuHLs9 gROq1/7/e+9acn9XqoCOa5/phkkb8ra9OaL90HMUoiCnfr+Y6WOiqqqN9T7NZCOCMQIK TQt6eHlXLNKt6KzA0ZVeII0Atarwmg1T0DzPN2DPDqrx0eEugmryu2yblmgaDkURIF3r QV3g== X-Gm-Message-State: AOAM532fhzc/Ysa9sjqf67I3UU2Vbt0QNfvojHxBHssacU4ICo8BcBzT RoVD/FRp2JsB7+iPLcEonFaLGLUJNe0= X-Received: by 2002:a17:90a:64cb:: with SMTP id i11mr5782251pjm.193.1591719914045; Tue, 09 Jun 2020 09:25:14 -0700 (PDT) Received: from localhost.localdomain (174-21-143-238.tukw.qwest.net. [174.21.143.238]) by smtp.gmail.com with ESMTPSA id s188sm7580101pfb.118.2020.06.09.09.25.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2020 09:25:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 6/9] decodetree: Implement non-overlapping groups Date: Tue, 9 Jun 2020 09:25:01 -0700 Message-Id: <20200609162504.780080-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200609162504.780080-1-richard.henderson@linaro.org> References: <20200609162504.780080-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1030; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1030.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" Intended to be nested within overlapping groups. Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Suggested-by: Peter Maydell Signed-off-by: Richard Henderson --- scripts/decodetree.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) -- 2.25.1 diff --git a/scripts/decodetree.py b/scripts/decodetree.py index 0ba01e049c..7e3b1d1399 100755 --- a/scripts/decodetree.py +++ b/scripts/decodetree.py @@ -1021,16 +1021,20 @@ def parse_file(f, parent_pat): del toks[0] # End nesting? - if name == '}': + if name == '}' or name == ']': if len(toks) != 0: error(start_lineno, 'extra tokens after close brace') if len(parent_pat.pats) < 2: error(lineno, 'less than two patterns within braces') + # Make sure { } and [ ] nest properly. + if (name == '}') != isinstance(parent_pat, IncMultiPattern): + error(lineno, 'mismatched close brace') + try: parent_pat = nesting_pats.pop() except: - error(lineno, 'mismatched close brace') + error(lineno, 'extra close brace') nesting -= 2 if indent != nesting: @@ -1044,11 +1048,14 @@ def parse_file(f, parent_pat): error(start_lineno, 'indentation ', indent, ' != ', nesting) # Start nesting? - if name == '{': + if name == '{' or name == '[': if len(toks) != 0: error(start_lineno, 'extra tokens after open brace') - nested_pat = IncMultiPattern(start_lineno) + if name == '{': + nested_pat = IncMultiPattern(start_lineno) + else: + nested_pat = ExcMultiPattern(start_lineno) parent_pat.pats.append(nested_pat) nesting_pats.append(parent_pat) parent_pat = nested_pat @@ -1067,6 +1074,9 @@ def parse_file(f, parent_pat): else: parse_generic(start_lineno, parent_pat, name, toks) toks = [] + + if nesting != 0: + error(lineno, 'missing close brace') # end parse_file From patchwork Tue Jun 9 16:25:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 187681 Delivered-To: patch@linaro.org Received: by 2002:a54:30ca:0:0:0:0:0 with SMTP id e10csp565490ecs; Tue, 9 Jun 2020 09:32:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtKn/srlOjRftHlKaAz01KhWmODLsdyMuuAZvJ/Tp7UyalHC83v7qJaOiJEBtxlB/gQOby X-Received: by 2002:a25:15c8:: with SMTP id 191mr8158130ybv.31.1591720350694; Tue, 09 Jun 2020 09:32:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591720350; cv=none; d=google.com; s=arc-20160816; b=f1Y3sSkg124PNPtR7dDovSqfWXVWhKBVZvRmLCWrF/zt9hdE956ZcwzLVpFr1E3jz5 F1WiWeGLFZfOerxB0XZBQ2+PZ/CEIOJ9Zoc/+eKrIK0qXyax/V915o2RYb6v924va4ID EFB5qU75x4fw1dh1xgEol/92u5WZ8PrRDVtLngsqTIO6xUsoQfs0fw56fM1n9GSlfpDY TWuciCVv5NBxkb1cvktbh6Xh/o+xMKF/N3nWMt44UX0zKO8IQ/SJYXMRfe6AF8DhlZaH lVkfDeQDRQGWi43U4Im1WXKko/MU5Q6EatO7fej2ROi0k1NKdCm/clamtROT24YmZch3 ae2w== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=hsQjYBDuR7uMW5e0uYusrSNyQMrEa5twml8sjwRrMW8=; b=h2tMjRBGRAEX9HX55ZzD5+df1rmGIgF8qwwhgzISgXBrVpzPBTRUzj6j/RIQx8dIz4 ICb7J5YbhbdqU7M42AoNtKHyMrg7YFUxWbh2+NWwUVTNZTpHNY/DWLU9TakfayPHlsju 1730irQBGHMzskgaSAzC+kk57gVmintWxe/gz//PkKeeHW2hJj2Ix2e9vALnCk+IZKDw v+7tTtimUzdjzuctnsFY2pB5mw4+xiC3cJg15SXyRxXeCovE7s4Znb5Hcj+1bv5soM1V swV9SL/et3KXatsSm8DXsAvV5tzI/Z4PvwKlH/l0gEHZsCYuh2zLcmS7IoFYtGSN15AH 8AUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dFCKCDTm; 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=pass (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 e1si2793672ybp.19.2020.06.09.09.32.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Jun 2020 09:32: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=pass header.i=@linaro.org header.s=google header.b=dFCKCDTm; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:42130 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jihAr-0001tH-KX for patch@linaro.org; Tue, 09 Jun 2020 12:32:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47080) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jih3u-0000FP-11 for qemu-devel@nongnu.org; Tue, 09 Jun 2020 12:25:18 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]:43400) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jih3t-0000UZ-0W for qemu-devel@nongnu.org; Tue, 09 Jun 2020 12:25:17 -0400 Received: by mail-pf1-x430.google.com with SMTP id 23so9395783pfw.10 for ; Tue, 09 Jun 2020 09:25:16 -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=hsQjYBDuR7uMW5e0uYusrSNyQMrEa5twml8sjwRrMW8=; b=dFCKCDTm8UMbyZA0Ej7XhjyhSNQQsDQ6n3IpD3GsbgIQwjbpsV6V7f8YVdxsYKY35H xMAcGZjMiXhpspl6tpQyPEcEXcsx8egp4LtW4wUkrc2M0v/YPWwObJ85yKCnX5+1fcmH U1ZKqsGPcosaNE1SdKNirZemqudhMy2UtsQtNJ9UK59hzlqfKcqzzvhMtGd9OfpR5Kz/ l7WNNC6ejp25v+tXJcnM+4u7VNP2R/bSXCi3DfMDgtSRKVpmchfOzYlGejDBRNOxSqNt bfslRxa2AqMEBRSKlJRdJ0v7wK4DkIzfaFYDP2dX2xkf0Hu/AYRn/vupbZKcoHBV6C2C rq9Q== 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=hsQjYBDuR7uMW5e0uYusrSNyQMrEa5twml8sjwRrMW8=; b=Yc+F3W0ekdjLT5ysadN4/Ljoaa4szLUdHVHdlG9oLcWZL5Kj1jbrdmOvUHLXM9xXSR k92afFF9/inSw54Ty6Ya5ukFLdYPLPJzHsB2NlSFsz3TgbLzKQBaXFNxnwTbPnGGujD0 qCH1619gyvxsQzLtQL+4XDMfM1FsnsxQXidxt5/aLQw8OUb1FfOM4cLUBj1juhPhrdyx F4wiDgOTUYvYK/su0qedzGREuvRw8SsT1/8hXFUOzeB14Zl+rK2U+sxRCiaZ9GvPrIVa jKpBy9pekhEpWCTu9lKjX60u7vzRl101Z97l0OOHv7HTL/cWdcABzXfCnc2dmYjqd4cK k3dQ== X-Gm-Message-State: AOAM531z5C4eaxMRVW+Wu2IIrIoo5EPaDE1sdmqA8VZ/jJ8ipYlphar4 uAMe7fxllmCLeIYEuibGPp2FxGxN88I= X-Received: by 2002:a62:5c03:: with SMTP id q3mr4823594pfb.58.1591719915179; Tue, 09 Jun 2020 09:25:15 -0700 (PDT) Received: from localhost.localdomain (174-21-143-238.tukw.qwest.net. [174.21.143.238]) by smtp.gmail.com with ESMTPSA id s188sm7580101pfb.118.2020.06.09.09.25.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2020 09:25:14 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 7/9] tests/decode: Test non-overlapping groups Date: Tue, 9 Jun 2020 09:25:02 -0700 Message-Id: <20200609162504.780080-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200609162504.780080-1-richard.henderson@linaro.org> References: <20200609162504.780080-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::430; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x430.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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: Peter Maydell Signed-off-by: Richard Henderson --- tests/decode/err_pattern_group_nest1.decode | 14 ++++++++++++++ tests/decode/err_pattern_group_nest2.decode | 6 ++++++ tests/decode/err_pattern_group_nest3.decode | 14 ++++++++++++++ tests/decode/succ_pattern_group_nest3.decode | 11 +++++++++++ 4 files changed, 45 insertions(+) create mode 100644 tests/decode/err_pattern_group_nest1.decode create mode 100644 tests/decode/err_pattern_group_nest2.decode create mode 100644 tests/decode/err_pattern_group_nest3.decode create mode 100644 tests/decode/succ_pattern_group_nest3.decode -- 2.25.1 diff --git a/tests/decode/err_pattern_group_nest1.decode b/tests/decode/err_pattern_group_nest1.decode new file mode 100644 index 0000000000..7d09891a1c --- /dev/null +++ b/tests/decode/err_pattern_group_nest1.decode @@ -0,0 +1,14 @@ +# 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 + +# Make sure braces are matched +{ + top 00000000 00000000 00000000 00000000 + [ + sub1 00000000 00000000 00000000 ........ %sub1 + sub2 00000000 00000000 ........ ........ %sub1 %sub2 + } +} diff --git a/tests/decode/err_pattern_group_nest2.decode b/tests/decode/err_pattern_group_nest2.decode new file mode 100644 index 0000000000..c172239e9b --- /dev/null +++ b/tests/decode/err_pattern_group_nest2.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. + +# Make sure braces are matched +{ + [ diff --git a/tests/decode/err_pattern_group_nest3.decode b/tests/decode/err_pattern_group_nest3.decode new file mode 100644 index 0000000000..b085d01410 --- /dev/null +++ b/tests/decode/err_pattern_group_nest3.decode @@ -0,0 +1,14 @@ +# 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 + +# The exclusive group should error for overlap. +{ + top 00000000 00000000 00000000 00000000 + [ + sub1 00000000 00000000 00000000 ........ %sub1 + sub2 00000000 00000000 ........ ........ %sub1 %sub2 + ] +} diff --git a/tests/decode/succ_pattern_group_nest3.decode b/tests/decode/succ_pattern_group_nest3.decode new file mode 100644 index 0000000000..156249f090 --- /dev/null +++ b/tests/decode/succ_pattern_group_nest3.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 00000000 a:8 b:8 c:8 + sub2 00000001 a:8 b:8 c:8 + sub3 00000010 a:8 b:8 c:8 + ] + sub4 000000 d:2 a:8 b:8 c:8 +} From patchwork Tue Jun 9 16:25:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 187678 Delivered-To: patch@linaro.org Received: by 2002:a54:30ca:0:0:0:0:0 with SMTP id e10csp562193ecs; Tue, 9 Jun 2020 09:27:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzHbCn/xM++/SzW8lWb3rLayvEyB6TssAqSDTW0/P8FCYvSFMXKYm9i99wFssdRtw8roUF0 X-Received: by 2002:a25:be05:: with SMTP id h5mr7447610ybk.431.1591720067742; Tue, 09 Jun 2020 09:27:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591720067; cv=none; d=google.com; s=arc-20160816; b=LtSUyMtTZ+rw4j5JeK/QLL7G5lFvOEfo2dK83dxPKg0ZnK8GPON9eB9WJ+NlhYdayX kejl3rXsjzQxIneAW8pvBgHXB/vthbqcjBiBaEDtKQkHbVz/wfejWfpdMo6vtywSTbtv H1YDinKzoN9Yap3lwL2MiptFqeJGKKF9fVQqdedvAG0bSTk3rBh+4ctwNVaO2skf5Rhe 8pHPAlAs5aYI8Kz8OJQAyOG0CUJeyTuGly9lOEiSseh6gzD0pTpMpZcuTl0+FgiapgjM ux5G/J6JAAgZ3u//tyxF+vYiD34okWiQ3AdWvd1jV/vtK+v4T5I8oKkHuPrq+LCURlEh CF6w== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=7rP6ON/rwFD7r5kwGH+K6LUDEi9rTYztwFSHBdHa/4Q=; b=mCMWx6/ma5BpboMd3ntGdekK1uvhENsJ3qB0xdSeqUp8C4EnY+u4yvrz7Z8+xfSxEk A4XuYlue3y6b+KnFvWfygF9kxg+5joT0h5fsACNpWZXwpq1Vr5O905CVuqfRyDWAVJZn q+8e+/MLC9t+Rmo7tlJGxLYV8b99nUBPrVYxwJV082h3snpVSMlxQu2Y2LdNWLdmBkjA 09LqBIEjB2t93ch+EA5b8VvGX1RE0jrHOMDcCk7puJDjhJRBCVaNvxjAFdLw18AMeQd/ O6V8HJHLJppnTk9jovDs0lncDTiQVGH3R97lEUqTUKzKuDgg64FRv1nTdPqSxx8okFAi 4UAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vMJdhxRW; 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=pass (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 n66si3007047yba.117.2020.06.09.09.27.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Jun 2020 09:27:47 -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=pass header.i=@linaro.org header.s=google header.b=vMJdhxRW; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:55120 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jih6J-0003ik-07 for patch@linaro.org; Tue, 09 Jun 2020 12:27:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47090) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jih3v-0000I4-Ja for qemu-devel@nongnu.org; Tue, 09 Jun 2020 12:25:19 -0400 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]:33126) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jih3u-0000Um-Hv for qemu-devel@nongnu.org; Tue, 09 Jun 2020 12:25:19 -0400 Received: by mail-pj1-x1030.google.com with SMTP id b7so1162945pju.0 for ; Tue, 09 Jun 2020 09:25:18 -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=7rP6ON/rwFD7r5kwGH+K6LUDEi9rTYztwFSHBdHa/4Q=; b=vMJdhxRWGLm6pPXW2y8pTcgbhwSh+tfHLg9SMQJIN0WGtrLWkhZXnZgOeN9BUoyGyF mfdsqECDxLy7FthmUyfEv62tSV0Xu9cIE5cZjyGyzng3nxcI9rJBQffCYfjTMM8FMSNS F1eq1Plh6gX+FId4Xh6NeAJLZIGZopbAD8A9PcJL0BajcopDHaPAPJwNpR1ZvYUIIR2h OF1tuOXmcQxLbDm9Lml8rO0BJ1RrK4Iwgv5JCZ8VKBF1+G/0IJkLOO4K4T5BoeIdYC+K FNGITovtEeM86qB6IIAa0sxP+y1o7DS2Zkp3CRcmO8CXXNy6+bqKwgTXpU8w2P9lPgoe 7OAQ== 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=7rP6ON/rwFD7r5kwGH+K6LUDEi9rTYztwFSHBdHa/4Q=; b=dOrYeRY3l/PegVsHHy+mLGANiyMMFiTE9Ytlk+rE6m6cVvzpN/q69+NnZou1XNha9h fV0VVcGqS2NewkYTZ3sFfRVoQEmit3Y5/laA0kN/y2LBOQrBl/SZkPesTWR5J3wI4BXs XQJEpjFQNhcyctGGqZNrn8avLzClHnFf+OzOayImYMLp59nKgz7Pci7FMYcSQZeKZxAG 1ah7mQlVuLjhM4f1A2QHeimMsHrLWk8EARrpIypS4koC6emYDuwJwjJ9RW0ZEGm/OW/A hS2ouXpX0FXNbx2hWuvz73RPk9AkRCloePvU83mwOPMtZ7CZloKUWLZpYHYlwmWxVstf jWmw== X-Gm-Message-State: AOAM530e1kJcHIfg8vfjGeFem230hfqmPhHy9IVYONMhK+cf6fEwWPuK Epy6r9uuh5s+exBhlf8ycLBq6p1ipcQ= X-Received: by 2002:a17:90a:d803:: with SMTP id a3mr6048786pjv.125.1591719916799; Tue, 09 Jun 2020 09:25:16 -0700 (PDT) Received: from localhost.localdomain (174-21-143-238.tukw.qwest.net. [174.21.143.238]) by smtp.gmail.com with ESMTPSA id s188sm7580101pfb.118.2020.06.09.09.25.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2020 09:25:16 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 8/9] decodetree: Drop check for less than 2 patterns in a group Date: Tue, 9 Jun 2020 09:25:03 -0700 Message-Id: <20200609162504.780080-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200609162504.780080-1-richard.henderson@linaro.org> References: <20200609162504.780080-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1030; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1030.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" While it makes little sense for the end product to have a group containing only a single pattern, avoiding this case within an incremental patch set is troublesome. Because this is expected to be a transient condition, do not bother "optimizing" this case, e.g. by folding away the group. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- tests/decode/succ_pattern_group_nest4.decode | 13 +++++++++++++ scripts/decodetree.py | 2 -- 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 tests/decode/succ_pattern_group_nest4.decode -- 2.25.1 diff --git a/tests/decode/succ_pattern_group_nest4.decode b/tests/decode/succ_pattern_group_nest4.decode new file mode 100644 index 0000000000..dc54a1d285 --- /dev/null +++ b/tests/decode/succ_pattern_group_nest4.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. + +# Verify deeper nesting, and a single element in the groups. +{ + [ + { + [ + sub1 00000000 a:8 b:8 c:8 + ] + } + ] +} diff --git a/scripts/decodetree.py b/scripts/decodetree.py index 7e3b1d1399..530d41ca62 100755 --- a/scripts/decodetree.py +++ b/scripts/decodetree.py @@ -1024,8 +1024,6 @@ def parse_file(f, parent_pat): if name == '}' or name == ']': if len(toks) != 0: error(start_lineno, 'extra tokens after close brace') - if len(parent_pat.pats) < 2: - error(lineno, 'less than two patterns within braces') # Make sure { } and [ ] nest properly. if (name == '}') != isinstance(parent_pat, IncMultiPattern): From patchwork Tue Jun 9 16:25:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 187676 Delivered-To: patch@linaro.org Received: by 2002:a54:30ca:0:0:0:0:0 with SMTP id e10csp561066ecs; Tue, 9 Jun 2020 09:26:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxA3+KfMGjSC5qNIPu+u2vPNgA/QvxmsUuPWdlhp9G9R/JJ9Xrf6b2IZ3iQS7k0/kT9RspC X-Received: by 2002:a05:6902:1007:: with SMTP id w7mr9116058ybt.217.1591719970953; Tue, 09 Jun 2020 09:26:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591719970; cv=none; d=google.com; s=arc-20160816; b=eYQLAXuOi8E9FcZzjlsfORhhhi43tBrTzD0cyP7jIm40lV9mhgxXbqUjrcd+vQ5ZEP kRo8BY0AiXP9RpMbcXzkEE9bnv4i4AlliZyFCopEayNOAhH66mI+u9F3iAIszQU/O5+U s4frIQ3EuFoqiD6ZL0HOicGPD2iMDbmfmUpKmsGq06fbDo9e2wfqbtBIT5Mwdun7taek yJHrVWYf0QF5pm+bU5bv6PUWukDA9YjYbw6NvzjLHUKIpcMIHq70y10CI+5B6HQCSioF QR6mHNu/KeR6E+jAHBjeqHY99ElORAFt8dMjsCUwu4vDeDT9TXcniixfv34/G94KRSqQ gK+w== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=8qc6oDN4Zl6MEuNRZIzxS7SMNWB7rYpnfgGgJ3Ds2L8=; b=Nz92htOD5OqJWNEM1DvPETOA1W5pT3h1XhXZnt57UJIAJlA2Df379CCHYFBA0+FmK1 sS4i29rRDvt0V3wLXNTgweiAftjz4Uw8an+oYebD1zmnTrodk51dl+a+PQwLEQhRFfVo qOAjwk0jHTsk+/l4XGIMUxMultlEc7GH5zkWCXj+2eMfKCkAUxyEj0D1H+SL98TIG4q5 JFZpattURsGodMQyruge/6BS1L7ehaO2RVaB2WBd/nM9D02/c2jvMZlk25hlYm8/m2Qf FRwKZitE7RJQ2X9p/wHDNdbWfwnhm/fIvNkYJOCWtP7pxPV6YMIYFLCM31uqEKB6P8b9 mX7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RERi4p32; 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=pass (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 d5si1877797ybo.101.2020.06.09.09.26.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Jun 2020 09:26:10 -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=pass header.i=@linaro.org header.s=google header.b=RERi4p32; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:47228 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jih4k-0000PE-4v for patch@linaro.org; Tue, 09 Jun 2020 12:26:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47096) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jih3x-0000LW-L3 for qemu-devel@nongnu.org; Tue, 09 Jun 2020 12:25:21 -0400 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]:35838) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jih3w-0000Ux-7d for qemu-devel@nongnu.org; Tue, 09 Jun 2020 12:25:21 -0400 Received: by mail-pj1-x1035.google.com with SMTP id i4so1631388pjd.0 for ; Tue, 09 Jun 2020 09:25:19 -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=8qc6oDN4Zl6MEuNRZIzxS7SMNWB7rYpnfgGgJ3Ds2L8=; b=RERi4p32fnYEwO1aJGCC2a0euZ7IP0MZUdQPy4PRigx5sz+5KcV9fOV478Cv1hpSIZ 5LKnUN1ehm+vBukvD7vYusKn27PGCwRT8WV81XMy5gT2HfQFJUuha0mJgt5GcRpoXIYC sxLkPpGhHGEi3iFJqmwTpxjoG1AgtytU/3j61Q+y3UtmkQuTrGSU2M9wC+F/wj4Z3xlo vCmTd/QLj+AsdsiUb4gaCRvwFzrQfO+tCfagxGUqcYfta3lQFMzZWqRDfuUsBm9sRo+n Wkf21mJhhYSf6212mXXR4qOVWxjefHP7ugVMapYTgbROgtQDNIxRQtv1It3WSaIgBwnQ XMfQ== 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=8qc6oDN4Zl6MEuNRZIzxS7SMNWB7rYpnfgGgJ3Ds2L8=; b=O9DT1R3Om3xWGNjAhPGCaknoDEFSXHUaSu5L4pa6di6IeNlLJPNjt7q5Raa8Mx5lVL bln2GzQ8UcCeVnm7VlAl1NK+P2C8DPb3ztGcCgZPIug/z1+U35FGDbwQ5muCzYunw2Xw mOXAUF9aa1zyH/aogdZmXxrAoPQLzwU8QnBM9Ctb/AfZlsNP+9uzO5e1YtsBc9s2qxCH dzSa3K/FyZoh2t2n/qx8zL9cPuBAUy8MtWZBKWzo4j8VIQpw18SgljO5WeAZQVvttj7J rXAhcJx0kFvqKofJyGMIAzzQMHV2/grvb9CznpvQ41RLCUvRcvS9tRF/Ci9Re5BvsddP aQtg== X-Gm-Message-State: AOAM533D9xA2ZbWEJ7gCmryIhUieVjHRXUH8g82SGHbepBQJp0jvK79+ YkK6yh2a8jkIdDJ3B6LOZRo86exfqno= X-Received: by 2002:a17:90a:266f:: with SMTP id l102mr6133308pje.190.1591719918369; Tue, 09 Jun 2020 09:25:18 -0700 (PDT) Received: from localhost.localdomain (174-21-143-238.tukw.qwest.net. [174.21.143.238]) by smtp.gmail.com with ESMTPSA id s188sm7580101pfb.118.2020.06.09.09.25.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2020 09:25:17 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 9/9] target/arm: Use a non-overlapping group for misc control Date: Tue, 9 Jun 2020 09:25:04 -0700 Message-Id: <20200609162504.780080-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200609162504.780080-1-richard.henderson@linaro.org> References: <20200609162504.780080-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1035.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" The miscellaneous control instructions are mutually exclusive within the t32 decode sub-group. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/arm/t32.decode | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.25.1 diff --git a/target/arm/t32.decode b/target/arm/t32.decode index c63082fc9c..c21a988f97 100644 --- a/target/arm/t32.decode +++ b/target/arm/t32.decode @@ -312,13 +312,13 @@ CLZ 1111 1010 1011 ---- 1111 .... 1000 .... @rdm &cps # Miscellaneous control - { + [ CLREX 1111 0011 1011 1111 1000 1111 0010 1111 DSB 1111 0011 1011 1111 1000 1111 0100 ---- DMB 1111 0011 1011 1111 1000 1111 0101 ---- ISB 1111 0011 1011 1111 1000 1111 0110 ---- SB 1111 0011 1011 1111 1000 1111 0111 0000 - } + ] # Note that the v7m insn overlaps both the normal and banked insn. {