From patchwork Fri Feb 23 15:46:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 129425 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp779873lja; Fri, 23 Feb 2018 08:14:53 -0800 (PST) X-Google-Smtp-Source: AG47ELvFDI+eBjaShsJb8hqov3wzHM5PvFwogkEWd16mE+7EkQKu3Rod3xvPIpv+7Vv7ddHXUBd7 X-Received: by 2002:a25:1e54:: with SMTP id e81-v6mr1504740ybe.38.1519402493026; Fri, 23 Feb 2018 08:14:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519402493; cv=none; d=google.com; s=arc-20160816; b=anWRslZ+yp7kZp55k/BQwAKAfwvy0odI1ftjoltP//EZ8uZJsiBMHj+6dS90J8+NT3 YTt/UTPQLCQoRLrrbIDiAm7Et3ckYE/SASJhggVzNIwR2dkmp5SxWOkFEB3V3mz/8FSE kjG1+MskSV1yQcNPXComqqRLwNKZahBELepJ9Gt4VgAoDQmkDUacjP4qZfUHObnhz3YX yJdhk8+sdmyH6XEhR+hG4+o2fuy4pRobr+iI1PXegpbA9RFBDebkXMj48JffPxy2hE2H 0hPPlxKf9Vbujq2IziWF4HRhDo0sLw1jhT7TyJGVU+9TU7rm7KhupW9llQjO/xe8ZM7l OUPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=/JQYDJTsx6TC/FxJeq/wGoiGNuBgAF5wmf8OnNbEaes=; b=IHup5qJcjkCkP3J8aYjOfrQ98j07ghJkVMMUIaDhLt0+kWI76CF1Tbn8SyJtm4CS7S ooX6sQNFFJiW4hRn+Oo9/9yK89vb4JPb3mlxPYCLZpALw9GkNn1zQgd4kFA/Ceh2O45Z u+W/M6SVZJL2jN5E9BxYYWf7mPN4LebohAFSJUnNQzMis3U6dYkKoURrrbIy8Ia2TOSv RN4AkjKs4DG9mF2DBW+zVD8Dl8PBP8rjHtdtWJcApyJqiGImroP0olRoX0Bz1vsjjzrE L8SoLLSB0aaCtbr4krCLJYuDuiL5r1crJVZB/U7BkPbzKzdiu32EkfdS2Y+/op35QXUI xKeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=MSBf7mbG; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id f195-v6si461764ybg.199.2018.02.23.08.14.52 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 23 Feb 2018 08:14:53 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=MSBf7mbG; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:45488 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1epFzo-0003Bm-AX for patch@linaro.org; Fri, 23 Feb 2018 11:14:52 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48183) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1epFYE-0003j3-7m for qemu-devel@nongnu.org; Fri, 23 Feb 2018 10:46:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1epFYC-0008FY-Oj for qemu-devel@nongnu.org; Fri, 23 Feb 2018 10:46:22 -0500 Received: from mail-wm0-x232.google.com ([2a00:1450:400c:c09::232]:38580) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1epFYC-0008Cq-Gd for qemu-devel@nongnu.org; Fri, 23 Feb 2018 10:46:20 -0500 Received: by mail-wm0-x232.google.com with SMTP id z9so5366016wmb.3 for ; Fri, 23 Feb 2018 07:46:20 -0800 (PST) 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=/JQYDJTsx6TC/FxJeq/wGoiGNuBgAF5wmf8OnNbEaes=; b=MSBf7mbGN6uKVhUTAkddl84k5PHdztaG00kPMm3iBkwBMfG9jVpuCldWFyKETDgTIO M88ZsemOntcfJTN26megbMUmBgVpgTyudHWU1mSVJXcLQgJIvpz7uTOmxXnaaZmjOJyz Fy1c+EbBtYDudKAETJJVkFvGNXSqUnxP2+zCA= 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=/JQYDJTsx6TC/FxJeq/wGoiGNuBgAF5wmf8OnNbEaes=; b=ZlSQ90DU2qXGOokf1vrHFK+XDD8g5Cq+USnYtgYWmtjrXW5DXVP/heqZQscuxiMxOc rdYX2ZiTcQDIBsbnBUp5hxrs2TpfzXII7jQPH8v/mwqEcELZgN+uRb/WxefJT+AnaX3J w219BhrjtTReF6RVji/rUj9QYLsIM3Lxe30G5o3fIQBqiH3+SikjcR32xvBVn2L7E/7y YoO5YP/NJtILN4OvGqow++N6Iiizoc6sNnknj7CLzKWurc4P+kDuKbRIw44s9No22owo Nhg7GByJ/PfrBPrZBanfT3s6HFH1FIry4AMmsdprM4vY007cw20ht2+8KisGQQxyLB2H +yHg== X-Gm-Message-State: APf1xPCZMNfzoG+1XIFK/ja+FMdqVtmbW8ugPZI5hiaQwq/FtcHfkbS7 ELY6bcsdNDDJGKITyqIaZhslNg== X-Received: by 10.28.191.90 with SMTP id p87mr1667056wmf.145.1519400779199; Fri, 23 Feb 2018 07:46:19 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id k130sm2748806wmg.9.2018.02.23.07.46.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Feb 2018 07:46:16 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 2AB873E0427; Fri, 23 Feb 2018 15:46:14 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 23 Feb 2018 15:46:09 +0000 Message-Id: <20180223154613.2096-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180223154613.2096-1-alex.bennee@linaro.org> References: <20180223154613.2096-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::232 Subject: [Qemu-devel] [PATCH v1 4/8] new contrib/generate_all.sh: batch risugen script 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: =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-arm@nongnu.org, richard.henderson@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This is a simple script for generating all instructions in a given RISU file. You can split up the batch size by passing a -n N command line options. For example: ./contrib/generate_all.sh -n 2 hp.risu testcases.armv8.2_hp Signed-off-by: Alex Bennée --- contrib/generate_all.sh | 96 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100755 contrib/generate_all.sh -- 2.15.1 diff --git a/contrib/generate_all.sh b/contrib/generate_all.sh new file mode 100755 index 0000000..1e6b847 --- /dev/null +++ b/contrib/generate_all.sh @@ -0,0 +1,96 @@ +#!/bin/bash +# +# Generate all patterns in a given RISU file +# +# Copyright (c) 2017 Linaro Limited +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Alex Bennée - initial implementation +# +# Usage: +# ./contrib/generate_all.sh + +set -e + +USAGE="Usage: `basename $0` [-h] [-n x] " +SPLIT=4 +RISUGEN=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd -P)/risugen + +# Parse command line options. +while getopts hn: OPT; do + case "$OPT" in + h) + echo $USAGE + exit 0 + ;; + n) + SPLIT=$OPTARG + ;; + \?) + # getopts issues an error message + echo $USAGE >&2 + exit 1 + ;; + esac +done + +# Remove the switches we parsed above. +shift `expr $OPTIND - 1` + +while [ $# -ne 0 ]; do + + if [ -f $1 ]; then + RISU_FILE=$1; + elif [ -d $1 ]; then + TARGET_DIR=$1; + elif [ ! -e $1 ]; then + TARGET_DIR=$1 + fi + + shift +done + +if test -z "${RISUGEN}" || test ! -x "${RISUGEN}"; then + echo "Couldn't find risugen (${RISUGEN})" + exit 1 +fi + +if [ -z "$RISU_FILE" ]; then + echo "Need to set a .risu file for patterns" + exit 1 +fi + +if [ -z "${TARGET_DIR}" ]; then + echo "Need to set a TARGET_DIR" + exit 1 +fi + + +mkdir -p ${TARGET_DIR} + +ALL_INSNS=$(cat ${RISU_FILE} | ag "^\w" | cut -f 1 -d " " | sort) +COUNT=$(cat ${RISU_FILE=} | ag "^\w" | cut -f 1 -d " " | wc -l) +set -- $ALL_INSNS + +GROUP=$((COUNT / ${SPLIT})) + +while test $# -gt 0 ; do + INSN_PATTERNS="" + I_FILE="${TARGET_DIR}/insn_" + for i in `seq 1 ${SPLIT}`; do + I=$1 + if test -n "${I}"; then + shift + INSN_PATTERNS="${INSN_PATTERNS} --pattern ${I}" + I_FILE="${I_FILE}${I}_" + fi + done + I_FILE="${I_FILE}_INC.risu.bin" + CMD="${RISUGEN} ${INSN_PATTERNS} ${RISU_FILE} ${I_FILE}" + echo "Running: $CMD" + $CMD +done