public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: YunQiang Su <yunqiang.su@cipunited.com>
To: gcc-patches@gcc.gnu.org
Cc: syq@debian.org, xry111@mengyan1223.wang,
	YunQiang Su <yunqiang.su@cipunited.com>
Subject: [PATCH 3/3] MIPS: add .module mipsREV to all output asm file
Date: Sat, 28 Aug 2021 08:05:49 -0400	[thread overview]
Message-ID: <20210828120549.263010-3-yunqiang.su@cipunited.com> (raw)
In-Reply-To: <20210828120549.263010-1-yunqiang.su@cipunited.com>

Currently, the asm output file for MIPS has no rev info.
It can make some trouble, for example:
  assembler is mips1 by default,
  gcc is fpxx by default.
To assemble the output of gcc -S, we have to pass -mips2
to assembler.

gcc/ChangeLog:

    * gcc/config/mips/mips.c (mips_module_isa_name): New.
        mips_file_start: add .module mipsREV to all asm output
---
 gcc/config/mips/mips.c | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 2f7ffe846..b344cf3fc 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -9841,6 +9841,44 @@ mips_mdebug_abi_name (void)
     }
 }
 
+static const char *
+mips_module_isa_name ()
+{
+  switch (mips_isa)
+    {
+    case MIPS_ISA_MIPS1:
+      return "mips1";
+    case MIPS_ISA_MIPS2:
+      return "mips2";
+    case MIPS_ISA_MIPS3:
+      return "mips3";
+    case MIPS_ISA_MIPS4:
+      return "mips4";
+    case MIPS_ISA_MIPS32:
+      return "mips32";
+    case MIPS_ISA_MIPS32R2:
+      return "mips32r2";
+    case MIPS_ISA_MIPS32R3:
+      return "mips32r3";
+    case MIPS_ISA_MIPS32R5:
+      return "mips32r5";
+    case MIPS_ISA_MIPS32R6:
+      return "mips32r6";
+    case MIPS_ISA_MIPS64:
+      return "mips64";
+    case MIPS_ISA_MIPS64R2:
+      return "mips64r2";
+    case MIPS_ISA_MIPS64R3:
+      return "mips64r3";
+    case MIPS_ISA_MIPS64R5:
+      return "mips64r5";
+    case MIPS_ISA_MIPS64R6:
+      return "mips64r6";
+    default:
+      gcc_unreachable ();
+    }
+}
+
 /* Implement TARGET_ASM_FILE_START.  */
 
 static void
@@ -9873,6 +9911,9 @@ mips_file_start (void)
 	     mips_nan == MIPS_IEEE_754_2008 ? "2008" : "legacy");
 
 #ifdef HAVE_AS_DOT_MODULE
+  fprintf (asm_out_file, "\t.module\t%s\n",
+	   mips_module_isa_name ());
+
   /* Record the FP ABI.  See below for comments.  */
   if (TARGET_NO_FLOAT)
 #ifdef HAVE_AS_GNU_ATTRIBUTE
-- 
2.30.2


  parent reply	other threads:[~2021-08-28 12:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-28 12:05 [PATCH 1/3] md/define_c_enum: support value assignation YunQiang Su
2021-08-28 12:05 ` [PATCH 2/3] MIPS: use mips_isa enum instead hardcoded numbers YunQiang Su
2021-08-29  5:46   ` Xi Ruoyao
2021-08-30  2:06     ` YunQiang Su
2021-08-28 12:05 ` YunQiang Su [this message]
2021-08-29  5:41 ` [PATCH 1/3] md/define_c_enum: support value assignation Xi Ruoyao
2021-08-31  9:45 ` Richard Sandiford

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210828120549.263010-3-yunqiang.su@cipunited.com \
    --to=yunqiang.su@cipunited.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=syq@debian.org \
    --cc=xry111@mengyan1223.wang \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).