[PATCH] Minor optimization: Turn a large macro into a function

Ian Lance Taylor iant@google.com
Fri Feb 2 18:21:00 GMT 2007


Andi Kleen <ak@suse.de> writes:

> On Friday 02 February 2007 18:59, Ian Lance Taylor wrote:
> > Andi Kleen <ak@suse.de> writes:
> > 
> > > 2007-02-02  Andi Kleen  <ak@suse.de>
> > > 
> > > 	* varasm.c (asm_output_ascii): Add.
> > > 	* output.h (asm_output_ascii): Declare.
> > > 	* varasm.c, dwarf2asm.c: Call asm_output_ascii.
> > 
> > The right thing to do is to make this a target hook,
> > targetm.asm_out.ascii.  Let's do that instead.  You can just have the
> > default function call ASM_OUTPUT_ASCII for now, and we can fix the
> > backends at our leisure.
> 
> What advantages would that have over the simple call? Do you expect
> this to change at runtime? 

We have a general policy of converting complex target macros into
target hooks.  The advantage is getting complex macros out of the
CPU.h files and into the CPU.c files, where they can be written more
normally and debugged more easily.

Ian



More information about the Gcc-patches mailing list