From patchwork Tue Apr 26 18:18:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 566114 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp3871594map; Tue, 26 Apr 2022 12:16:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz3NbW4k4iF0W3L/9vtkRWJ/AOLS/99wa9gceikXIbZbzPTZuVqBQ1SDjsEJLehXVVLGPkn X-Received: by 2002:a81:13d6:0:b0:2ec:2b3f:28c6 with SMTP id 205-20020a8113d6000000b002ec2b3f28c6mr23852715ywt.10.1651000567609; Tue, 26 Apr 2022 12:16:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651000567; cv=none; d=google.com; s=arc-20160816; b=1BiDmx+YB7hV0BUT+JsfBjoa0w30iDc3FtbvHFebmh4lytq2wdAENWmgRSayOFoFHo i2Wn7R/AowcokKYASoO2shG3tONQadlvTXHCGsGoDa+enq4q2Qq1+wJo57KksnSRdC7a ir5hOasEpVIdIoa3xiQ6JovwOZCjRhOrN4YtoQdGPKDV8805xzemd0+YiEHsLY5/FViA 0DqOmofloiC3zEm2eRIRccQ3lGiy7g09k28bMkCYMhUR36fW/s/khCcDC13dBeqJIrQH UtoJnXcRygyfZEsghnP1rzkYD+PpMYndRZDx9HTZ/VlJXs0i5HcYo9tFIV2AtRrgHuiH ptRw== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=1DWNIJERXpZmtblRaXcb0XPGH7uKHZT6j2hdc+1VfWU=; b=gKRXYG27dImbgCdYjTuS8+M4RiYO/RtjBmg62jd9Y0OgED1gLh+oGKxjB/hOGBAS5a 80vKAOnRmubFLImqFCFgeOT7l866BCQrhDoLiBMW475E4DyVClIxyilUbez2uETpKeDD 5nEkL1kxYKX36xiuDm+rz1Vq9VVFPUsa9RmDy1ZltdqbJOQ1JjvT7vD7ngZ0fTLHp3VN mhsNPrXIT+qMCxtauyWfuBES5ZALXVy0FuLxJle8sXn48bONmTf2iYSP2NE9bG0cWq0P CBFQM1PGM6pTap+nuTO2Rfxxf3lWCB29NBbDuQC3RwVRczwCv433bLHYOSPTw36ZATuU LK1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lQ3SMUA1; 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 be19-20020a05690c009300b002ef6bf133e2si20512526ywb.149.2022.04.26.12.16.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Apr 2022 12:16:07 -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=lQ3SMUA1; 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]:34224 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1njQfP-0001j7-2M for patch@linaro.org; Tue, 26 Apr 2022 15:16:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45414) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1njPpr-0001nv-Up for qemu-devel@nongnu.org; Tue, 26 Apr 2022 14:22:54 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]:34662) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1njPpq-0005MM-9t for qemu-devel@nongnu.org; Tue, 26 Apr 2022 14:22:51 -0400 Received: by mail-pf1-x429.google.com with SMTP id a11so7479479pff.1 for ; Tue, 26 Apr 2022 11:22:49 -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=1DWNIJERXpZmtblRaXcb0XPGH7uKHZT6j2hdc+1VfWU=; b=lQ3SMUA15RscWulhrEmMAzLqxPIB/uVaZKFlJvSB+3qmMcSwgixY8k8MkFteoGC8Lo YmDPuVkFK4YopQH4i5eCR8qVhnVMYkR/UQciZLbQ6D6m/5gbazBInjtDv8vT2q5AG+LL Ta4F+LvlcOypzjLzjSYHqDsQkbYtdhT3ypmrsSa+/2l8fRxX7msx5BN+O+u8wBteJqVh fDILOdWBpJSe1zXq8ikbnc9tx//+7dKGPKEfG+RJoAnvoor6dOMWRQvNqisZ1A+S8rH2 QVj4s6IFkvmm+/Xnc9eSF/TcnrV3DLeVDxEBuHovUV695E7GbdbD+Gbi5+Mg4G1qv/25 pxLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1DWNIJERXpZmtblRaXcb0XPGH7uKHZT6j2hdc+1VfWU=; b=x7tv3hKbeZY/JkZx9uoJkOMoqVRbdXmbga631CAkW5yCP+SUa4KBI5g8uEg5/uZHjE e4BbFz7scBHe2IpJHEWdTbh17CsyKZe+7I5ETyn1n4o8dcv2GvK2w9yzZu0MXjFABqsV GpmILD8koHbgXNMVj1J/5fcuD6eA0L3mvq6yolHJcqB8qRy9/jDJcMFNsLmMPOxfhzv0 d2p9h5hq4T33q+6c/jiC5fpJTusVNha9DsYr0ixxCb1CuBWQP5B7AJ+gsVDbv4VW1ELu AhTqhh7s6cEIq4A2ykGhHpeaTIvbBW0TlIaav1E3b2RbMox3tp19fOyrVmMc4P2oIDz9 wd9A== X-Gm-Message-State: AOAM531AkZJS5hEZONADIILPpWaj3tnJPbe6+nIJzP8tpHKWAJAbw4ba 5uCQaRHo3pgF91WZPAnf7gvjYO/fMeMvrA== X-Received: by 2002:a05:6a00:1d24:b0:50c:f8b5:974d with SMTP id a36-20020a056a001d2400b0050cf8b5974dmr21479759pfx.76.1650997368673; Tue, 26 Apr 2022 11:22:48 -0700 (PDT) Received: from stoup.. (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id k187-20020a636fc4000000b003983a01b896sm13585053pgc.90.2022.04.26.11.22.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Apr 2022 11:22:48 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 43/68] target/nios2: Split out named structs for [IRJ]_TYPE Date: Tue, 26 Apr 2022 11:18:42 -0700 Message-Id: <20220426181907.103691-44-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220426181907.103691-1-richard.henderson@linaro.org> References: <20220426181907.103691-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x429.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: , Cc: Peter Maydell 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 Message-Id: <20220421151735.31996-44-richard.henderson@linaro.org> --- 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), \ }