From patchwork Sat Apr 13 05:23:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 788570 Delivered-To: patch@linaro.org Received: by 2002:adf:e6ca:0:b0:346:15ad:a2a with SMTP id y10csp1041161wrm; Fri, 12 Apr 2024 22:25:31 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUL6wYgXReh1dulq2X8wJ9IGKMqnr5sDftDlQvOrfDH0TaRoVLtSCKFP1jDmHfM+3g2Y5UygFet+REmTrbbC10a X-Google-Smtp-Source: AGHT+IHTWavSzSSPSxIzbmL/UdlViO8FAnYkJhJaXOZMm7CxkB3hR966VuTB6KzRQOI2tpbO9oMn X-Received: by 2002:a05:620a:1199:b0:78a:3d2a:e0c with SMTP id b25-20020a05620a119900b0078a3d2a0e0cmr5521856qkk.8.1712985931498; Fri, 12 Apr 2024 22:25:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712985931; cv=none; d=google.com; s=arc-20160816; b=Gqd14vufmlKUVOOuntHE+tYPP1QNXU1UuDU8ewwE/Ij1sQm9ZddGd671g4xzcCjD78 mK5sowjmeL0vVAjMITSI6EoNYvacrYqBrUIUa4of4UwO4HGbZsjkz4RmvzsindGDidK5 SNzYs3BySGIugLFVXST2pIAgfs/+BXwXGpr7ZM3Z4t4GnHxKBgibWWGvTOuewZU0q5kl 544L+hf5MYydqd3G50GrPUKfurG251EEwtCU+6/HZ4m9xj58upR2zCIZ4a5xoh+XhPvZ OgxhIQmqx7BIYDb794CVDAV1tjKkHVanP1Sv1vfhMf0fF25mY7OLQcsEzkFSvfqOESS0 5QBA== 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:cc:to :from:dkim-signature; bh=nGlcb0FOsVrtW/loWoknwOL1pthHdADUVw02ahp2qOs=; fh=8mBO+FwhNjUD9ALhUxcYEwIlwc/hLQI6+6+QuDX34lg=; b=xIWkHtkzrqDLZmx8ZJ4i9rJsjbuuIGOUQ6y33sGacYERvnyNRwqo/zB3fxhholtMb7 UWO+JFFmgkuktfoTf/I908eXa69UDnxvUloyDDqzKu1MV+AcceslMnUg4mibVJbREPww gwJZO+Hdc5+OOHM8gTI9OtSmR1mqfWrWqZdZuQZWtxzw2F9nb3Z/FEWdpQ5CptvHxztm L7JC9X1wQEkC548ZUMyxCOmdvXUWyxmLXd9R7bncp217aS6qH/4YDEyzsKujw9Tqun6a UrfBQqaioIRO3p/Q8XXzinhUPFjqArNQFnaWrlobn7GArxRql97d2hk+iNeBEY5ATQNO Mowg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eTxDeJKH; 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 z3-20020a05622a028300b004368dea3523si3048510qtw.716.2024.04.12.22.25.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 12 Apr 2024 22:25:31 -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=eTxDeJKH; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rvVrc-0001t2-Ao; Sat, 13 Apr 2024 01:23:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rvVrb-0001ss-4l for qemu-devel@nongnu.org; Sat, 13 Apr 2024 01:23:43 -0400 Received: from mail-oo1-xc32.google.com ([2607:f8b0:4864:20::c32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rvVrY-0001dC-Mc for qemu-devel@nongnu.org; Sat, 13 Apr 2024 01:23:42 -0400 Received: by mail-oo1-xc32.google.com with SMTP id 006d021491bc7-5aa4204bacdso1222922eaf.2 for ; Fri, 12 Apr 2024 22:23:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712985819; x=1713590619; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nGlcb0FOsVrtW/loWoknwOL1pthHdADUVw02ahp2qOs=; b=eTxDeJKHK5jWg78ggzI05M8cZUleNlmYKPZbnzABr/wg6DQnb+Vke7uz/QsN2kJ0TC iQy9MtDiDf418EcWnvYwvOrYzFqavT4xkFSngc4k+tQBm6k2h8KTVW/2yE4l9UB3P2L3 thgJiW2jjogV8i2kKwApWyiowcXaB9oGOuVlUfWsGkF4iqojcf/JMUxHC6I7zGCu3yRH iYtitqCS1gPKEzCatRFaoiaXNyrxwBJntgL+Xju+GdS9ph5kRYYc8HKQnGI37rYJXiqV gQROfFiohT8WheePZLRJvFt0VDeUuosha4V0UWX2g5Ig1eHAdyjtAFkHK6T+Nv//4JDy 3aHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712985819; x=1713590619; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nGlcb0FOsVrtW/loWoknwOL1pthHdADUVw02ahp2qOs=; b=rJniLkQTeeOGS/2gatNTWVRDr2BnffZyshHZJCA8VStNOfYuDGevGz5+bT6TWwQlJ/ ApIVuWHPN6x6eYSmX3f+LTQc2aM2UbAot6nwiQiA9jz2AvbO9k6ywzpaGWpfQXk0KxaO skMUNJLC/faaTVq5RxqZwCnu4U8HhsuidWDdkJ7K2bJihlH2Ouy8mzUUQjGKJYuf3R7X bGHxj2M1SYbe8xe8u+CJHKEhzqoPXa51JGeibZy+KTZUbYUCA7nWHQ6EBIraL7hBOpNv iC30HrlH6L0zx8jpzXpZJUi+ngHrpx01FdQZyPLcnav33WO4rfJL3K+t4FpCZd4e9CH9 06Qg== X-Gm-Message-State: AOJu0YwimAIk7gteuw37S51bvjsHj+U1mgbI3aCmHIrqfoy5hEPKrI/q /psna19wQJx5VVcSBlUoiIva+7reohj4GrYUTTx9cMiXzYwo9u9DqTen8uEHIqWi89S0izgOM7X X X-Received: by 2002:a05:6358:7c13:b0:181:6575:1b22 with SMTP id p19-20020a0563587c1300b0018165751b22mr4657754rwf.6.1712985819025; Fri, 12 Apr 2024 22:23:39 -0700 (PDT) Received: from stoup.. (174-21-72-5.tukw.qwest.net. [174.21.72.5]) by smtp.gmail.com with ESMTPSA id v19-20020a17090abb9300b002a0544b81d6sm3564074pjr.35.2024.04.12.22.23.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 22:23:38 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: edgar.iglesias@gmail.com, philmd@linaro.org Subject: [PATCH 3/6] disas/cris: Drop with_reg_prefix Date: Fri, 12 Apr 2024 22:23:30 -0700 Message-Id: <20240413052333.688151-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240413052333.688151-1-richard.henderson@linaro.org> References: <20240413052333.688151-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c32; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc32.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 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-bounces+patch=linaro.org@nongnu.org The *_without_reg_prefix functions are all commented out. Remove them, remove all 'with_reg_prefix' parameters, and remove all of the conditions that test them. Signed-off-by: Richard Henderson --- disas/cris.c | 188 +++++++++------------------------------------------ 1 file changed, 32 insertions(+), 156 deletions(-) diff --git a/disas/cris.c b/disas/cris.c index 1cc8752104..27f71a8257 100644 --- a/disas/cris.c +++ b/disas/cris.c @@ -1692,13 +1692,11 @@ format_dec (long number, char *outbuffer, size_t outsize, int signedp) static char * format_reg (struct cris_disasm_data *disdata, int regno, - char *outbuffer_start, - bfd_boolean with_reg_prefix) + char *outbuffer_start) { char *outbuffer = outbuffer_start; - if (with_reg_prefix) - *outbuffer++ = REGISTER_PREFIX_CHAR; + *outbuffer++ = REGISTER_PREFIX_CHAR; switch (regno) { @@ -1726,14 +1724,12 @@ format_reg (struct cris_disasm_data *disdata, static char * format_sup_reg (unsigned int regno, - char *outbuffer_start, - bfd_boolean with_reg_prefix) + char *outbuffer_start) { char *outbuffer = outbuffer_start; int i; - if (with_reg_prefix) - *outbuffer++ = REGISTER_PREFIX_CHAR; + *outbuffer++ = REGISTER_PREFIX_CHAR; for (i = 0; cris_support_regs[i].name != NULL; i++) if (cris_support_regs[i].number == regno) @@ -1845,8 +1841,7 @@ print_with_operands (const struct cris_opcode *opcodep, it. */ const struct cris_opcode *prefix_opcodep, unsigned int prefix_insn, - unsigned char *prefix_buffer, - bfd_boolean with_reg_prefix) + unsigned char *prefix_buffer) { /* Get a buffer of somewhat reasonable size where we store intermediate parts of the insn. */ @@ -1908,12 +1903,11 @@ print_with_operands (const struct cris_opcode *opcodep, switch (*s) { case 'T': - tp = format_sup_reg ((insn >> 12) & 15, tp, with_reg_prefix); + tp = format_sup_reg ((insn >> 12) & 15, tp); break; case 'A': - if (with_reg_prefix) - *tp++ = REGISTER_PREFIX_CHAR; + *tp++ = REGISTER_PREFIX_CHAR; *tp++ = 'a'; *tp++ = 'c'; *tp++ = 'r'; @@ -1945,11 +1939,11 @@ print_with_operands (const struct cris_opcode *opcodep, case 'D': case 'r': - tp = format_reg (disdata, insn & 15, tp, with_reg_prefix); + tp = format_reg (disdata, insn & 15, tp); break; case 'R': - tp = format_reg (disdata, (insn >> 12) & 15, tp, with_reg_prefix); + tp = format_reg (disdata, (insn >> 12) & 15, tp); break; case 'n': @@ -2132,7 +2126,7 @@ print_with_operands (const struct cris_opcode *opcodep, { if (insn & 0x400) { - tp = format_reg (disdata, insn & 15, tp, with_reg_prefix); + tp = format_reg (disdata, insn & 15, tp); *tp++ = '='; } @@ -2174,8 +2168,7 @@ print_with_operands (const struct cris_opcode *opcodep, info->target2 = prefix_insn & 15; *tp++ = '['; - tp = format_reg (disdata, prefix_insn & 15, tp, - with_reg_prefix); + tp = format_reg (disdata, prefix_insn & 15, tp); if (prefix_insn & 0x400) *tp++ = '+'; *tp++ = ']'; @@ -2191,8 +2184,7 @@ print_with_operands (const struct cris_opcode *opcodep, number -= 256; /* Output "reg+num" or, if num < 0, "reg-num". */ - tp = format_reg (disdata, (prefix_insn >> 12) & 15, tp, - with_reg_prefix); + tp = format_reg (disdata, (prefix_insn >> 12) & 15, tp); if (number >= 0) *tp++ = '+'; tp = FORMAT_DEC (number, tp, 1); @@ -2205,11 +2197,9 @@ print_with_operands (const struct cris_opcode *opcodep, case BIAP_OPCODE: /* Output "r+R.m". */ - tp = format_reg (disdata, prefix_insn & 15, tp, - with_reg_prefix); + tp = format_reg (disdata, prefix_insn & 15, tp); *tp++ = '+'; - tp = format_reg (disdata, (prefix_insn >> 12) & 15, tp, - with_reg_prefix); + tp = format_reg (disdata, (prefix_insn >> 12) & 15, tp); *tp++ = '.'; *tp++ = mode_char[(prefix_insn >> 4) & 3]; @@ -2226,8 +2216,7 @@ print_with_operands (const struct cris_opcode *opcodep, case BDAP_INDIR_OPCODE: /* Output "r+s.m", or, if "s" is [pc+], "r+s" or "r-s". */ - tp = format_reg (disdata, (prefix_insn >> 12) & 15, tp, - with_reg_prefix); + tp = format_reg (disdata, (prefix_insn >> 12) & 15, tp); if ((prefix_insn & 0x400) && (prefix_insn & 15) == 15) { @@ -2297,8 +2286,7 @@ print_with_operands (const struct cris_opcode *opcodep, /* Output "r+[R].m" or "r+[R+].m". */ *tp++ = '+'; *tp++ = '['; - tp = format_reg (disdata, prefix_insn & 15, tp, - with_reg_prefix); + tp = format_reg (disdata, prefix_insn & 15, tp); if (prefix_insn & 0x400) *tp++ = '+'; *tp++ = ']'; @@ -2327,7 +2315,7 @@ print_with_operands (const struct cris_opcode *opcodep, } else { - tp = format_reg (disdata, insn & 15, tp, with_reg_prefix); + tp = format_reg (disdata, insn & 15, tp); info->flags |= CRIS_DIS_FLAG_MEM_TARGET_IS_REG; info->target = insn & 15; @@ -2340,7 +2328,7 @@ print_with_operands (const struct cris_opcode *opcodep, break; case 'x': - tp = format_reg (disdata, (insn >> 12) & 15, tp, with_reg_prefix); + tp = format_reg (disdata, (insn >> 12) & 15, tp); *tp++ = '.'; *tp++ = mode_char[(insn >> 4) & 3]; break; @@ -2414,7 +2402,7 @@ print_with_operands (const struct cris_opcode *opcodep, tp = FORMAT_DEC (number, tp, 1); *tp++ = ','; - tp = format_reg (disdata, (insn >> 12) & 15, tp, with_reg_prefix); + tp = format_reg (disdata, (insn >> 12) & 15, tp); } break; @@ -2436,8 +2424,7 @@ print_with_operands (const struct cris_opcode *opcodep, *tp++ = '?'; else { - if (with_reg_prefix) - *tp++ = REGISTER_PREFIX_CHAR; + *tp++ = REGISTER_PREFIX_CHAR; strcpy (tp, sregp->name); tp += strlen (tp); } @@ -2466,8 +2453,7 @@ print_with_operands (const struct cris_opcode *opcodep, static int print_insn_cris_generic (bfd_vma memaddr, - disassemble_info *info, - bfd_boolean with_reg_prefix) + disassemble_info *info) { int nbytes; unsigned int insn; @@ -2587,7 +2573,7 @@ print_insn_cris_generic (bfd_vma memaddr, to the operands. */ print_with_operands (matchedp, insn, bufp, addr, info, prefix_opcodep, prefix_insn, - prefix_buffer, with_reg_prefix); + prefix_buffer); } } } @@ -2622,134 +2608,24 @@ print_insn_cris_generic (bfd_vma memaddr, return advance; } -/* Disassemble, prefixing register names with `$'. CRIS v0..v10. */ -static int -print_insn_cris_with_register_prefix (bfd_vma vma, - disassemble_info *info) -{ - struct cris_disasm_data disdata; - info->private_data = &disdata; - cris_parse_disassembler_options (&disdata, info->disassembler_options, - cris_dis_v0_v10); - return print_insn_cris_generic (vma, info, true); -} -/* Disassemble, prefixing register names with `$'. CRIS v32. */ - -static int -print_insn_crisv32_with_register_prefix (bfd_vma vma, - disassemble_info *info) -{ - struct cris_disasm_data disdata; - info->private_data = &disdata; - cris_parse_disassembler_options (&disdata, info->disassembler_options, - cris_dis_v32); - return print_insn_cris_generic (vma, info, true); -} - -#if 0 -/* Disassemble, prefixing register names with `$'. - Common v10 and v32 subset. */ - -static int -print_insn_crisv10_v32_with_register_prefix (bfd_vma vma, - disassemble_info *info) -{ - struct cris_disasm_data disdata; - info->private_data = &disdata; - cris_parse_disassembler_options (&disdata, info->disassembler_options, - cris_dis_common_v10_v32); - return print_insn_cris_generic (vma, info, true); -} - -/* Disassemble, no prefixes on register names. CRIS v0..v10. */ - -static int -print_insn_cris_without_register_prefix (bfd_vma vma, - disassemble_info *info) -{ - struct cris_disasm_data disdata; - info->private_data = &disdata; - cris_parse_disassembler_options (&disdata, info->disassembler_options, - cris_dis_v0_v10); - return print_insn_cris_generic (vma, info, false); -} - -/* Disassemble, no prefixes on register names. CRIS v32. */ - -static int -print_insn_crisv32_without_register_prefix (bfd_vma vma, - disassemble_info *info) -{ - struct cris_disasm_data disdata; - info->private_data = &disdata; - cris_parse_disassembler_options (&disdata, info->disassembler_options, - cris_dis_v32); - return print_insn_cris_generic (vma, info, false); -} - -/* Disassemble, no prefixes on register names. - Common v10 and v32 subset. */ - -static int -print_insn_crisv10_v32_without_register_prefix (bfd_vma vma, - disassemble_info *info) -{ - struct cris_disasm_data disdata; - info->private_data = &disdata; - cris_parse_disassembler_options (&disdata, info->disassembler_options, - cris_dis_common_v10_v32); - return print_insn_cris_generic (vma, info, false); -} -#endif - int print_insn_crisv10 (bfd_vma vma, disassemble_info *info) { - return print_insn_cris_with_register_prefix(vma, info); + struct cris_disasm_data disdata; + info->private_data = &disdata; + cris_parse_disassembler_options (&disdata, info->disassembler_options, + cris_dis_v0_v10); + return print_insn_cris_generic (vma, info); } int print_insn_crisv32 (bfd_vma vma, disassemble_info *info) { - return print_insn_crisv32_with_register_prefix(vma, info); + struct cris_disasm_data disdata; + info->private_data = &disdata; + cris_parse_disassembler_options (&disdata, info->disassembler_options, + cris_dis_v32); + return print_insn_cris_generic (vma, info); } - -/* Return a disassembler-function that prints registers with a `$' prefix, - or one that prints registers without a prefix. - FIXME: We should improve the solution to avoid the multitude of - functions seen above. */ -#if 0 -disassembler_ftype -cris_get_disassembler (bfd *abfd) -{ - /* If there's no bfd in sight, we return what is valid as input in all - contexts if fed back to the assembler: disassembly *with* register - prefix. Unfortunately this will be totally wrong for v32. */ - if (abfd == NULL) - return print_insn_cris_with_register_prefix; - - if (bfd_get_symbol_leading_char (abfd) == 0) - { - if (bfd_get_mach (abfd) == bfd_mach_cris_v32) - return print_insn_crisv32_with_register_prefix; - if (bfd_get_mach (abfd) == bfd_mach_cris_v10_v32) - return print_insn_crisv10_v32_with_register_prefix; - - /* We default to v10. This may be specifically specified in the - bfd mach, but is also the default setting. */ - return print_insn_cris_with_register_prefix; - } - - if (bfd_get_mach (abfd) == bfd_mach_cris_v32) - return print_insn_crisv32_without_register_prefix; - if (bfd_get_mach (abfd) == bfd_mach_cris_v10_v32) - return print_insn_crisv10_v32_without_register_prefix; - return print_insn_cris_without_register_prefix; -} -#endif -/* Local variables: - eval: (c-set-style "gnu") - indent-tabs-mode: t - End: */