[PATCH] Speedup lookup_constraint for 2-letter constraints
Richard Biener
rguenther@suse.de
Tue Feb 19 15:08:00 GMT 2013
This speeds up lookup_constraint by allowing the generic folding
for n == 1 strncmp calls to trigger, handling two-letter constraints
by two char comparisons instead of one and a call to strncmp (which
ends up not being inlined because it's considered cold ...).
Bootstrap & regtest pending on x86_64-unknown-linux-gnu.
Ok?
Thanks,
Richard.
2013-02-19 Richard Biener <rguenther@suse.de>
* genpreds.c (write_lookup_constraint): Do not compare first
letter of the constraint again.
Index: gcc/genpreds.c
===================================================================
--- gcc/genpreds.c (revision 196134)
+++ gcc/genpreds.c (working copy)
@@ -945,9 +945,10 @@ write_lookup_constraint (void)
{
do
{
- printf (" if (!strncmp (str, \"%s\", %lu))\n"
+ printf (" if (!strncmp (str + 1, \"%s\", %lu))\n"
" return CONSTRAINT_%s;\n",
- c->name, (unsigned long int) c->namelen, c->c_name);
+ c->name + 1, (unsigned long int) c->namelen - 1,
+ c->c_name);
c = c->next_this_letter;
}
while (c);
More information about the Gcc-patches
mailing list