This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Cleanups for the m68k backend


 > Another cleanup issue I'd like to address is getting rid of hundereds
 > of redundant lines depending on "#ifdef MOTOROLA".  This would require
 > adding support for the '%.' in asm_fprintf(), which is supposed to be
 > platform independent. This change would make the m68k backend much
 > easier to work with.

I think removing all those conditionals is a good thing.  However
looking at m68k.c, there seem to be many more assembler differences
than just a "."  as a size separator.

I'd like to do this in a way that's compatible with the asm_fprintf
format checking I added in gcc-3.4.  Adding individual %<characters>
which are different for each platform is probably hard to get working
with specifier checking.  I'd rather not add tons of new
ASM_FPRINTF_EXTENSIONS because it will completely ruin format checks.
So I have some suggestions that might work.

1.  One option might be to use %O and extend ASM_OUTPUT_OPCODE to use
print_operand for punctuation.  If you do that then something like
this:

 > 	    asm_fprintf (stream,
 > #ifdef MOTOROLA
 > 			 "\t%Omove.l %s,-(%Rsp)\n",
 > #else
 > 			 "\tmovel %s,%Rsp@-\n",
 > #endif
 > 			 reg_names[15 - i]);

becomes this:

 > asm_fprintf (stream, "\t%Omove%O.l %s,%O-\n", reg_names[15 - i]);

(I'm not sure if overloading %O is a good idea.)


2.  Another option would be to use a new specifier %P<punct_character>
where <punct_character> is passed by asm_fprintf to print_operand like
in option 1.  If you do that, then the above example becomes this:

 > asm_fprintf (stream, "\t%Omove%P.l %s,%P-\n", reg_names[15 - i]);


3.  Another option is to use ASSEMBLER_DIALECTs:

 > asm_fprintf (stream, "\t{%Omove.l|movel} %s,{-(%Rsp)|%Rsp@-}\n", reg_names[15 - i]);

I think this one requires no changes to asm_fprintf etc, it's just a
lot of typing in m68k.c.  (Lots of chances for typos though.)


I'd be happy to help modify asm_fprintf or update the format checks
if you decide to use option 1 or 2.

		--Kaveh
--
Kaveh R. Ghazi			ghazi@caip.rutgers.edu


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]