From nobody Tue Feb 10 03:40:23 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 150946184793193.2496068644524; Tue, 31 Oct 2017 07:57:27 -0700 (PDT) Received: from localhost ([::1]:45998 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e9Xyk-00026O-1d for importer@patchew.org; Tue, 31 Oct 2017 10:57:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59393) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e9Xwc-0000ek-JU for qemu-devel@nongnu.org; Tue, 31 Oct 2017 10:55:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e9XwY-00073l-H1 for qemu-devel@nongnu.org; Tue, 31 Oct 2017 10:55:10 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:52439) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e9XwY-00072j-8B for qemu-devel@nongnu.org; Tue, 31 Oct 2017 10:55:06 -0400 Received: by mail-wm0-x242.google.com with SMTP id t139so23845224wmt.1 for ; Tue, 31 Oct 2017 07:55:06 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id m25sm1495530wmi.7.2017.10.31.07.54.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 31 Oct 2017 07:55:03 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id DF3C13E0EE2; Tue, 31 Oct 2017 14:54:57 +0000 (GMT) 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=/2Qj1qfMNK+2DZhS7va2bYrvohJo86Kgg4xJvX62igU=; b=FyNxPm2ttSszKHSRwPur2AfJwI4pAmZDsFdsolFH3EEjAapSHnFUvIh89Wq7NeHA0z nIQMiMoOM9KiWNBY5AqwI1/r6f1642FoKH7cU3hlPZTdNh3QQGecoID01zj1vmD961Ps 4kiaKxvTou6cG2JZoFiGTGhXkRklY9z/ccRwU= 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=/2Qj1qfMNK+2DZhS7va2bYrvohJo86Kgg4xJvX62igU=; b=VlImHA7zEqMmPS1H1FJktdRLbq8lBd6/55oGVNDqhVyvdmkaXVVD3LXjxOiK6tloFZ 5YEVFX7DqaQiAy9OeDbMHC0sYZtigYPUD4hFCbKsD89DPzO0N3JXXFtd1541WW/l6VIx JDj5/Dv5/al0tOqkJDiw+uoLDE5T4SXz3Q3dd9F3Ob1udO4reBKCMJ++4lsfhPsb6mi/ sp7dE2ToZaAQbaydR9hrSrjM9uj2OUKcH5NoH67GRtVnjyaHyrGVX9atqn4pPLoJP1H+ NlT/dmsiAA94crgKNDtccM/hhXrCDUaVFU4X4RGApOIE9RvOg8PIOcfVAxvEB+FJgcRo bukA== X-Gm-Message-State: AMCzsaWpwsTfQiElc25ibqaC0tRD7Qjs6ZryYI2tr3rxsVC2GhGPGsnA D4V1k8PzlobWVW8aJm5YPnZ5dEv65jg= X-Google-Smtp-Source: ABhQp+TQjimXNLx9Zp++c8pYj6/XHe8+o8nUjCyZ7F8ZfykCjZXHCHucWEuqwpZdcoaDRW+y9QQP+A== X-Received: by 10.28.178.81 with SMTP id b78mr2096875wmf.157.1509461705032; Tue, 31 Oct 2017 07:55:05 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Tue, 31 Oct 2017 14:54:43 +0000 Message-Id: <20171031145444.13766-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171031145444.13766-1-alex.bennee@linaro.org> References: <20171031145444.13766-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [RISU PATCH 6/7] risugen: support @GroupName in risu files X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 The existing pattern support is useful but it does get a little tedious when faced with large groups of instructions. This introduces the concept of a @GroupName which can be sprinkled in the risu definition and is attached to all instructions following its definition until the next group or an empty group "@" is specified. It can be combined with the existing pattern support to do things like: ./risugen --group AdvSIMDAcrossVector --not-pattern ".*_RES" aarch64.risu= foo.bin Signed-off-by: Alex Benn=C3=A9e --- README | 10 ++++++++++ risugen | 20 ++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/README b/README index 312e9cd..9946e6e 100644 --- a/README +++ b/README @@ -75,6 +75,10 @@ reads the configuration file arm.risu, and generates 100= 00 instructions based on the instruction patterns matching the regular expression "VQSHL.*imm.*". The resulting binary is written to vqshlimm.out. =20 +An alternative to using regular expression patterns is to use the +--group specifier. This relies on the configuration file having been +annotated with suitable @ markers. + This binary can then be passed to the risu program, which is written in C. You need to run risu on both an ARM native target and on the program under test. The ARM native system is the 'master' @@ -140,6 +144,12 @@ Lines starting with a '.' are directives to risu/risug= en: * ".mode [thumb|arm]" specifies whether the file contains ARM or Thumb instructions; it must precede all instruction patterns. =20 +Lines starting with a '@' are a grouping directive. Instructions +following will be assigned to a comma separated list of groups. The +list of groups is reset at the next '@' directive which may be empty. +This provides an alternative method to selecting instructions than RE +patterns. + Other lines are instruction patterns: insnname encodingname bitfield ... [ [ !blockname ] { blocktext } ] where each bitfield is either: diff --git a/risugen b/risugen index 8bfb0e9..aba4bb7 100755 --- a/risugen +++ b/risugen @@ -34,7 +34,10 @@ my @insn_keys; =20 # The arch will be selected based on .mode directive defined in risu file. my $arch =3D ""; +# Current group, updated by @GroupName +my $insn_group =3D ""; =20 +my @group =3D (); # include groups my @pattern_re =3D (); # include pattern my @not_pattern_re =3D (); # exclude pattern =20 @@ -122,6 +125,11 @@ sub parse_config_file($) exit(1); } =20 + if ($tokens[0] =3D~ /^@(.*)/ ) { + $insn_group =3D $1; + next; + } + if ($tokens[0] =3D~ /^\./) { parse_risu_directive($file, $seen_pattern, @tokens); next; @@ -239,6 +247,9 @@ sub parse_config_file($) $insnrec->{fixedbits} =3D $fixedbits; $insnrec->{fixedbitmask} =3D $fixedbitmask; $insnrec->{fields} =3D [ @fields ]; + if (length $insn_group) { + $insnrec->{group} =3D $insn_group; + } $insn_details{$insnname} =3D $insnrec; } close(CFILE) or die "can't close $file: $!"; @@ -249,6 +260,12 @@ sub select_insn_keys () { # Get a list of the insn keys which are permitted by the re patterns @insn_keys =3D sort keys %insn_details; + if (@group) { + my $re =3D join("|",@group); + @insn_keys =3D grep { + defined($insn_details{$_}->{group}) && + grep /$re/, $insn_details{$_}->{group}} @insn_keys + } if (@pattern_re) { my $re =3D '\b((' . join(')|(',@pattern_re) . '))\b'; @insn_keys =3D grep /$re/, @insn_keys; @@ -277,6 +294,7 @@ Valid options: --fpscr n : set initial FPSCR (arm) or FPCR (aarch64) value (defaul= t is 0) --condprob p : [ARM only] make instructions conditional with probabili= ty p (default is 0, ie all instructions are always executed) + --group name[,name..]: only use instructions in defined groups --pattern re[,re...] : only use instructions matching regular expressi= on Each re must match a full word (that is, we match on the perl regex '\\b((re)|(re))\\b'). This means that @@ -305,6 +323,7 @@ sub main() GetOptions( "help" =3D> sub { usage(); exit(0); }, "numinsns=3Di" =3D> \$numinsns, "fpscr=3Do" =3D> \$fpscr, + "group=3Ds" =3D> \@group, "pattern=3Ds" =3D> \@pattern_re, "not-pattern=3Ds" =3D> \@not_pattern_re, "condprob=3Df" =3D> sub { @@ -319,6 +338,7 @@ sub main() # allow "--pattern re,re" and "--pattern re --pattern re" @pattern_re =3D split(/,/,join(',',@pattern_re)); @not_pattern_re =3D split(/,/,join(',',@not_pattern_re)); + @group =3D split(/,/,join(',',@group)); =20 if ($#ARGV !=3D 1) { usage(); --=20 2.14.2