From nobody Thu May 16 06:45:12 2024 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=1591641549; cv=none; d=zohomail.com; s=zohoarc; b=XG42AwrLNfQ2ov/WILQ+5LIqLK6yTFgxC2saQtDJJsjywlB/P5vel2tTHYxdxYzRfqqKTX2v/fcibvxUDNDV03gjAyeIJOmx8Tg1gSaGx09+v9zcWY4QIshOWq83OLAyS4lzG05ASF522Pin7SVrSHJOAlrjs7gNsbn7ZoU2TdU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591641549; 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=UsI3kyFOdLlS65fGASt6yjIZ1cSwNmeB71djxusjYANOkdQGfAsazsoX61yBJ+G3mt3UpeLFgXwg6PFH3Pof4bJSEiekfwG7CC4ngW5kyiQdmLN5lpPagppzGTUA1FYB8EmMzGY8fA2qogF/P4xeP3CJTmE6NxYWNy93cVxr45c= 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 1591641548938337.2994537183754; Mon, 8 Jun 2020 11:39:08 -0700 (PDT) Received: from localhost ([::1]:50028 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jiMfr-0000Xa-6k for importer@patchew.org; Mon, 08 Jun 2020 14:39:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57556) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jiMdm-0007T5-RW for qemu-devel@nongnu.org; Mon, 08 Jun 2020 14:36:58 -0400 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]:40936) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jiMdm-0001Up-3p for qemu-devel@nongnu.org; Mon, 08 Jun 2020 14:36:58 -0400 Received: by mail-pj1-x1031.google.com with SMTP id s88so194198pjb.5 for ; Mon, 08 Jun 2020 11:36:57 -0700 (PDT) Received: from localhost.localdomain (174-21-143-238.tukw.qwest.net. [174.21.143.238]) by smtp.gmail.com with ESMTPSA id i22sm7854235pfo.92.2020.06.08.11.36.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jun 2020 11:36:55 -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=xgXbebFVLPE7avWBGwmpiKqJZUPa76bEfoJLJOOyXa8cgQ/PDQmpXWuJIKGP/KU4fC 6U5WBvMZSuApP72T/BxRYvOdswbAvFreUgJnbYSpa1HHJBUh+MU9l7kvOrrm0fb0ZRhI r/Jt8z8AiTSzAHcxKduraAcBGHUvUYqRaff1qlovJUcUNqTx8BlcaTOOH0d+HgRjL+/X +t2eWM03Lu3E0nWJdkJThBhPnn1z5GZ/un6O1/leuAfb7V2dHEZlRigq0amECjKEw5Fb dbovEqsdw4PJ7YLKB5wJ1uMQpUzpzv9Pxm5UuCrQff+Y2NmnM2TEswWUijaSqvJSCX7D hJQw== 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=mjWNBXeU6TnnZYlm3I9zkPPC0XXCXBoMVVGpsLxU6Rs6b1SXfkDUY07aNImHI4aYmY 5Ot0usv9y7/cus60IIopAJPpP6Pzx+/+9gxdUF5lzGvpdpzlMYwck3NI5rWLxrgp+03y aYvlEQAGgr69HiNOX9xwZ2Sh2Iv8GgqCa821NVsg9sMZb4XaHy9DayzIq4MnwFyXvxxs hgnnQSBXlVjqFz3JgvZHFunlopQcysHpkJfGuhKHBc2C2vKdG1u5K77hksFfrl3y8H/F hCsCJNBXJbOnNg+iCM2PhtvHULXl33+vQeQTtZTeLo4aTfZ3MmW0Dbf1PdpGtMuEh9s9 aPag== X-Gm-Message-State: AOAM530/rrwFSCGXcUyM542A/zeM8ZN1EQ8eLxhPk0hpcwA9rd+M2KkD 7BOkGZtVp5bFxI/6oEQGw4WKCE1I9PU= X-Google-Smtp-Source: ABdhPJwxo0O3a/8+lPPLcayZmXxj4GxwjKgxncdxvNezz3cFhQrBpkVJupGf2tEwQBP4p5jz74AJyw== X-Received: by 2002:a17:90b:3691:: with SMTP id mj17mr556106pjb.152.1591641416259; Mon, 08 Jun 2020 11:36:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 1/9] decodetree: Tidy error_with_file Date: Mon, 8 Jun 2020 11:36:44 -0700 Message-Id: <20200608183652.661386-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200608183652.661386-1-richard.henderson@linaro.org> References: <20200608183652.661386-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::1031; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1031.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 Thu May 16 06:45:12 2024 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=1591641803; cv=none; d=zohomail.com; s=zohoarc; b=fkEUYBrV9Si1yxbPuN+wQVKVi5wTb5+6SkocTN/3i1v9Mdjj51herW0K0ybDacK7V7xQE5GJ9U5AdXb4jS99FQRDvwKLYpKtewVIL0TNkIkIJAqOrhDaSOIML170irdHMfrUTr3NvrYj5MVm1+BwYGZrPkIjmvWfyx57Trae+q0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591641803; 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=VyZRnR9LhmU9fk789/OHLGPVyZmnawviLyt6IBYZGG4RTTwRZ+gqedw5hEq5pCJAF7WRrRKnn1dOg2e7jEqedxhbc0X22M9CmllaDKaX6/FaVpN0l8GAPBS3j+52zbvZEweQHPk0ro2h3//VofXtBNf9QPwnaZCyLEAc6uX5Wbw= 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 15916418037053.753956757849096; Mon, 8 Jun 2020 11:43:23 -0700 (PDT) Received: from localhost ([::1]:32914 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jiMjy-0005Js-EI for importer@patchew.org; Mon, 08 Jun 2020 14:43:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57584) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jiMds-0007Za-HK for qemu-devel@nongnu.org; Mon, 08 Jun 2020 14:37:04 -0400 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]:42835) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jiMdn-0001V1-PU for qemu-devel@nongnu.org; Mon, 08 Jun 2020 14:37:04 -0400 Received: by mail-pg1-x52b.google.com with SMTP id e9so9116505pgo.9 for ; Mon, 08 Jun 2020 11:36:59 -0700 (PDT) Received: from localhost.localdomain (174-21-143-238.tukw.qwest.net. [174.21.143.238]) by smtp.gmail.com with ESMTPSA id i22sm7854235pfo.92.2020.06.08.11.36.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jun 2020 11:36:57 -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=YeyinN5gyH61m/GcaeXypPOfjovaRRze//ZqzH27PIAJot3bepDWgR+Qb9TVn9tHsa HB+1OaUabVaIX2MXMydhFKIeBqAO0QFh6P/AAuEBVb8SKVlEPpVi0kDPu7WwAhlGYRYw Hkycr5RvfOKnzAqM18agFMZXe1FxxCSWf2NP7Ncv1W1bkuJbd45uAzRJs+Q1ecUyf7xU eZYPOuYuYacRP3YjXGLWP50Lu5Qi9j564i/JIFeCWCH7TvdoK2UbKHmC9qGgvhEVbhKk Ie7KWm2I6y8jMcVVjwVcYKwb2InxVbbqrFWWDMUC3487wKFEItNu9+3hd8BDvzoFebN0 9bcg== 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=g/58taAd+DwdSzcRB7BILrZE+K1msERz5e2UAQXlJOpjkTtBBsGBfGd9bYVSOjkb35 bHp0zlwS+tuYSxSnsuTQs25jlSBGuAOCPiUPocfSVZTtXsrHuSvqpywzhHgqOPfazG/5 vS23XLN8+7iC/BBt8ufm6kAVwKNroV4DMlIso2pGrrssuELAlujPf1+zpCa5rJTErzF1 pkFd+9b0gSAZAClajRcSpaZioZAs+7HM5o3PB8vHhksqh/2xPWyMGZ5o/jSCPCzlMhEF jEzbPpFM1wkuMwiWCbMT6D2/kXTrhZ+Rh+0EGe93gLiyA++z1G368ih3y0YYcAK/BvUv JApg== X-Gm-Message-State: AOAM530/2Iyy/K7VyOnxQrwSk1o59AoaPDvyOlUieudYd+3MVrMeeC1S Lf8O2KxucYOoPO6ccSoaqAgY+Q4+dnI= X-Google-Smtp-Source: ABdhPJz5KGyIkDAxG6q9AjbFP4ZPXqwgR+skvJ1ZTai6ccre5f0RdMv4zMBMm9C/bEIwszD5Esm1GA== X-Received: by 2002:a62:1a0f:: with SMTP id a15mr23770292pfa.177.1591641417789; Mon, 08 Jun 2020 11:36:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 2/9] decodetree: Rename MultiPattern to IncMultiPattern Date: Mon, 8 Jun 2020 11:36:45 -0700 Message-Id: <20200608183652.661386-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200608183652.661386-1-richard.henderson@linaro.org> References: <20200608183652.661386-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::52b; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52b.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 Thu May 16 06:45:12 2024 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=1591641656; cv=none; d=zohomail.com; s=zohoarc; b=BAZbo3Z88jT4XIQGBJCrBV6qI+WtTiVNvK2OUsb3OhvlZXsYAbHqheZfz1TZBebk0GT3ofib3ZP2R/+mxKEP+0XRTEIh1UILPAMoA3pJHmnBrUm8GsJqIo1aJxZs7s9OD/3PU1InB7dDm+oz2Vz6vEjbhpjUJkNX+A8M/aYdLMk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591641656; 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=Z8/mAMU1Ga6oBw5+q4xrQSy/uUtq7NnCHTOgDjuCPl9QvcsYRS8R4Rt/pXA0CQHFUFObZpdeNwS8DG9Gl6j+xecMY7lJzXZg4c+VfBPdQzzDE6YQFBxxYLKaK7CIyAmjdt5KlNggWTfST+vK3l95ymTUeMrpEk9txGTdKPpYSGI= 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 1591641656121454.6207496671375; Mon, 8 Jun 2020 11:40:56 -0700 (PDT) Received: from localhost ([::1]:53438 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jiMha-0001yc-R1 for importer@patchew.org; Mon, 08 Jun 2020 14:40:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57574) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jiMdq-0007W7-7P for qemu-devel@nongnu.org; Mon, 08 Jun 2020 14:37:02 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]:40459) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jiMdo-0001V7-LF for qemu-devel@nongnu.org; Mon, 08 Jun 2020 14:37:01 -0400 Received: by mail-pf1-x42e.google.com with SMTP id s23so7597843pfh.7 for ; Mon, 08 Jun 2020 11:37:00 -0700 (PDT) Received: from localhost.localdomain (174-21-143-238.tukw.qwest.net. [174.21.143.238]) by smtp.gmail.com with ESMTPSA id i22sm7854235pfo.92.2020.06.08.11.36.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jun 2020 11:36:58 -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=kGbAXsl2GFot687u6BRTHSfCd3DowBOh6wE9S0BAunLCOwv3qaxsTecc9PxOKyRPPM xfPhRhgOTKud96uQDnGRqigu57Y8qBGuCnJDY7NdVyJtMil0yn2XAddHrj0KFMQDyZbs pvL7R3dWkAN0mDE/9E2Pfr1ST9AY4dJL4U5gyNISxWo/FgZLehyL9X7w2oYDpYHThu/I u5sz2cyb7uzV8H3NT+p8dIG7YueIVtoFXi5J+Yw9QcXzht13J5nKsszXE0fkC7ZDYXmY yJYjqnfvC0pW2Y6lJ3Dyb7Dp1uGKHdguwPiS1EmlBvTaS8aPh/mvkmNh4n3SlIWhDGgu D7hw== 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=qQgp6Rn/gZ23lWI+00AZ7dGllt6ZjObAVNR+jPJkvpGoJuONBhKMmcPMh/Q7IVIXOv aQu5BfcF80UsqFNAHzn5y/AxyeqMxmqx6jcn8H5FSm8PHUwA/sDRd5g5OsC9U4kSRuyR gSyAKCzfxKXYLJIP7tht0ihyF0nIfSbzjn7luZHJm5J2w/2xk41X0Xl4uO0YL+w0Yce4 PnF5gitJBAYxKi4ZSsgn4Ec4xXRye3u8xM8ak156OgF0KBDFLA0nAWF8DojWXDFOJosB /8rZH5d2akpe31QfAmEjLu39Y2gKdMoVznBADFOg/FLDW6jlDbmnOpeiQjRtcL0ZC5dR m5Hg== X-Gm-Message-State: AOAM533kbwCXl7Dzh5A7qQ9SJas51l0lIsDt0HG2jLDMaTzVJXrnwHG6 CRnRnah6PjuU9YoLubLMlLDrVj6VDJY= X-Google-Smtp-Source: ABdhPJyDIRGezXT8JQ7/zV4RQE9wvT1V1iIfxpQ0n3yHug720qppEZQk351ZUPJmaUALkybTERxgaA== X-Received: by 2002:a62:2944:: with SMTP id p65mr22668858pfp.280.1591641418962; Mon, 08 Jun 2020 11:36:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 3/9] decodetree: Split out MultiPattern from IncMultiPattern Date: Mon, 8 Jun 2020 11:36:46 -0700 Message-Id: <20200608183652.661386-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200608183652.661386-1-richard.henderson@linaro.org> References: <20200608183652.661386-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::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, =?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 Thu May 16 06:45:12 2024 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=1591641745; cv=none; d=zohomail.com; s=zohoarc; b=b/SdFlcn4ewZ6RXCMy31e2GyVwcZ7WDXeR6LMYdseb9iuj6sbk9gbRkaqcxa/xDu5eRPNn8Qm20HtT48kalkZeUSO9kY7iyL9Q7Udn72BrtiuxlOfyDEsYEIM/ToE00fI8m+/sYR/nIrHGhhnbRIFVojHZCydh9msDpajuF1FSM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591641745; 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=YrOvzdujpkgmN7g5WU8qcM0keyYLZiLsX7LGR8+1YeHe3tcJtZHIvh9Tn0rYnsFgH7/6ofL7BRst4I6MTe5lAM6DXdScqbmPgWynmNonf8cHI9lHRCaUsL5mT+VaoJ63xy4EqKhIg3huav6NoOYQl8rK06s9ipeUX+7ONTZtaJU= 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 1591641745037281.32156035708977; Mon, 8 Jun 2020 11:42:25 -0700 (PDT) Received: from localhost ([::1]:58290 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jiMj1-00049J-Lf for importer@patchew.org; Mon, 08 Jun 2020 14:42:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57578) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jiMdr-0007XJ-5y for qemu-devel@nongnu.org; Mon, 08 Jun 2020 14:37:03 -0400 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:40117) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jiMdq-0001VD-2L for qemu-devel@nongnu.org; Mon, 08 Jun 2020 14:37:02 -0400 Received: by mail-pf1-x444.google.com with SMTP id s23so7597869pfh.7 for ; Mon, 08 Jun 2020 11:37:01 -0700 (PDT) Received: from localhost.localdomain (174-21-143-238.tukw.qwest.net. [174.21.143.238]) by smtp.gmail.com with ESMTPSA id i22sm7854235pfo.92.2020.06.08.11.36.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jun 2020 11:36:59 -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=dTqZkv9jvfvfq1OFDvraXcQBvuP8mqFVA2zU+sj6+kJY4VVpLoRxccBT7NDm0fezq8 HO2Fv0GbIMjcfq9MAPxiRCrtu+dSwRSpB9yQWO+JnZRfLRLdq+lre80kwsdslZu1G6zR oHBTPfr7WZ62Kjer9d+tSdf7yMV3oX11G5dZ8fGq+Es0kwypTDnHm3ugOA5i4kQOxQ5J HFWRHhYLJ/ZwVtmRbrT5p0QEn1gYFLkfBu8vc51Gc7QBt13EikFUf+j6vXP/XjU7az0Z cnl7vasDwmaumiR/JXR5eXFb2UmupZ5Gke0J7zZS+CzSBXsoHfZt88bmP0i6oTwSauKd VHUA== 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=tnpkcdaAUob6eWOHEaPoXhRo+7ymFPMeW5vM9hV/48yWvOJSuEmS6DDefMbHowqnGN //rQIZ+KgOMEeQMY03UlqLxiDvK5ISStv1Sodr/2kaIFQlyp6yHwi6/8ZLtz7A9DLKof Lf7Ed29bDj5GGVtlR3hz8IOuhS0xGRXrxsrIjK/CSEU4MhpVxx10mmG212/un+md/5q0 4KPRqcBAY2fiK3uYXH+SVaiQeY9+tlR2/e2A2bx1kpYDV7usRl1TQhFS9ZJG6YCZ5rqQ Vb+fk+aJeVHT3u9ZQSpY9vUt1chYrDtSDSPqGCWatiivrdYns/Mrd7k28dRfY8FLHiQ2 /5Og== X-Gm-Message-State: AOAM532WXo+xmpW0YMLCd4Cvb140ASHC19Tgyjb6swgrZLrNVtCognZ3 WZ1QenBliK324GSkYWM9EBSwhbcxHWY= X-Google-Smtp-Source: ABdhPJwK3y/VDDgrSNyo0XqiICKnzhVL65WnrLzpg9FgT+F2qolJtpWWN8pf8tngQ/VY8CcY6pUzmw== X-Received: by 2002:a63:da0e:: with SMTP id c14mr20908773pgh.377.1591641420266; Mon, 08 Jun 2020 11:37:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 4/9] decodetree: Allow group covering the entire insn space Date: Mon, 8 Jun 2020 11:36:47 -0700 Message-Id: <20200608183652.661386-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200608183652.661386-1-richard.henderson@linaro.org> References: <20200608183652.661386-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::444; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x444.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 Thu May 16 06:45:12 2024 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=1591641750; cv=none; d=zohomail.com; s=zohoarc; b=mRVB4sACLX1spvHguyJ9TckIHmr2kp56Xlr5eLit0m6KnHnGUz+BU9r3OeaRtwz4yv6wlvvwqLW3rgrXI0A8wAbY/edJpk2lWQ9yS8wBjjqzVDavpbL4rxpZUIbsWsL2XY6hdJBqXmqkZvNYbv47As5AJrvnpB9rRp/CZkbhRko= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591641750; 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=ZVmDlswe+3hc1L8AfDq1I3lcgZ6MTC9TSLFK9iCBi0MmwuHlNGQ3ai7akoema2D/i+UyyaS+ohM4xnjHOiv97GXOwVLE+03B1RQt3l5gXlih+meaIapniWe5wn8ROKoZjTvO4bL69w4oCJPloo4zQz1BP2SwIW1OSCGL9DFNr44= 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 159164175010217.84128366876564; Mon, 8 Jun 2020 11:42:30 -0700 (PDT) Received: from localhost ([::1]:58628 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jiMj6-0004HU-DY for importer@patchew.org; Mon, 08 Jun 2020 14:42:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57608) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jiMdw-0007fM-5G for qemu-devel@nongnu.org; Mon, 08 Jun 2020 14:37:08 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]:36697) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jiMdr-0001VV-Vj for qemu-devel@nongnu.org; Mon, 08 Jun 2020 14:37:07 -0400 Received: by mail-pf1-x434.google.com with SMTP id x22so8918397pfn.3 for ; Mon, 08 Jun 2020 11:37:03 -0700 (PDT) Received: from localhost.localdomain (174-21-143-238.tukw.qwest.net. [174.21.143.238]) by smtp.gmail.com with ESMTPSA id i22sm7854235pfo.92.2020.06.08.11.37.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jun 2020 11:37:00 -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=xWvCwXg5g66887MkrkHmYfislGm8JCZtvHCrwN8DE0Xh4k10V3Qu2vMxCzaKFHLACH skFZ2Jvy7ZbfzeYmibNmtwPO/qtUr0hYPbOSFDFeJ90V6CE/ajyNubiJDnjksn8OopF9 EllanSsxsDFASdz/UeLN3X6o9GbgCtI59aMq5G0wRp8ZOzC4uBDlb3ceVJHbko2n2S1a 8zyhD3KBRefsOdIMGptWd9bFDFRvUPz1xMtD8WnnncZROZO1K3zPTHsQOJ6H2hBD0bZM qnUI0iSgjkxpyH3NfHbleywawuTGX9ubqp0/i7msgLdqR1OOxBXC1i/JaL+DjYC6OYdu 7eDQ== 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=jlJNHelRFix9tG9ZresS8NKbVYNzo9EJjN5MbGlzZcu47qa7qn3KD4AsAcsx+Wd6oK qkD72DuSe/I+aW5ZKGonPNF+UyaWwFquufoPP1yhFBaHoW3nRGE0mad36nwjlch2ctY6 7Fj+0Vb1vpilPB1lsV0MwjQrJaG84Ws3f7sA6r4ZZ32M3Iq3UAsu7s2m+w3N7CS5sYLH Ig0eUsciwy0uoqryNa31GJWZczwtazp7Qkvxs4Lj8nayYKkzXkpPXCmdoO3EDkRmblw4 eEU7ZdIcTQocBY2B95/m+Wg1IG3bqV7lKJpxdTrZoNH4bVqib4tFUBIMbZeVLIorAmsa D/hQ== X-Gm-Message-State: AOAM531ygkr1agf3FII8YRo6WFuTzcYbEZlSiBplPsjlU9TrfU8VSFTd F/SWSxlK152cDUaUUhL7dI6gWECfNck= X-Google-Smtp-Source: ABdhPJz/qLGwXDpqKebgFRdfMIcn+vrQCExc5qho1nRGWidRgQCXXV2rbIajTDNzfa60FLUsH7+2WA== X-Received: by 2002:a63:6c8:: with SMTP id 191mr20788033pgg.22.1591641421495; Mon, 08 Jun 2020 11:37:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 5/9] decodetree: Move semantic propagation into classes Date: Mon, 8 Jun 2020 11:36:48 -0700 Message-Id: <20200608183652.661386-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200608183652.661386-1-richard.henderson@linaro.org> References: <20200608183652.661386-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::434; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x434.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 Thu May 16 06:45:12 2024 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=1591641981; cv=none; d=zohomail.com; s=zohoarc; b=JdVgmGvWeANKrZDmlN+GMKD23IqfhM2pcfgTrD5p031qkZCnBFijWsH8pfvzXijvr95YwBVbN+jP85SggNg1ElyItBsu8ACoeH42yC4ZaAVB3dcBI8RHCyCp0mwBkdTGd5/38j0E9RVZaGasITs9laghfkJGgpjwfKIwTVrvjv8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591641981; 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=BdG14pRNY4L2sh3xHW/xQI0IJLZrzwepP/bk5R+1zyw/+U9MINDMyuvvY/VV/NFea1pM2NwqR2UHAc4ChPaD/J2Z23wnC5bqQYYaYwa09rBoQPwXgscpEkHpx0FvrciW7b23lfNlJZPWlg0C7sJGrgQK1azHu21ROsv/VxfEdws= 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 1591641981711799.0585464335464; Mon, 8 Jun 2020 11:46:21 -0700 (PDT) Received: from localhost ([::1]:37558 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jiMmq-0007Pz-H2 for importer@patchew.org; Mon, 08 Jun 2020 14:46:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57590) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jiMdt-0007b5-Op for qemu-devel@nongnu.org; Mon, 08 Jun 2020 14:37:05 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]:43605) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jiMds-0001W0-P3 for qemu-devel@nongnu.org; Mon, 08 Jun 2020 14:37:05 -0400 Received: by mail-pl1-x636.google.com with SMTP id g12so6988485pll.10 for ; Mon, 08 Jun 2020 11:37:04 -0700 (PDT) Received: from localhost.localdomain (174-21-143-238.tukw.qwest.net. [174.21.143.238]) by smtp.gmail.com with ESMTPSA id i22sm7854235pfo.92.2020.06.08.11.37.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jun 2020 11:37:02 -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=GiXPc6mdmO5esgCL9wSNG6rse+Xx2nWK6R3tOrOdCIektTDpf/2XT6ErZJSmHlu2qf JcIp2gPHOYv6WZMYhDB5HeSEeamI5xwudssRRjTkowlQh3h7dE+hPj8FWm+azfkOPrtf 778hiWvUauvNlp4ttPXp6BXaFsS8KNWmGVX/lN0Y2iTFyGQH9ZXrR4MRUSvtxh/AkDF6 z+qLwG5I6Xc133/Exa7toYv+50lIKARbuC2CpQsMHw/AG5cNOaCb0O9Pg/mnOwVaZOj6 RboVucgoIvOqaEqNmn/LQ2HEi+/SYecSsXhE1Bf7N/CGRUwLSAgaHYcyPhGgwxR628lI 1UWg== 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=mF++/Q+4Izngt4m/zMiaH3MN1vp4fruZLxbjOUkfOY/l+JCMNs3mg0ZFe0zRZ+nmpe lyi1qcOHIBb5JJ1jfwX+wCLwJo6Fb25zWBCG/OAtLnNiobAZBAICtqFJni5GW5YXknWZ DA4dskRiVG1yHdmtYe+F293AXPR7MTNENhVO9yvuD9ymHTdLVHZR7FM/bB4lxNkXTOt0 SgUB0Xz1LXdtwpN124gvCfelwMFxXwMeCOgYnxOLul9Wje9w/UX2Ju1q6Z8oci+Ny6H7 EzyLPupimsn3mYyzkHCqVBlU9SkCyTvjR7vbis+KrViwblYtIMim5HVH32FD2FdsotRi U55w== X-Gm-Message-State: AOAM5306xbaewdNw/VCgzzn2yMtcG0RpgsFwh4fac6zOH2BWT5J3YvP2 TOSjJz4A13Ogv+vuxyvq1hDo/TAa+2A= X-Google-Smtp-Source: ABdhPJzlniobZMDioenLUYjAoDCReUcdirC7BMBAiObRhp5OKn6BeEI3geuMPFo/gt/YInhWIHR4ug== X-Received: by 2002:a17:902:c301:: with SMTP id k1mr148708plx.192.1591641422899; Mon, 08 Jun 2020 11:37:02 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 6/9] decodetree: Implement non-overlapping groups Date: Mon, 8 Jun 2020 11:36:49 -0700 Message-Id: <20200608183652.661386-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200608183652.661386-1-richard.henderson@linaro.org> References: <20200608183652.661386-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::636; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x636.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 Thu May 16 06:45:12 2024 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=1591642148; cv=none; d=zohomail.com; s=zohoarc; b=fIb+D1EKQZ790yO9RORicZrzPgo3tx6A1nXmDWqQOshuDTux6NAAl/TtLPaWJkJv+VMlzUEIyXgFgM4X3v8E3UT6HrgZM1e2AnJc37HEuR/fVAv5tV+PvWE5brysurz2wUQbXPVmilCL6nSSUlJRkIldoXnhmN6lTUT2Zrk2SHg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591642148; 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=D5YUayjBdtfkXc8vDXOold3DnZfFNNhoSuXurBPhozuHvyrmq1AampzPBoURy/MPIrqMh7aH/jMn3jQ3FF2UUylXiLPDTxjw90bJC8w+X8kPA7O6of/iv1PeoVuIBDx2TimY8Nq+hmtfyJO3eyGZX2W/z/+jpjZqgPrqf62Bhyo= 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 1591642148310742.2154152008859; Mon, 8 Jun 2020 11:49:08 -0700 (PDT) Received: from localhost ([::1]:41966 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jiMpX-00015w-1N for importer@patchew.org; Mon, 08 Jun 2020 14:49:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57598) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jiMdu-0007d2-SW for qemu-devel@nongnu.org; Mon, 08 Jun 2020 14:37:06 -0400 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]:40021) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jiMdt-0001WO-Tn for qemu-devel@nongnu.org; Mon, 08 Jun 2020 14:37:06 -0400 Received: by mail-pl1-x641.google.com with SMTP id t16so6987027plo.7 for ; Mon, 08 Jun 2020 11:37:05 -0700 (PDT) Received: from localhost.localdomain (174-21-143-238.tukw.qwest.net. [174.21.143.238]) by smtp.gmail.com with ESMTPSA id i22sm7854235pfo.92.2020.06.08.11.37.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jun 2020 11:37:03 -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=tQWSWvruC9DHjJ1mhYPjbU56Q1AgO4LsNeCNgcLf0to8ntNwY3td7CAVWCY9ZrDnfr ji4+D8iiSRTjm4Wacgp+jcke2Aljwqf18rAzzx1+DymwiQ4Cw89z58+8kRQq5U7eNXQE XL8nlWUBtBUxgYKZEOysmBoZJ/0xRLRjeD+1DwwI3uHNnVkvNBhYRgKYtxWbi82kpptp SkQDoyuLYUC9mulEly3rzRY0vEv8J4/xTpt8pX3L0hfiBsXwXrpyJDj1P4YF2lu29OKy EVHgK7M1EJCwE64CL4AdAXlqTliGsgADtWb7oQlOs+2KQCtGyqmefqbw6GEHGUu7MjRH i+zw== 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=ujutuGy7v7mICr3VZ9iW5Yk8h0cyVvufv2Tcl0XZc+tFbTOYuRxaqRZJmI0TD8aa+t OaKJ6gC7VxZgPt24mS6KJsAdLgpjCPFTduv0vNipDcE93Kuk405jpTUPypvQWJxcXBG/ SNM8fmVPuUJ1+nKaRUx6a7eYtnPt79fh5iLDNmF9wVp4ng5I0E9SEalplTomdUcdencL dHyST4BtqmFPdK5Scnu+77ponHXrlgle5V5UgBvwGFJuilppkx15nmt0JU/oQxHMDFrY r4vqPJ5VPlTmdq6teUKrlqg9iMerTjM1Ju9kCiqdIU8vFLSNm0br4djKePMna7mDlp11 qlrQ== X-Gm-Message-State: AOAM5323kNxopTD8qUuyJLdtA2AG/O28qryKr9MreAPpfRNgmElI8LwR pBCdufx1tfCg6F/X1H7x/5cck/NCf7Q= X-Google-Smtp-Source: ABdhPJylANPaRBx6tpgP+9QtjzpuIFuA/id7+ocV2eB8rd/zKAo6AYDbygX4lS7TnVZoHwAXRQhOdw== X-Received: by 2002:a17:902:bccc:: with SMTP id o12mr137921pls.29.1591641424140; Mon, 08 Jun 2020 11:37:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 7/9] tests/decode: Test non-overlapping groups Date: Mon, 8 Jun 2020 11:36:50 -0700 Message-Id: <20200608183652.661386-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200608183652.661386-1-richard.henderson@linaro.org> References: <20200608183652.661386-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::641; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x641.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 Thu May 16 06:45:12 2024 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=1591641930; cv=none; d=zohomail.com; s=zohoarc; b=DHnZTs6JDQzBFWGZb42ydGsGo1ZV8GUe1UGrirWNVJWLCBjYrhEZdC3D9uWrIsVwEnmP3nA4cUvaS3PtiIlZRnx1vKqrSzHGXs4F8jsVDQ9NLWTVBAI/oRdKfS7xA47OUDtQ73kstuATqqn6xAGp+UQTxJ7rEx2SLP/sT/duiq8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591641930; 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=9kKsrc4DOI6Wr8yYNYKXoTwwxZi1qcG2sxUWYFambRA=; b=KYeTK29G9Esle/M12DudEvjwT/0D08A38aaHacwntOmvx4DszWjH77L4+1uOQxU42aeQAMLWb5vD6qp8cPQMlJ6bQTUS9nisLksMl+/7A3kuAvkYWkKazIDQ8BwjwQ12nUfRGr6hKk1gZWrb45gCh3/sOeq3dMp5MJkGKsMa/4s= 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 159164193095518.857841693574983; Mon, 8 Jun 2020 11:45:30 -0700 (PDT) Received: from localhost ([::1]:36176 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jiMm1-0006jP-DF for importer@patchew.org; Mon, 08 Jun 2020 14:45:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57614) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jiMdx-0007if-Kx for qemu-devel@nongnu.org; Mon, 08 Jun 2020 14:37:09 -0400 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]:35583) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jiMdv-0001Wu-AY for qemu-devel@nongnu.org; Mon, 08 Jun 2020 14:37:09 -0400 Received: by mail-pl1-x642.google.com with SMTP id q16so6998957plr.2 for ; Mon, 08 Jun 2020 11:37:06 -0700 (PDT) Received: from localhost.localdomain (174-21-143-238.tukw.qwest.net. [174.21.143.238]) by smtp.gmail.com with ESMTPSA id i22sm7854235pfo.92.2020.06.08.11.37.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jun 2020 11:37:04 -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=9kKsrc4DOI6Wr8yYNYKXoTwwxZi1qcG2sxUWYFambRA=; b=mJntbXWxehe4JtFVkEi4sAeIi3567M0Hro81iUzPO8W5llJit+EBmB9IDcY6/jswl8 2BL7t3/BoDNTu0rAUx7tFm3iuVHNtNWZFt+heVgLPKEHJ5/979xPv8mm+a+ldkmWRyWQ o3R0yfs7FyWNvGMX6zzDYSlMcWS1H2DqGZVTBshTzzxTLcBqa79Cb6GPSR/xrYno9noi MqsJshjAuK94KTE2zO9dx4T8MPBoHJSD6iVSlLzLdfH3bq+JiQrex7QgA4OMtpCQy6fq fVkp+2tJ1FRwrB9rHEK7DGkh7fxRulwVDOQJoO+5L1l+RpACksR6kYL3KlqJ7FDmZUBo Kfpw== 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=9kKsrc4DOI6Wr8yYNYKXoTwwxZi1qcG2sxUWYFambRA=; b=rnPTHf0GuA4cFazNk7+yQV05ZbC0jjTrN0A1QJg9S4THMJV1EI+dQSkJLAWeIiwRAh 0yX3Xr4IUaRgB2r7OPvuMAvbIDrbkjD1rKsnmMtgonFwOFVUTng7Xh04iLXOWAr6P6UM mrwxbt9JOFapb6EdR+Efv66IyFslD5aHpPYT2ByrnPoT4uJXuapHd2lqrsMIhoruMg3S kkzm5TVjf+aB/vI1DrhP69dGfgmtFNLuQwmP4U1NO2Hfr++FEfrkz0E24tpP3DoMO+c/ 2KA+sGnKyPGwXtCqFDnM17W7nRmGrIrYI6Adirr+uAVyAksGX/blswdC7VefhMVak0ke fj4Q== X-Gm-Message-State: AOAM532jTKaI17M0tLwMSM3DSOQ8/mILMEdDmbPtWgdDUpLo40wbyMr7 X9SZyvBRzZHwKLbiC5zWxoWT07bwaj4= X-Google-Smtp-Source: ABdhPJwnQFnTAB/e32oSRJGyEVOKigc5hyfThJSpVGu1NEUFRgRZrePU4Hkwsx21cW4wJpHVEhZDdw== X-Received: by 2002:a17:902:bb85:: with SMTP id m5mr128440pls.23.1591641425596; Mon, 08 Jun 2020 11:37:05 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 8/9] decodetree: Drop check for less than 2 patterns in a group Date: Mon, 8 Jun 2020 11:36:51 -0700 Message-Id: <20200608183652.661386-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200608183652.661386-1-richard.henderson@linaro.org> References: <20200608183652.661386-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::642; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x642.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. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- 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 Thu May 16 06:45:12 2024 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=1591642118; cv=none; d=zohomail.com; s=zohoarc; b=Ef3n4+gO0m9sXEkWJoIjp5YJdfx/peMWO//ZgYvWMMkZa4qslnL+HVO11C/gCQ3x8dvITlXI0UYE1z/HmomSiaTYsnGIxLpsfj43hNzac+XHPRUGl2UznMXGGwNMTLkjtzA7LOFWskL/C/D+u5YtBhAHrXwFWSXtpgtiB10O3zQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591642118; 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=QKKG5+JSs0AqksiJJZ8lnKk0d1QT2HsF3SQbfITkeIq1YDiaVSZvsQFwr4T18FodMz8KVjSS6btP25ZNCuay5HPCSeElJ/jOaCM3gFkHDsaNrOvrhOUYZ9SCcdHNTUHO74RAZol+BME1ssWf5D2bmEWcg3YqtI4Fc0x2R53mYME= 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 1591642118607368.1139167027038; Mon, 8 Jun 2020 11:48:38 -0700 (PDT) Received: from localhost ([::1]:40534 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jiMp3-0000OH-4B for importer@patchew.org; Mon, 08 Jun 2020 14:48:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57620) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jiMdy-0007ky-Sd for qemu-devel@nongnu.org; Mon, 08 Jun 2020 14:37:10 -0400 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:42444) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jiMdw-0001XK-Q7 for qemu-devel@nongnu.org; Mon, 08 Jun 2020 14:37:10 -0400 Received: by mail-pg1-x542.google.com with SMTP id e9so9116695pgo.9 for ; Mon, 08 Jun 2020 11:37:08 -0700 (PDT) Received: from localhost.localdomain (174-21-143-238.tukw.qwest.net. [174.21.143.238]) by smtp.gmail.com with ESMTPSA id i22sm7854235pfo.92.2020.06.08.11.37.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jun 2020 11:37: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=8qc6oDN4Zl6MEuNRZIzxS7SMNWB7rYpnfgGgJ3Ds2L8=; b=GVS1zey+JiL1DezhHOb5u5mzona8AwUJxPYKELcvwr+RlFs/gYu+4BrPnxh1KWT/NG o1OepK57+v5GRiOwNTYfnmR2Xk7cKaxICELRh/EPSlR4YWwpBmFV9SMk9qxZjTTz0ljb Ua43K6UQMIfuY8vizwrkWq1ZZEJvnl1rdmsU0VsWX79ACFSDvTqjJ8e4OxlvNtan4+ow 77idhvmfENzlWeZMBkDM9pkf8+V6GasxrwCERR84iGbb2KnyDooo5FKH+eaCdovEBnVY ixvvsaLdI8VSZdqS/Ymxnuxb852BAQ7u81Hp+ANMq9kM9ACxAEIYbuwSk0EX2dqxXBwC l8Cg== 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=Bf3ZLwj6yMkfsG52eXU5OyjmgNfcng6213TXUgFOYYlUnHJnazUx/TWcG2v2jLivJg YFTafWFv8259zBdY6eD93V8co7HsqaILroQNRN/bBqnmhMP+rcTmTha9NQ36EGSsxJ9B GTW2PbZXfHuyqoF+GkJS8oX8/r9xEtxvBXFYeTS/LhAnI0tbG5lnsATrgW2BpEdYDuSo NZw2S+yonkPxT6MBZbvssXEh8zYe7a5KLvz3lX3ven7UfenKOt2ucGrKiZRe7D+NTG5M 6r4cGEKdSIIg6XlPLIxX81rJ2D4xiGNVWF4/j0fMJ99A3S1zlXi1XBU0Rtziak0XcFW6 I++Q== X-Gm-Message-State: AOAM533K4b1z/Wa3/vCuUTEHQBr2Ir+NTZy5pQ/TShRRFyqxCs5OVmPV IW+6ZATKEsl/kzwUeBQCGDZR6XEMLU0= X-Google-Smtp-Source: ABdhPJwsxJGeSo1UaST1KY4QTHnLdKlq7Zawhpl/iOtDdv+SB5G9anEMdepoJRot9cR8DAOMbz7KRw== X-Received: by 2002:a65:51c7:: with SMTP id i7mr21553265pgq.382.1591641427019; Mon, 08 Jun 2020 11:37:07 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 9/9] target/arm: Use a non-overlapping group for misc control Date: Mon, 8 Jun 2020 11:36:52 -0700 Message-Id: <20200608183652.661386-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200608183652.661386-1-richard.henderson@linaro.org> References: <20200608183652.661386-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::542; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x542.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