[PATCH] Pull Lexer's CharInfo table out for general use throughout Clang

Richard Smith richard at metafoo.co.uk
Wed Feb 6 20:45:00 PST 2013


On Wed, Feb 6, 2013 at 9:07 AM, Jordan Rose <jordan_rose at apple.com> wrote:

>
>
> ================
> Comment at: include/clang/Basic/CharInfo.h:29
> @@ +28,3 @@
> +/// Returns true if this is an ASCII character.
> +LLVM_ATTRIBUTE_ALWAYS_INLINE
> +static inline bool isASCII(char c) {
> ----------------
> Richard Smith wrote:
> > Do these attributes make a measurable difference? 'static inline' is
> already a pretty big hint to inline, especially for a single-call-site
> function.
> I didn't measure it at all; I just figured it wouldn't hurt and would keep
> people from directly accessing InfoTable unless they //really// needed it.
> I can easily take them out again.


Well, it might hurt if we're force-inlining cold functions into hot
functions; this might prevent some important part of the lexer from getting
inlined appropriately. Generally, I think that ALWAYS_INLINE should only be
added if we have some reason to think the inliner would otherwise do the
wrong thing and we would get worse code -- and even in that case, we should
look at whether we can fix the optimizer before adding such a hint.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130206/1e475f4f/attachment.html>


More information about the cfe-commits mailing list