Douglas Gregor [Mon, 26 Jan 2009 22:44:13 +0000 (22:44 +0000)]
Some micro-optimizations for DISABLE_SMART_POINTERS:
- When it's safe, ActionResult uses the low bit of the pointer for
the "invalid" flag rather than a separate "bool" value. This keeps
GCC from generating some truly awful code, for a > 3x speedup in the
result-passing microbenchmark.
- When DISABLE_SMART_POINTERS is defined, store an ActionResult
within ASTOwningResult rather than an ASTOwningPtr. Brings the
performance benefits of the above to smart pointers with
DISABLE_SMART_POINTERS defined.
Sadly, these micro-benchmark performance improvements don't seem to
make much of a difference on Cocoa.h right now. However, they're
harmless and might help with future optimizations.
Chris Lattner [Mon, 26 Jan 2009 22:24:27 +0000 (22:24 +0000)]
Fix a bug I introduced in my changes, which caused MeasureTokenLength
to crash when given an instantiation location. Thanks to Fariborz for
the testcase.
Ted Kremenek [Mon, 26 Jan 2009 21:43:14 +0000 (21:43 +0000)]
Embed the offset of the PTH table inside the prologue of the PTH file. This will help improve gradual versioning of PTH files instead of relying that the PTH table is at a fixed offset.
Chris Lattner [Mon, 26 Jan 2009 20:24:53 +0000 (20:24 +0000)]
remove my hacks that aggressively threw away multiple
instantiation history in an effort to speed up c99-intconst-1.c.
Now that multiple nested instantiations are allowed, we just
make them and don't pay the cost of lookups. With the other
changes that went in before this, reverting this is actually
a speedup for c99-intconst-1.c, speeding it up from 1.96s to 1.80s,
and preserves much better loc info.
Chris Lattner [Mon, 26 Jan 2009 20:08:26 +0000 (20:08 +0000)]
now that everything properly handles multiply instantiated
source locations, allow creation of them. We can now say that
a token was instantiated here, then here, then here.
Chris Lattner [Mon, 26 Jan 2009 19:41:58 +0000 (19:41 +0000)]
fix a negated conditional in getDecomposedInstantiationLocSlowCase,
which I think is rdar://6527005, and make getDecomposedSpellingLocSlowCase
handle nested spelling locations.
Chris Lattner [Mon, 26 Jan 2009 19:29:26 +0000 (19:29 +0000)]
This change refactors some of the low-level lexer interfaces a bit.
Token now has a class of kinds for "literals", which include
numeric constants, strings, etc. These tokens can optionally have
a pointer to the start of the token in the lexer buffer. This
makes it faster to get spelling and do other gymnastics, because we
don't have to go through source locations.
This change is performance neutral, but will make other changes
more feasible down the road.
Chris Lattner [Mon, 26 Jan 2009 06:49:09 +0000 (06:49 +0000)]
Bitmangle file characteristic bits into the low bits of
the content cache pointer. This saves 105876 bytes on
cocoa.h because it shrinks the SLocEntry union, which
we have a big array of. It would be nice to use
PointerIntPair here, but we can't because it is in a
union.
Chris Lattner [Mon, 26 Jan 2009 04:33:10 +0000 (04:33 +0000)]
eagerly resolve the spelling locations of macro argument preexpansions.
This reduces fsyntax-only time on c99-intconst-1.c from 2.43s down to
2.01s (20%), reducing the number of fileid lookups from 2529040 linear
and 64771121 binary to 5625902 linear and 4151182 binary.
This knocks getFileID down to only 4.6% of compile time on this testcase.
At this point, malloc/free is over 35% of compile time, primarily allocating
MacroArgs objects and their argument preexpansion vectors.
I don't feel like malloc avoiding right now, so I'm just going to call
this good.
Chris Lattner [Mon, 26 Jan 2009 04:06:48 +0000 (04:06 +0000)]
Eagerly resolve the spelling location of the tokens in a definition
of a macro. Since these tokens may themselves be from macro
expansions, we need to resolve down to the spelling loc when the
macro ends up being instantiated. Instead of resolving this for
each token expanded from the macro definition, just do it once when
the macro is defined. This speeds up clang on c99-intconst-1.c from
2.66s to 2.43s (9.5%), reducing the FileID lookups from 407244 linear and 114175649 binary to 2529040 linear and 64771121 binary.
Chris Lattner [Mon, 26 Jan 2009 03:46:22 +0000 (03:46 +0000)]
Only resolve a macro's instantiation loc once per macro, instead of once
per token lexed from it. This speeds up clang on c99-intconst-1.c from
the GCC testsuite from 3.64s to 2.66s (36%). This reduces the number of
binary search FileID lookups from 251570522 to 114175649 on this testcase.
Eli Friedman [Sun, 25 Jan 2009 02:32:41 +0000 (02:32 +0000)]
Rename Expr::isConstantExpr to Expr::isConstantInitializer; this more
accurately states what the function is trying to do and how it is
different from Expr::isEvaluatable. Also get rid of a parameter that is both
unused and inaccurate.
Eli Friedman [Sun, 25 Jan 2009 01:54:01 +0000 (01:54 +0000)]
Make the constant folder aware of
__builtin___CFStringMakeConstantString. (We get into trouble in
GenerateStaticBlockVarDecl if the constant folder isn't accurate.)
Eli Friedman [Sat, 24 Jan 2009 23:09:00 +0000 (23:09 +0000)]
PR3062: statement expressions should be illegal at file scope. I don't
think this has any significant effects at the moment, but it could
matter if we start constant-folding statement expressions like gcc does.
Chris Lattner [Sat, 24 Jan 2009 21:53:27 +0000 (21:53 +0000)]
add initial support for the gcc "alignof(decl) is the alignment of the decl
not the type" semantics. This can definitely be improved, but is better than
what we had.
Ted Kremenek [Sat, 24 Jan 2009 00:55:43 +0000 (00:55 +0000)]
More hacking on static analyzer diagnostics. When emitting summary diagnostics the code paths for diagnostics involving paths or single locations are now unified. This patch also constifies many arguments/methods that are touched by this logic, leading to a nice overall code cleanup.
Ted Kremenek [Fri, 23 Jan 2009 20:52:26 +0000 (20:52 +0000)]
Added clang option '--analyzer-display-progress' to indicate that the analyzer should output 'ANALYZE:' messages to display its progress on a source file.
Ted Kremenek [Fri, 23 Jan 2009 20:28:53 +0000 (20:28 +0000)]
Added virtual method DiagnosticClient::IncludeInDiagnosticCounts(). This is used by Diagnostics to determine if a diagnostic sent to a given DiagnosticClient should be included in the count of diagnostics. The default implementation of this method returns 'true'.
Implemented DiagCollector::IncludeInDiagnosticCounts() to return 'false' so that the batching of diagnostics for use with BugReporter doesn't mess up the count of real diagnostics.
Daniel Dunbar [Fri, 23 Jan 2009 20:08:16 +0000 (20:08 +0000)]
ccc: Finish definition of long argument translations.
- However, these last ones do not actually work; the issue is that
they translate to batches of options and need to be reparsed. For
now we just give an unsupported error on them.
Daniel Dunbar [Fri, 23 Jan 2009 18:51:09 +0000 (18:51 +0000)]
Handle pointer arithmetic on function pointers.
- <rdar://problem/6518844> Clang-generated bitcode crashes LLVM while compiling function pointer addition expression
Chris Lattner [Fri, 23 Jan 2009 18:35:48 +0000 (18:35 +0000)]
This is a follow-up to r62675:
Refactor how the preprocessor changes a token from being an tok::identifier to a
keyword (e.g. tok::kw_for). Instead of doing this in HandleIdentifier, hoist this
common case out into the caller, so that every keyword doesn't have to go through
HandleIdentifier. This drops time in HandleIdentifier from 1.25ms to .62ms, and
speeds up clang -Eonly with PTH by about 1%.