From nobody Mon Feb 9 21:38:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1591720008; cv=none; d=zohomail.com; s=zohoarc; b=j9IGMvQp7EfPunlHCX+xPBYu2wyTgk47zBghXdMOLAKKiXqrLkZkdBsuwPQn4AXtxyGGKcc85W2P5YZ8pCyyuKLleTD5T3+2OjnZNflCiUaOQq5n2B8uFcBQN4Jwr9jfaxM3+OCOEau7iHTnl3Phov9PZeA+xgG6sdvwY2hLXpI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591720008; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=b/XVcjpntbxdGusUz05j9FBinJNgwBz4HL/Wlk1yj2E=; b=UWEctKKavgVAWvrBvuctLr+bdBrI62iVsIxTm+IpELssCk0ibs/jDLwH68jx0k3lSHjGJZ0ahPfx/GKChGkbJ5vS1o8QeutQvsGvHrLOSUPlmBs7iXLT6VOsoTRDBz5xRj8pLnN/D/D96wS1iDhAGWT2fP8wOK+VhE+a5sZ8/dI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1591720008235785.2270008733319; Tue, 9 Jun 2020 09:26:48 -0700 (PDT) Received: from localhost ([::1]:50658 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jih5K-0001sq-Jf for importer@patchew.org; Tue, 09 Jun 2020 12:26:46 -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) 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) 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-Google-Smtp-Source: ABdhPJwjXfQib48kwkv/wb0zeU2pxbzpP6iCwsDZl0FIVD12yXSOU+frgPQLBDdH5RDstObCHY4PRA== X-Received: by 2002:a63:d318:: with SMTP id b24mr23270750pgg.403.1591719907745; Tue, 09 Jun 2020 09:25:07 -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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" 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(-) 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 =20 + prefix =3D '' + if file: + prefix +=3D '{0}:'.format(file) if lineno: - r =3D '{0}:{1}: error:'.format(file, lineno) - elif input_file: - r =3D '{0}: error:'.format(file) - else: - r =3D 'error:' - for a in args: - r +=3D ' ' + str(a) - r +=3D '\n' - sys.stderr.write(r) + prefix +=3D '{0}:'.format(lineno) + if prefix: + prefix +=3D ' ' + print(prefix, end=3D'error: ', file=3Dsys.stderr) + print(*args, file=3Dsys.stderr) + if output_file and output_fd: output_fd.close() os.remove(output_file) exit(1) +# end error_with_file + =20 def error(lineno, *args): - error_with_file(input_file, lineno, args) + error_with_file(input_file, lineno, *args) +# end error + =20 def output(*args): global output_fd --=20 2.25.1 From nobody Mon Feb 9 21:38:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1591720000; cv=none; d=zohomail.com; s=zohoarc; b=R/6wDMKckjM09y0hhTYkWQSXuWKgTPfLwP0pCH0NRFQLuo5jHzGVEzji3f8XkPUNQtfPhbxj0ZxmrSoRP85e5Ys2c27Ji8De0Oj+9PWQkX+Y837umOv+qzk1QhY/VsBsWcjD1NMEl7WQ+ql3mKp8f4YyyTYNGoLzjBnJEFLVuVs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591720000; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=fuj4+EzL4ACqWfECVnWjXkyBK0NkdZBLVsNebnwCJQ0=; b=lmrbkKexqWjkP7pdkyQhhHzxyijeOXdPwQBqWiaRQsQhzfqxlabA/hzmcRDdYt4kMwjNAv1juaT8vEBAFwb91eDRssXRfucoHjtxjRghHKmWbMChLG9TqzdZQ8I2HXutiF9ijqSPHx6K75gUpiIV+FAp4mUZq/jeP0i75usp8oY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1591719999952490.59236695170534; Tue, 9 Jun 2020 09:26:39 -0700 (PDT) Received: from localhost ([::1]:50452 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jih5C-0001nz-Gc for importer@patchew.org; Tue, 09 Jun 2020 12:26:38 -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) 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) 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-Google-Smtp-Source: ABdhPJzuYmkQJ+CjZGAi4pu2hy3b1bAPjBhj4OdgEuct3F9nFGKljU0Nn77PgVjQJVXp1KR1Dg4bRA== X-Received: by 2002:a63:5d19:: with SMTP id r25mr24723423pgb.360.1591719909156; Tue, 09 Jun 2020 09:25:09 -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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Name the current node for "inclusive" multi-pattern, in preparation for adding a node for "exclusive" multi-pattern. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- scripts/decodetree.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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 =20 =20 -class MultiPattern(General): +class IncMultiPattern(General): """Class representing an overlapping set of instruction patterns""" =20 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 =20 =20 def parse_field(lineno, name, toks): @@ -751,8 +751,8 @@ def parse_generic(lineno, is_format, name, toks): .format(allbits ^ insnmask)) # end parse_general =20 -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 =20 @@ -792,9 +792,9 @@ def build_multi_pattern(lineno, pats): else: repeat =3D False =20 - mp =3D MultiPattern(lineno, pats, fixedbits, fixedmask, undefmask, wid= th) + mp =3D IncMultiPattern(lineno, pats, fixedbits, fixedmask, undefmask, = width) patterns.append(mp) -# end build_multi_pattern +# end build_incmulti_pattern =20 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, ' !=3D ', nest= ing) pats =3D patterns patterns =3D saved_pats.pop() - build_multi_pattern(lineno, pats) + build_incmulti_pattern(lineno, pats) toks =3D [] continue =20 --=20 2.25.1 From nobody Mon Feb 9 21:38:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1591720170; cv=none; d=zohomail.com; s=zohoarc; b=MTE7u5ORU4feFqcjSb0HpMi0l6mvaJUu/BxIO0FtMjikWT99DvNmhFZ3waMf2Ewlcns8to+091cDJTMdO+vzopcHDbt/Tzr30GiPOac/4kOoaixZ/8m9exC9exPxtt3eGlHG0NEFP3ys8LkjmuAlDSX7AqGxE7psyl6YY/ouliw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591720170; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Pya0L8DMOCjwgXBO0A8MFuLM5jSzTOZ88OjOprsge18=; b=VnypvvAFtVnYNa/eqHtMpzBX9LzhfWgaDUPQuFm0U6ZmMwxwQrYdoo8ntHgNdgJXNo/1o1ZFkLE0csiQTtSMUOZh3v0V9J5hAgdj7WqPH799JskE3MyGnxgWinKAUvpssBsSbnlKOdF1pRL0BKsn8H91qL2ag5ttFH/3IAVzOIQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 159172017052339.282575931927795; Tue, 9 Jun 2020 09:29:30 -0700 (PDT) Received: from localhost ([::1]:33860 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jih7x-0006h5-9b for importer@patchew.org; Tue, 09 Jun 2020 12:29:29 -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) 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) 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-Google-Smtp-Source: ABdhPJxRW2VzbjbHy4poDF4Fn0PZoblwY9Or2ukbejwAEJLoDzuvdlHDCKPhlCn9/VwVpMq8rpY7Hg== X-Received: by 2002:a17:90b:283:: with SMTP id az3mr5760784pjb.232.1591719910441; Tue, 09 Jun 2020 09:25:10 -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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- scripts/decodetree.py | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) 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 =20 =20 -class IncMultiPattern(General): +class MultiPattern(General): + """Class representing a set of instruction patterns""" + + def __init__(self, lineno, pats): + self.file =3D input_file + self.lineno =3D lineno + self.pats =3D pats + self.base =3D None + self.fixedbits =3D 0 + self.fixedmask =3D 0 + self.undefmask =3D 0 + self.width =3D None + + def __str__(self): + r =3D 'group' + if self.fixedbits is not None: + r +=3D ' ' + 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""" =20 def __init__(self, lineno, pats, fixb, fixm, udfm, w): @@ -384,16 +409,6 @@ class IncMultiPattern(General): self.undefmask =3D udfm self.width =3D w =20 - def __str__(self): - r =3D "{" - for p in self.pats: - r =3D 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 =3D str_indent(i) --=20 2.25.1 From nobody Mon Feb 9 21:38:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1591720128; cv=none; d=zohomail.com; s=zohoarc; b=CMv+NVxV8l/qARmX/CpwLGuwGWx2iVj6fgrYHFTxB7DocUFX1tv6nFDhtZVp6Ha8jTQNQt6qn/0cZPoy+9FLM/Cm68yvegsxJ76wt6TQYJkewwtXcc944zDjPA+/4djsKEZRT8+ktcXkocUYfcH83PSb1C1IIoQAc5HuTFKihbA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591720128; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=D9iJwfXIlrrZhBoa0zYBpMpQDudGom24uMHOfJzYaos=; b=Bl0Ox6i+tJi+PoXEZxGLD2wERF6XsxHnE3lmvDAx1AQLNzsk094jrbwg+szLZTTt5rzCADlfxM7CaDhK7oupNvYz6Q6oLetWkwPWb1dJu+ENW4Zl/mQuByspgtEOwxCmaT3l+BcssLGR/Le3KNKgc2tozAfihqNKHR9j6yIf1L8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1591720128355207.5256804130081; Tue, 9 Jun 2020 09:28:48 -0700 (PDT) Received: from localhost ([::1]:58664 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jih7H-0005ER-0x for importer@patchew.org; Tue, 09 Jun 2020 12:28:47 -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) 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) 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-Google-Smtp-Source: ABdhPJy866nI5xzvLPXeTBeVGR5GU0oLqSMp9L4gc89JGRd2Q7d41Mic9cHor0NitorHAolHXjDb7g== X-Received: by 2002:a17:90a:c293:: with SMTP id f19mr5550170pjt.91.1591719911610; 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" 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 =3D> 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 =3D> succ_pattern_grou= p_nest2.decode} (85%) diff --git a/tests/decode/err_pattern_group_nest1.decode b/tests/decode/suc= c_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 =20 -# 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): =20 def ctz(x): """Return the number of times 2 factors into X.""" + assert x !=3D 0 r =3D 0 while ((x >> r) & 1) =3D=3D 0: r +=3D 1 @@ -131,6 +132,8 @@ def ctz(x): =20 =20 def is_contiguous(bits): + if bits =3D=3D 0: + return -1 shift =3D 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') =20 repeat =3D True - while repeat: - if fixedmask =3D=3D 0: - error(lineno, 'no overlap in patterns within braces') + fixedbits =3D 0 + while repeat and fixedmask !=3D 0: fixedbits =3D None for p in pats: thisbits =3D p.fixedbits & fixedmask @@ -978,6 +980,12 @@ def build_tree(pats, outerbits, outermask): innermask &=3D i.fixedmask =20 if innermask =3D=3D 0: + # Edge condition: One pattern covers the entire insnmask + if len(pats) =3D=3D 1: + t =3D Tree(outermask, innermask) + t.subs.append((0, pats[0])) + return t + text =3D 'overlapping patterns:' for p in pats: text +=3D '\n' + p.file + ':' + str(p.lineno) + ': ' + str(p) --=20 2.25.1 From nobody Mon Feb 9 21:38:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1591720596; cv=none; d=zohomail.com; s=zohoarc; b=kztBLV1P8WruYLDK6ok1yoTMnec9Vr0af2yHJizAGQSpOn+0srRx2EYjTdtzh2MGWxsv3IyLnhgut8Sg21xMA5Nsu5tkzbIGQ6qxZizfiAz9RNkzCGET0gsfENNngB3XKcLitZbfZ1Z6HtNd8B9/Aoozz7yhmn9OGd1N0k9s/Qo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591720596; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vTBtqxUpy9WkyuXZwOdXZa6I5esZFyA9WphOj0ye99o=; b=P7fPBxe14oVVOBEyKjS7232OOwcNjN7s0efrujqPj64lFAgeeSamC1TeJSLQo/E18nL/Ey1l3iZWOOrhwKzsEl9fYlS/A19uYZQLc5EnUWvTcBAjkL66XEl/X+j6oZBDV2cU4el9Mpd0FS9AFr4AeeosG8potpJafiiPNyinfKU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1591720596837777.3790725788026; Tue, 9 Jun 2020 09:36:36 -0700 (PDT) Received: from localhost ([::1]:53406 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jihEo-0006oH-Bb for importer@patchew.org; Tue, 09 Jun 2020 12:36:34 -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) 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) 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-Google-Smtp-Source: ABdhPJxo3P9xRNVegSQH3UX3G0XDnuHXizpGJyo8psJBwE6u6qLeyat9s0P5a8YG7EQqu55Zv1qiWw== X-Received: by 2002:a62:7c49:: with SMTP id x70mr20933899pfc.66.1591719912911; 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" 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(-) 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 =3D False fields =3D {} arguments =3D {} formats =3D {} -patterns =3D [] allpatterns =3D [] anyextern =3D False =20 @@ -371,16 +370,27 @@ class Pattern(General): output(ind, 'u.f_', arg, '.', n, ' =3D ', 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 =20 =20 class MultiPattern(General): """Class representing a set of instruction patterns""" =20 - def __init__(self, lineno, pats): + def __init__(self, lineno): self.file =3D input_file self.lineno =3D lineno - self.pats =3D pats + self.pats =3D [] self.base =3D None self.fixedbits =3D 0 self.fixedmask =3D 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 =3D insnmask + undefmask =3D insnmask + + # Collect fixedmask/undefmask for all of the children. + for p in self.pats: + p.prop_masks() + fixedmask &=3D p.fixedmask + undefmask &=3D p.undefmask + + # Widen fixedmask until all fixedbits match + repeat =3D True + fixedbits =3D 0 + while repeat and fixedmask !=3D 0: + fixedbits =3D None + for p in self.pats: + thisbits =3D p.fixedbits & fixedmask + if fixedbits is None: + fixedbits =3D thisbits + elif fixedbits !=3D thisbits: + fixedmask &=3D ~(fixedbits ^ thisbits) + break + else: + repeat =3D False + + self.fixedbits =3D fixedbits + self.fixedmask =3D fixedmask + self.undefmask =3D 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 =3D None + for p in self.pats: + p.prop_width() + if width is None: + width =3D p.width + elif width !=3D p.width: + error_with_file(self.file, self.lineno, + 'width mismatch in patterns within braces') + self.width =3D width + # end MultiPattern =20 =20 class IncMultiPattern(MultiPattern): """Class representing an overlapping set of instruction patterns""" =20 - def __init__(self, lineno, pats, fixb, fixm, udfm, w): - self.file =3D input_file - self.lineno =3D lineno - self.pats =3D pats - self.base =3D None - self.fixedbits =3D fixb - self.fixedmask =3D fixm - self.undefmask =3D udfm - self.width =3D w - def output_code(self, i, extracted, outerbits, outermask): global translate_prefix ind =3D str_indent(i) @@ -431,6 +482,153 @@ class IncMultiPattern(MultiPattern): #end IncMultiPattern =20 =20 +class Tree: + """Class representing a node in a decode tree""" + + def __init__(self, fm, tm): + self.fixedmask =3D fm + self.thismask =3D tm + self.subs =3D [] + self.base =3D None + + def str1(self, i): + ind =3D str_indent(i) + r =3D '{0}{1:08x}'.format(ind, self.fixedmask) + if self.format: + r +=3D ' ' + self.format.name + r +=3D ' [\n' + for (b, s) in self.subs: + r +=3D '{0} {1:08x}:\n'.format(ind, b) + r +=3D s.str1(i + 4) + '\n' + r +=3D ind + ']' + return r + + def __str__(self): + return self.str1(0) + + def output_code(self, i, extracted, outerbits, outermask): + ind =3D 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 =3D True + + # Attempt to aid the compiler in producing compact switch statemen= ts. + # If the bits in the mask are contiguous, extract them. + sh =3D is_contiguous(self.thismask) + if sh > 0: + # Propagate SH down into the local functions. + def str_switch(b, sh=3Dsh): + return '(insn >> {0}) & 0x{1:x}'.format(sh, b >> sh) + + def str_case(b, sh=3Dsh): + 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) =3D=3D 0 + innermask =3D outermask | self.thismask + innerbits =3D 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 =3D ~outermask & insnmask + for i in pats: + innermask &=3D i.fixedmask + + if innermask =3D=3D 0: + # Edge condition: One pattern covers the entire insnmask + if len(pats) =3D=3D 1: + t =3D Tree(outermask, innermask) + t.subs.append((0, pats[0])) + return t + + text =3D 'overlapping patterns:' + for p in pats: + text +=3D '\n' + p.file + ':' + str(p.lineno) + ': ' + str= (p) + error_with_file(pats[0].file, pats[0].lineno, text) + + fullmask =3D outermask | innermask + + # Sort each element of pats into the bin selected by the mask. + bins =3D {} + for i in pats: + fb =3D i.fixedbits & innermask + if fb in bins: + bins[fb].append(i) + else: + bins[fb] =3D [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 =3D Tree(fullmask, innermask) + + for b, l in bins.items(): + s =3D l[0] + if len(l) > 1 or s.fixedmask & ~fullmask !=3D 0: + s =3D ExcMultiPattern.__build_tree(l, b | outerbits, fullm= ask) + t.subs.append((b, s)) + + return t + + def build_tree(self): + super().prop_format() + self.tree =3D 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 =3D None + for (b, s) in tree.subs: + if f is None: + f =3D s.base + if f is None: + return + if f is not s.base: + return + tree.base =3D 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 =20 =20 -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 =20 + is_format =3D parent_pat is None + fixedmask =3D 0 fixedbits =3D 0 undefmask =3D 0 @@ -749,7 +948,7 @@ def parse_generic(lineno, is_format, name, toks): error(lineno, 'field {0} not initialized'.format(f)) pat =3D Pattern(name, lineno, fmt, fixedbits, fixedmask, undefmask, fieldmask, flds, width) - patterns.append(pat) + parent_pat.pats.append(pat) allpatterns.append(pat) =20 # 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 =20 -def build_incmulti_pattern(lineno, pats): - """Validate the Patterns going into a IncMultiPattern.""" - global patterns - global insnmask =20 - if len(pats) < 2: - error(lineno, 'less than two patterns within braces') - - fixedmask =3D insnmask - undefmask =3D 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 &=3D p.fixedmask - undefmask &=3D p.undefmask - if p.lineno < lineno: - lineno =3D p.lineno - - width =3D None - for p in pats: - if width is None: - width =3D p.width - elif width !=3D p.width: - error(lineno, 'width mismatch in patterns within braces') - - repeat =3D True - fixedbits =3D 0 - while repeat and fixedmask !=3D 0: - fixedbits =3D None - for p in pats: - thisbits =3D p.fixedbits & fixedmask - if fixedbits is None: - fixedbits =3D thisbits - elif fixedbits !=3D thisbits: - fixedmask &=3D ~(fixedbits ^ thisbits) - break - else: - repeat =3D False - - mp =3D 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""" =20 - global patterns - # Read all of the lines of the file. Concatenate lines # ending in backslash; discard empty lines and comments. toks =3D [] lineno =3D 0 nesting =3D 0 - saved_pats =3D [] + nesting_pats =3D [] =20 for line in f: lineno +=3D 1 @@ -868,16 +1022,20 @@ def parse_file(f): =20 # End nesting? if name =3D=3D '}': - if nesting =3D=3D 0: - error(start_lineno, 'mismatched close brace') if len(toks) !=3D 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 =3D nesting_pats.pop() + except: + error(lineno, 'mismatched close brace') + nesting -=3D 2 if indent !=3D nesting: - error(start_lineno, 'indentation ', indent, ' !=3D ', nest= ing) - pats =3D patterns - patterns =3D saved_pats.pop() - build_incmulti_pattern(lineno, pats) + error(lineno, 'indentation ', indent, ' !=3D ', nesting) + toks =3D [] continue =20 @@ -889,8 +1047,12 @@ def parse_file(f): if name =3D=3D '{': if len(toks) !=3D 0: error(start_lineno, 'extra tokens after open brace') - saved_pats.append(patterns) - patterns =3D [] + + nested_pat =3D IncMultiPattern(start_lineno) + parent_pat.pats.append(nested_pat) + nesting_pats.append(parent_pat) + parent_pat =3D nested_pat + nesting +=3D 2 toks =3D [] continue @@ -901,121 +1063,13 @@ def parse_file(f): elif name[0] =3D=3D '&': parse_arguments(start_lineno, name[1:], toks) elif name[0] =3D=3D '@': - 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 =3D [] # end parse_file =20 =20 -class Tree: - """Class representing a node in a decode tree""" - - def __init__(self, fm, tm): - self.fixedmask =3D fm - self.thismask =3D tm - self.subs =3D [] - self.base =3D None - - def str1(self, i): - ind =3D str_indent(i) - r =3D '{0}{1:08x}'.format(ind, self.fixedmask) - if self.format: - r +=3D ' ' + self.format.name - r +=3D ' [\n' - for (b, s) in self.subs: - r +=3D '{0} {1:08x}:\n'.format(ind, b) - r +=3D s.str1(i + 4) + '\n' - r +=3D ind + ']' - return r - - def __str__(self): - return self.str1(0) - - def output_code(self, i, extracted, outerbits, outermask): - ind =3D 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 =3D True - - # Attempt to aid the compiler in producing compact switch statemen= ts. - # If the bits in the mask are contiguous, extract them. - sh =3D is_contiguous(self.thismask) - if sh > 0: - # Propagate SH down into the local functions. - def str_switch(b, sh=3Dsh): - return '(insn >> {0}) & 0x{1:x}'.format(sh, b >> sh) - - def str_case(b, sh=3Dsh): - 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) =3D=3D 0 - innermask =3D outermask | self.thismask - innerbits =3D 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 =3D ~outermask & insnmask - for i in pats: - innermask &=3D i.fixedmask - - if innermask =3D=3D 0: - # Edge condition: One pattern covers the entire insnmask - if len(pats) =3D=3D 1: - t =3D Tree(outermask, innermask) - t.subs.append((0, pats[0])) - return t - - text =3D 'overlapping patterns:' - for p in pats: - text +=3D '\n' + p.file + ':' + str(p.lineno) + ': ' + str(p) - error_with_file(pats[0].file, pats[0].lineno, text) - - fullmask =3D outermask | innermask - - # Sort each element of pats into the bin selected by the mask. - bins =3D {} - for i in pats: - fb =3D i.fixedbits & innermask - if fb in bins: - bins[fb].append(i) - else: - bins[fb] =3D [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 =3D Tree(fullmask, innermask) - - for b, l in bins.items(): - s =3D l[0] - if len(l) > 1 or s.fixedmask & ~fullmask !=3D 0: - s =3D 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""" =20 @@ -1157,28 +1211,6 @@ def build_size_tree(pats, width, outerbits, outermas= k): # end build_size_tree =20 =20 -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 =3D None - for (b, s) in tree.subs: - if f is None: - f =3D s.base - if f is None: - return - if f is not s.base: - return - tree.base =3D f -# end prop_format - - def prop_size(tree): """Propagate minimum widths up the decode size tree""" =20 @@ -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(): =20 if len(args) < 1: error(0, 'missing input file') + + toppat =3D ExcMultiPattern(0) + for filename in args: input_file =3D filename f =3D open(filename, 'r') - parse_file(f) + parse_file(f, toppat) f.close() =20 - if variablewidth: - stree =3D 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() =20 - dtree =3D 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 =3D build_size_tree(toppat.pats, 8, 0, 0) + prop_size(stree) =20 if output_file: output_fd =3D open(output_file, 'w') @@ -1316,7 +1358,7 @@ def main(): f =3D 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) =20 output(i4, 'return false;\n') output('}\n') --=20 2.25.1 From nobody Mon Feb 9 21:38:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1591720252; cv=none; d=zohomail.com; s=zohoarc; b=YVX0jCPybBKHCdzOOv0z4oH8ahvSJ28g5SgdaqjjNmORjrqI5I+XBJcXsjyq9vUa3uHXxficGWl9H0rnHOYcVcBUs3MuG6IZQnnRiefudoBkhXeNNm/5Tgrp/IsVbLDE75IeRmHDUoHHp0SEKECIYTt1ebnxVfVRVb9/pnsGpzU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591720252; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+utQoTLUzPPlGyk84vqSkSI1IEc8oNkKhMpAe11BE/0=; b=e+mZaY/QQ4RNfI58DuunkyzSRCaP0Ys3UEsRQpWRaeXAN3+pZxChWHuS9PB7BuSkUHB/OKt2s3x1u642jo7N93aIPF1MbaylJdscD7Naq1/JCmtfb9HyUoagAmZiQp8bmmJy+AaMu3lHh+2kL60ZywzvWnysM1QiWrLx70ZPv/4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1591720252565383.67636199510775; Tue, 9 Jun 2020 09:30:52 -0700 (PDT) Received: from localhost ([::1]:38108 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jih9H-0008PO-4P for importer@patchew.org; Tue, 09 Jun 2020 12:30:51 -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) 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) 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-Google-Smtp-Source: ABdhPJweCWnTfVydovZvUnqI1fQE9UWElrlIlThsZr6d/oqoGyK9fSUs8QWCvnvtznDEFaRu83/yoA== X-Received: by 2002:a17:90a:64cb:: with SMTP id i11mr5782251pjm.193.1591719914045; Tue, 09 Jun 2020 09:25:14 -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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Intended to be nested within overlapping groups. Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Suggested-by: Peter Maydell Signed-off-by: Richard Henderson --- scripts/decodetree.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) 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] =20 # End nesting? - if name =3D=3D '}': + if name =3D=3D '}' or name =3D=3D ']': if len(toks) !=3D 0: error(start_lineno, 'extra tokens after close brace') if len(parent_pat.pats) < 2: error(lineno, 'less than two patterns within braces') =20 + # Make sure { } and [ ] nest properly. + if (name =3D=3D '}') !=3D isinstance(parent_pat, IncMultiPatte= rn): + error(lineno, 'mismatched close brace') + try: parent_pat =3D nesting_pats.pop() except: - error(lineno, 'mismatched close brace') + error(lineno, 'extra close brace') =20 nesting -=3D 2 if indent !=3D nesting: @@ -1044,11 +1048,14 @@ def parse_file(f, parent_pat): error(start_lineno, 'indentation ', indent, ' !=3D ', nesting) =20 # Start nesting? - if name =3D=3D '{': + if name =3D=3D '{' or name =3D=3D '[': if len(toks) !=3D 0: error(start_lineno, 'extra tokens after open brace') =20 - nested_pat =3D IncMultiPattern(start_lineno) + if name =3D=3D '{': + nested_pat =3D IncMultiPattern(start_lineno) + else: + nested_pat =3D ExcMultiPattern(start_lineno) parent_pat.pats.append(nested_pat) nesting_pats.append(parent_pat) parent_pat =3D nested_pat @@ -1067,6 +1074,9 @@ def parse_file(f, parent_pat): else: parse_generic(start_lineno, parent_pat, name, toks) toks =3D [] + + if nesting !=3D 0: + error(lineno, 'missing close brace') # end parse_file =20 =20 --=20 2.25.1 From nobody Mon Feb 9 21:38:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1591720459; cv=none; d=zohomail.com; s=zohoarc; b=JIwV1NvDo9fEEXBVJI6Gd8XqJ5TxcDVIAo4A6vnLzr1fXDQSKrpikB9IGE+5mfMGoeqp9kwNXbsS4DFFEQVkF6d0NSTq4BKc62ZCah+VPrgUKlErk4HxHhdyPn0l0ynR/ESoxxiQTNxArazD9Y7uEUPrA1F2VL61FzN4qx7KOJo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591720459; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=hsQjYBDuR7uMW5e0uYusrSNyQMrEa5twml8sjwRrMW8=; b=Od6Jr2fjfFumDvsa6jLCTz6KIgeABDX+zi/0JKBkP4prsEoKFg01dkjeYdtiUz4zu8pW8OUviMX8n6XiLK9IdgYF6xmbY7eIMvGDKcmV44KhTFIgXODer45o9rO2roirT5B4BWc5ork8kFVbQftL3QyPXaLlUfVqA+pUD8Gguwk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1591720458936210.02597806969356; Tue, 9 Jun 2020 09:34:18 -0700 (PDT) Received: from localhost ([::1]:46120 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jihCb-0003aw-Jv for importer@patchew.org; Tue, 09 Jun 2020 12:34:17 -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) 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) 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-Google-Smtp-Source: ABdhPJx2yESCsk2IMRgwuOUViUo88AOmtyvigBD+agdkz5ASfkJFbtuLs0+Llrbqfmzv4pIzFJ0afQ== X-Received: by 2002:a62:5c03:: with SMTP id q3mr4823594pfb.58.1591719915179; Tue, 09 Jun 2020 09:25:15 -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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" 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 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 late= r. +# 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 late= r. +# 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 late= r. +# 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/su= cc_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 late= r. +# 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 +} --=20 2.25.1 From nobody Mon Feb 9 21:38:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1591720131; cv=none; d=zohomail.com; s=zohoarc; b=ExA7oGZB5JaayWey8YkEWLtGZklIiNdggHR4uTZswKOU508n12PeVKA2aohHzkZvwq4wfUW/XDvdu7To6nYWdwkdtTXuIhdIgTkKwnfV8Yy6zyRb+ke2WRC6t7CERww3PYsOpn5DOpHjdOX3I+RE2xyD5nzQbLn2uIXNBANPQq4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591720131; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=7rP6ON/rwFD7r5kwGH+K6LUDEi9rTYztwFSHBdHa/4Q=; b=HXk34b28DgkjlQlJLXVGTHnNYuSzonvQeGY7kl6q6G9sYA49gC3XcXrCA0QK6P8UgAUwljCom3U2/oYY3WRHKMr4XHjApkBHEYI8if/nibbOYxsaT6dEN2+k3lmxXMSlQDy6lggCNJdcIztdKi7ohfD9i0NjG5UILwhA2nPLhg8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1591720131861886.2424610445765; Tue, 9 Jun 2020 09:28:51 -0700 (PDT) Received: from localhost ([::1]:59104 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jih7K-0005P5-H1 for importer@patchew.org; Tue, 09 Jun 2020 12:28:50 -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) 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) 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-Google-Smtp-Source: ABdhPJyY9N1JAaZUXWaBlOsn8EuxwAwghebwzJLhSQR3NjN+lC75YgaAoR8QiwUtwVzDuxeFZkzk5g== X-Received: by 2002:a17:90a:d803:: with SMTP id a3mr6048786pjv.125.1591719916799; 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" 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 diff --git a/tests/decode/succ_pattern_group_nest4.decode b/tests/decode/su= cc_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 late= r. +# 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 =3D=3D '}' or name =3D=3D ']': if len(toks) !=3D 0: error(start_lineno, 'extra tokens after close brace') - if len(parent_pat.pats) < 2: - error(lineno, 'less than two patterns within braces') =20 # Make sure { } and [ ] nest properly. if (name =3D=3D '}') !=3D isinstance(parent_pat, IncMultiPatte= rn): --=20 2.25.1 From nobody Mon Feb 9 21:38:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1591720020; cv=none; d=zohomail.com; s=zohoarc; b=iU9+jb8tqLd1C/ltB4CHBa0+AHzqUKM49XMSCQp7tZr8WzuNGOFEJC6Mwy7Z0p86VgUyFrQTUp2sittpaOHrP46qGzMGB+7pepDkjYOewSAqYJZJ43nw3JWwRrknX4SyKjCe0LyGGbBqViP3H2YIgtHypsPwSGAUJtILL7cHYfI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591720020; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=8qc6oDN4Zl6MEuNRZIzxS7SMNWB7rYpnfgGgJ3Ds2L8=; b=D0vmToqAalhb6lB1b6rYtsCbrOiU0xWya+sgLNJkTpVXsxUElZcoExhaqMOdUnR3BvHfNdttw9qt0+wmiY7DXo7NQxCF3EUpCsJ3L5yffSuxW5mc0npBjVxTvRT0Wd5jkbJuGCRR7sg9Yog5yp7GKGfchpM8zf4m0pPyfTudaEw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1591720020544644.4266400457909; Tue, 9 Jun 2020 09:27:00 -0700 (PDT) Received: from localhost ([::1]:51242 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jih5X-00027J-8G for importer@patchew.org; Tue, 09 Jun 2020 12:26:59 -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) 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) 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-Google-Smtp-Source: ABdhPJxlzjqKn7TyQ0aBfPRakieWIytmY/cpLep/rLZlDOshUH5rxuNS7ByOc66J0dOK9Ob8CdsTww== X-Received: by 2002:a17:90a:266f:: with SMTP id l102mr6133308pje.190.1591719918369; Tue, 09 Jun 2020 09:25:18 -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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) The miscellaneous control instructions are mutually exclusive within the t32 decode sub-group. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- target/arm/t32.decode | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 =20 # 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 - } + ] =20 # Note that the v7m insn overlaps both the normal and banked insn. { --=20 2.25.1