Is there a way to get a list of functions that get inlined by dmd?
Trass3r
un at known.com
Tue Feb 9 07:12:56 PST 2010
Am 08.02.2010, 16:33 Uhr, schrieb Scorn <scorn at trash-mail.com>:
> Trass3r schrieb:
>> Would be interesting.
>
>
> Yes, this would be very interesting indeed. A list of the rules which
> dmd uses internally for inlining functions and methods would be really
> nice.
>
Well if I read the code correctly the following is not supported:
- nested inline?
- variadic functions (T t, ...)
- synchronized
- imported functions
- functions with closure vars
- virtual functions that aren't final
- functions with out, ref or static array parameters
- functions with more than 250 elementary expressions
Created my own little inline dumping patch:
Index: inline.c
===================================================================
--- inline.c (revision 363)
+++ inline.c (working copy)
@@ -1126,6 +1126,7 @@
if (fd && fd != iss->fd && fd->canInline(0))
{
e = fd->doInline(iss, NULL, arguments);
+ printf("Inlined function %s.\n", fd->toPrettyChars());
}
}
else if (e1->op == TOKdotvar)
@@ -1145,7 +1146,10 @@
;
}
else
- e = fd->doInline(iss, dve->e1, arguments);
+ {
+ e = fd->doInline(iss, dve->e1, arguments);
+ printf("Inlined method %s.\n", fd->toPrettyChars());
+ }
}
}
More information about the Digitalmars-d-learn
mailing list