This is the mail archive of the gcc-patches@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]

Re: Patch to add __builtin_printf -> fputs transformations


 > From: Bruce Korb <bkorb@cruzio.com>
 > 
 > > I get similar double or even triple digit
 > > percentage speedups for the other transformations I wrote.  Obviously
 > > your overall improvement depends on how much time you spend doing
 > > printf's suitable for optimization relative to other tasks, but that
 > > is true of any optimization.
 > 
 > Then why go part way?  Why not notice things like the
 > following?  I think there is a lot of room for improvement
 > here :-).
 > 
 > > write_units (...)
 > > {
 > >   int i, q_size;
 > > 
 > >   printf ("#define INSN_SCHEDULING\n\n");
 > >   printf ("extern int result_ready_cost PARAMS ((rtx));\n");
 > >   printf ("extern int function_units_used PARAMS ((rtx));\n\n");
 > >   printf ("extern struct function_unit_desc\n");
 > >   printf ("{\n");
 > >   printf ("  const char *name;\n");
 > >   printf ("  int bitmask;\n");
 > >   printf ("  int multiplicity;\n");
 > >   printf ("  int simultaneity;\n");
 > >   printf ("  int default_cost;\n");
 > >   printf ("  int max_issue_delay;\n");
 > >   printf ("  int (*ready_cost_function) PARAMS ((rtx));\n");
 > >   printf ("  int (*conflict_cost_function) PARAMS ((rtx, rtx));\n");
 > >   printf ("  int max_blockage;\n");
 > >   printf ("  unsigned int (*blockage_range_function) PARAMS ((rtx));\n");
 > >   printf ("  int (*blockage_function) PARAMS ((rtx, rtx));\n");
 > >   printf ("} function_units[];\n\n");
 > >   printf ("#define FUNCTION_UNITS_SIZE %d\n", num_units);
 > >   printf ("#define MIN_MULTIPLICITY %d\n", multiplicity->min);
 > >   printf ("#define MAX_MULTIPLICITY %d\n", multiplicity->max);
 > >   printf ("#define MIN_SIMULTANEITY %d\n", simultaneity->min);
 > >   printf ("#define MAX_SIMULTANEITY %d\n", simultaneity->max);
 > >   printf ("#define MIN_READY_COST %d\n", ready_cost->min);
 > >   printf ("#define MAX_READY_COST %d\n", ready_cost->max);
 > >   printf ("#define MIN_ISSUE_DELAY %d\n", issue_delay->min);
 > >   printf ("#define MAX_ISSUE_DELAY %d\n", issue_delay->max);
 > >   printf ("#define MIN_BLOCKAGE %d\n", blockage->min);
 > >   printf ("#define MAX_BLOCKAGE %d\n", blockage->max);
 > 
 > Combining arg-less printfs into one fputs ought not be too hard.
 > Not today, I suppose.  ;-)

Right, in the future. :-)

You can actually combine arg-full printfs by concatenating the format
specifiers and chaining the remaining arguments together.  However
analyzing multiple calls simultaneously wasn't even possible until
function-at-a-time mode was enabled in the C front end.  It only just
happened a week ago and I certainly haven't had time to study it yet
in the context of these opts.

Here's an article from Jan '99 which was my first draft "master plan".
(It does include concatenating similar *put* calls into one.  A
similar algorithm would work for printf.)

http://gcc.gnu.org/ml/gcc-patches/1999-01/msg00187.html
--
Kaveh R. Ghazi			Engagement Manager / Project Services
ghazi@caip.rutgers.edu		Qwest Internet Solutions

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