Xi Ruoyao via Gcc-patches <gcc-patches@gcc.gnu.org> 于2021年8月28日周六 下午3:09写道: > > On Fri, 2021-08-27 at 15:36 -0600, Jeff Law wrote: > > > 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"; > > ... > > } > > There is some existing code using "case ... : return ..." in one line in > mips.c, so I thought it was standard :(. > > > Presumably .module is supported by all reasonably modern versions of > > GAS? > > It's added by the commit in binutils-gdb: > > > commit 919731affbef19fcad8dddb0a595bb05755cb345 > > Author: mfortune <matthew.fort...@imgtec.com> > > Date: Tue May 20 13:28:20 2014 +0100 > > > > Add MIPS .module directive > > > > So it should be supported since binutils-2.25. > > If we want to support old binutils we'll need something like "-fno-mips- > module-directive" and "--without-mips-module-directive". My suggestion > is just bumping the binutils requirement for mips*-*-*. >
There is a macro, HAVE_AS_DOT_MODULE, so that we can just use it. #ifdef HAVE_AS_DOT_MODULE /* Record the FP ABI. See below for comments. */ if (TARGET_NO_FLOAT) #ifdef HAVE_AS_GNU_ATTRIBUTE fputs ("\t.gnu_attribute 4, 0\n", asm_out_file); #else ; #endif else if (!TARGET_HARD_FLOAT_ABI) fputs ("\t.module\tsoftfloat\n", asm_out_file); else if (!TARGET_DOUBLE_FLOAT) fputs ("\t.module\tsinglefloat\n", asm_out_file); else if (TARGET_FLOATXX) fputs ("\t.module\tfp=xx\n", asm_out_file); else if (TARGET_FLOAT64) fputs ("\t.module\tfp=64\n", asm_out_file); else fputs ("\t.module\tfp=32\n", asm_out_file); if (TARGET_ODD_SPREG) fputs ("\t.module\toddspreg\n", asm_out_file); else fputs ("\t.module\tnooddspreg\n", asm_out_file); #else Thank you for your help. >