On 8/26/2021 11:26 PM, Xi Ruoyao via Gcc-patches wrote:
On Fri, 2021-08-27 at 13:11 +0800, YunQiang Su wrote:
在 2021/6/18 11:29, YunQiang Su 写道:
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
ping for this patch.
---
gcc/config/mips/mips.c | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 1f1475cf400..51cc70e6ceb 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -9877,6 +9877,40 @@ mips_mdebug_abi_name (void)
}
}
+static const char *
+mips_module_isa_name()
GNU style: there should be a space before ().
Correct.
+{
I think it's better to add enum values like MIPS_ISA_MIPS64R2 and use a
switch statement here?
Yes, please. It's easier when someone has to debug the code later.
enums show up in debug output by default, while #defines do not.
switch (mips_isa)
{
case MIPS_ISA_MIPS1: return "mips1";
// ...
}
It looks better, and (maybe) generates better code. Just my 2 cents
though.
Coding standards would have that as
switch (mips_isa)
{
case MIPS_ISA_MIPS_1:
return "mips1";
...
}
Presumably .module is supported by all reasonably modern versions of GAS?
Jeff