From patchwork Thu Apr 21 15:17:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 564379 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp562604map; Thu, 21 Apr 2022 08:59:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2FGvvQeSwS193AtZI3XXVbGc9B6ekc4t7mGX2OFhzVEKgyxqtkcmtVRsd3P/EWVO8Qrok X-Received: by 2002:a81:106:0:b0:2d0:e682:8a7a with SMTP id 6-20020a810106000000b002d0e6828a7amr323251ywb.257.1650556741077; Thu, 21 Apr 2022 08:59:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650556741; cv=none; d=google.com; s=arc-20160816; b=c1xzJ9A8z3pDmAYncNlkN4MXAhdaXkzb5veXcphBT/GQTso02jH3GGNeQSBOAIJME9 WjZRJ71qEwsPz2TfgckNBBsIxuWz1q380cbO+G3YOxrJwHZThhy2M7jkrNGytWlO/w2u EqEXRLfLh2aj8ghApHboiveEZpjTAGh8VCATXy0wB2ob5zl2KuPDdXk7ullbo9qF1212 eK63zx8jsP4Vb+T5dU2ejJfQDjV6Kb9NYKt2T5u2ffCYnjeh7Fw8BewikdRGjmDlzK80 TjoawgC2PIjiDNQp+uMu348XJ8qlz+XvGBQ9mQsO/7bgTh8A+//BMZMrQgnX9vS/rNca Fi2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=53MZZNDB0rhSLJpIhEdQDdsMsfXozPnpLTtHb5F2LMY=; b=FduBGXL4otBoKKlS9sjZjWPC8IIkT3J9yOE6D9HXEbvGt7yrqacW8W8wfK3TDUpYKn mkvUvdypH+kt7KMQUJJgMzn8yGhSjkRRlz5otjkEuFBk8DZiv6Kpjljm7uWUOjs7cu+b esozzLlwKgHK2Au7f579mzvy9gZNAtF2yuHxAtI//ufTR+ujS5OsBjerCOjaHx0p1bTi afm8ldLH6fzIyVnB5jw+IlylvYnr95b0ERbexTU/tBVVRQbc78BiPGfKFzLx6SbZbwSp o5kWKgAop186JBmMtz03itZ888/SbPe0EWh6ZouzgoDoLi7sctKCkT/kAMwONqdJ98ud 5zOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Mog8qViM; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t1-20020a81e441000000b002eb8979915asi2880179ywl.64.2022.04.21.08.59.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Apr 2022 08:59:01 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Mog8qViM; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:41146 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhZCu-0007iR-It for patch@linaro.org; Thu, 21 Apr 2022 11:59:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44802) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhYcv-0005LS-GP for qemu-devel@nongnu.org; Thu, 21 Apr 2022 11:21:49 -0400 Received: from mail-il1-x12f.google.com ([2607:f8b0:4864:20::12f]:40504) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhYcs-00075e-AR for qemu-devel@nongnu.org; Thu, 21 Apr 2022 11:21:49 -0400 Received: by mail-il1-x12f.google.com with SMTP id y16so3246274ilc.7 for ; Thu, 21 Apr 2022 08:21:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=53MZZNDB0rhSLJpIhEdQDdsMsfXozPnpLTtHb5F2LMY=; b=Mog8qViM69Oo9Ol8+uPv9Ady9VlEjh8mTqWt0wI1ngSr+oMxuyHeOpTs/5PCCbYBaW Kv2pukagCZ39cX7NWrrw310cBHYrXED2SD+GkpgU6k+5GPBjLHe038JSxFOYUz5TNjlg zNKvA2TF52lQovVd587pGfOGp0nECjMyLVo6SIRoLseokkF75Ls+F5smWeuIyoFueXb0 rsLdLAg1+kyzIRAhnJbQ29LbD+mKYtFjpOJn1OdzKc44C704fsvt6X5ICpqsPcDHBMhL yNavWkVuzZQA9WFJkeai19Q9/mq0ozt+zy9uKsCtWngNJ4ODcwbpz0etk14z1T6fVb++ Ywbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=53MZZNDB0rhSLJpIhEdQDdsMsfXozPnpLTtHb5F2LMY=; b=DpMw8b1okRCVKuk3AUOWfV59nJdESDNeynBWeW2MYfYJYlJrrym9NP5DjMdFE+dfrY nF+xnpNZrFiODAxwRQ0fG5u06L5nOwr3bBUu78NcJkpgIvBtUJ4tXaHaBz3wh/b3H9FJ IUIr2H5HnoKsoIFj4pL9QGgHohHG6gGVtsy/OoDoG2IswCGOPu8Rp41wgIBTsSLyUdPc T7Sl9LrBu5pres5BRyKPxzvabKavvOI+eW3ZuyRpUHcXSc1AV8vvcF/NryB91gJP+v7p HgbJtXbKiXIVORLx0XKfxCON3uYUXNzZDio5keJX8G6N5ImjFbAlEt9jLg6Svrm640C5 Fhjg== X-Gm-Message-State: AOAM5328F/i5LleCuEXOgVDP+91qYInZeEjRDH7FWkDYnLofrSsWD0ME 107wHGC1hM2cAtWZx/8RDSCsFsCbY2iscQ== X-Received: by 2002:a92:d212:0:b0:2cb:7635:9940 with SMTP id y18-20020a92d212000000b002cb76359940mr86318ily.132.1650554505232; Thu, 21 Apr 2022 08:21:45 -0700 (PDT) Received: from stoup.. ([2607:fb90:80c8:6cf3:a91a:4957:ba18:ac18]) by smtp.gmail.com with ESMTPSA id j1-20020a926e01000000b002cc52449a19sm3985402ilc.35.2022.04.21.08.21.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 08:21:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v7 43/64] target/nios2: Split out named structs for [IRJ]_TYPE Date: Thu, 21 Apr 2022 08:17:14 -0700 Message-Id: <20220421151735.31996-44-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220421151735.31996-1-richard.henderson@linaro.org> References: <20220421151735.31996-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::12f; envelope-from=richard.henderson@linaro.org; helo=mail-il1-x12f.google.com 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_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Currently the structures are anonymous within the macro. Pull them out to standalone types. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/nios2/translate.c | 48 ++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/target/nios2/translate.c b/target/nios2/translate.c index f33015f942..a3c63dbbbd 100644 --- a/target/nios2/translate.c +++ b/target/nios2/translate.c @@ -53,16 +53,18 @@ #define INSN_R_TYPE 0x3A /* I-Type instruction parsing */ +typedef struct { + uint8_t op; + union { + uint16_t u; + int16_t s; + } imm16; + uint8_t b; + uint8_t a; +} InstrIType; + #define I_TYPE(instr, code) \ - struct { \ - uint8_t op; \ - union { \ - uint16_t u; \ - int16_t s; \ - } imm16; \ - uint8_t b; \ - uint8_t a; \ - } (instr) = { \ + InstrIType (instr) = { \ .op = extract32((code), 0, 6), \ .imm16.u = extract32((code), 6, 16), \ .b = extract32((code), 22, 5), \ @@ -70,15 +72,17 @@ } /* R-Type instruction parsing */ +typedef struct { + uint8_t op; + uint8_t imm5; + uint8_t opx; + uint8_t c; + uint8_t b; + uint8_t a; +} InstrRType; + #define R_TYPE(instr, code) \ - struct { \ - uint8_t op; \ - uint8_t imm5; \ - uint8_t opx; \ - uint8_t c; \ - uint8_t b; \ - uint8_t a; \ - } (instr) = { \ + InstrRType (instr) = { \ .op = extract32((code), 0, 6), \ .imm5 = extract32((code), 6, 5), \ .opx = extract32((code), 11, 6), \ @@ -88,11 +92,13 @@ } /* J-Type instruction parsing */ +typedef struct { + uint8_t op; + uint32_t imm26; +} InstrJType; + #define J_TYPE(instr, code) \ - struct { \ - uint8_t op; \ - uint32_t imm26; \ - } (instr) = { \ + InstrJType (instr) = { \ .op = extract32((code), 0, 6), \ .imm26 = extract32((code), 6, 26), \ }