Commit Graph

3177 Commits

Author SHA1 Message Date
Ted Kremenek 422d81dcd4 Fix bug in BasicStore::getLValueElement where if the base of an array subscript expression was an ElementRegion we stacked another ElementRegion on top of that.
This fixes PR 3422.

llvm-svn: 63110
2009-01-27 18:29:03 +00:00
Chris Lattner a3402cd524 add a new "getPreferredTypeAlign" method to return the preferred alignment
of a type.  The implementation is currently something of a hack, but is 
sufficient for now and allows clients to be built on it.

llvm-svn: 63108
2009-01-27 18:08:34 +00:00
Eli Friedman 3f66b84c86 Support CodeGen for __extension__ operator on aggregates.
llvm-svn: 63101
2009-01-27 09:03:41 +00:00
Eli Friedman eb3a9b03ab Fix for PR3418: make sure to handle the RHS of expressions starting with
__extension__.  This sort of construct shows up in the gcc source code.

llvm-svn: 63100
2009-01-27 08:43:38 +00:00
Chris Lattner f1ca7d3e02 Introduce a new PresumedLoc class to represent the concept of a location
as reported to the user and as manipulated by #line.  This is what __FILE__,
__INCLUDE_LEVEL__, diagnostics and other things should follow (but not 
dependency generation!).  

This patch also includes several cleanups along the way: 

- SourceLocation now has a dump method, and several other places 
  that did similar things now use it.
- I cleaned up some code in AnalysisConsumer, but it should probably be
  simplified further now that NamedDecl is better.
- TextDiagnosticPrinter is now simplified and cleaned up a bit.

This patch is a prerequisite for #line, but does not actually provide 
any #line functionality.

llvm-svn: 63098
2009-01-27 07:57:44 +00:00
Chris Lattner c360bf2e48 rename getFullFilePos -> getFileOffset.
llvm-svn: 63097
2009-01-27 06:27:13 +00:00
Chris Lattner bf648a3a63 Fix a bug that I noticed by inspection.
llvm-svn: 63094
2009-01-27 05:34:03 +00:00
Chris Lattner 6d61c3e6df make -print-stats print stats about the amount of the SLoc
address space we used up.  Some interesting data:

For c99-intconst-1.c:
6912762 SLocEntry's allocated, 25592386B of Sloc address space used.

For cocoa.h:
26469 SLocEntry's allocated, 10278752B of Sloc address space used.

For carbon.h:
27364 SLocEntry's allocated, 12398141B of Sloc address space used.

Clearly 2G of sloc address space should be enough for anyone?!

llvm-svn: 63093
2009-01-27 05:22:43 +00:00
Chris Lattner 8d3f4a4b2f improvements for GNU objc runtime support, patch by David Chisnall!
llvm-svn: 63092
2009-01-27 05:06:01 +00:00
Daniel Dunbar d678d3d970 x86_64: Classify __m64 and __m128 "correctly".
- gcc appears to be classifying <1 x double> as INTEGER which is
   odd. Will investigate later.

llvm-svn: 63086
2009-01-27 02:01:34 +00:00
Chris Lattner 9b415d6142 add SparcV8 asm register info support. Patch by Ben Lickly!
llvm-svn: 63085
2009-01-27 01:58:38 +00:00
Ted Kremenek a3f462e49a PathDiagnostics:
- Add the distinction between the 'bug type' and the 'bug description'

HTMLDiagnostics:
- Output the bug type field as HTML comments

scan-build:
- Use the bug type field instead of the bug description for the HTML table.
- Radar filing now automatically picks up the bug description in the title (addresses <rdar://problem/6265970>)

llvm-svn: 63084
2009-01-27 01:53:39 +00:00
Daniel Dunbar 0f4aa3cbb1 Implement support for coercion to wider types during ABI handling.
- Code quality is poor, but simple.

llvm-svn: 63083
2009-01-27 01:36:03 +00:00
Ted Kremenek 8d178f4357 PTH: Use Token::setLiteralData() to directly store a pointer to cached spelling data in the PTH file. This removes a ton of code for looking up spellings using sourcelocations in the PTH file. This simplifies both PTH-generation and reading.
Performance impact for -fsyntax-only on Cocoa.h (with Cocoa.h in the PTH file):
- PTH generation time improves by 5%
- PTH reading improves by 0.3%.

llvm-svn: 63072
2009-01-27 00:01:05 +00:00
Fariborz Jahanian d0e8e85afc Added a FIXME.
llvm-svn: 63071
2009-01-26 23:49:05 +00:00
Daniel Dunbar fd346a3644 Pull EmitReturnBlock out of FinishFunction and catch unified return
case correctly.

llvm-svn: 63068
2009-01-26 23:27:52 +00:00
Fariborz Jahanian 2612e149ef Build method-description-list for category meta-data
as well (for nonfragile-abi).

llvm-svn: 63062
2009-01-26 22:58:07 +00:00
Douglas Gregor f829825d04 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.

llvm-svn: 63061
2009-01-26 22:44:13 +00:00
Chris Lattner 9240b3eccb rename getSpelledCharacterAt to getSpellingOfSingleCharacterNumericConstant,
optimize it to use the LiteralData when possible.

llvm-svn: 63060
2009-01-26 22:36:52 +00:00
Chris Lattner d381721810 Fix a bug I introduced in my changes, which caused MeasureTokenLength
to crash when given an instantiation location.  Thanks to Fariborz for
the testcase.

llvm-svn: 63057
2009-01-26 22:24:27 +00:00
Sebastian Redl b44ab5f25d Add support for member pointers to const_cast.
llvm-svn: 63055
2009-01-26 22:19:12 +00:00
Ted Kremenek 327d00cd45 Silence warning.
llvm-svn: 63054
2009-01-26 22:16:12 +00:00
Ted Kremenek 978b5becea Add version number checking to PTH files.
llvm-svn: 63047
2009-01-26 21:50:21 +00:00
Ted Kremenek eb8c8fbd63 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.
llvm-svn: 63045
2009-01-26 21:43:14 +00:00
Fariborz Jahanian 99113fd577 Method decription meta-data and its setting in class_ro_t
meta-data.

llvm-svn: 63043
2009-01-26 21:38:32 +00:00
Daniel Dunbar 94a6f25738 Add Ignore ABIArgInfo kind, for handling void & empty structures.
llvm-svn: 63039
2009-01-26 21:26:08 +00:00
Daniel Dunbar 336dbba387 Skip emission of final return block if possible (e.g., functions with
a unified return).

llvm-svn: 63038
2009-01-26 21:25:20 +00:00
Chris Lattner 357b57d749 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.

llvm-svn: 63036
2009-01-26 20:24:53 +00:00
Chris Lattner 7e20927756 allow _Pragmas formed from #defines to keep their full instantiation
history

llvm-svn: 63035
2009-01-26 20:15:46 +00:00
Chris Lattner 2d86c700bf 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.

llvm-svn: 63034
2009-01-26 20:08:26 +00:00
Chris Lattner 659ac5f087 make getInstantiationLoc and getSpellingLoc handle multiply instantiated
locations, and move the slow case out of line.  No perf change on cocoa.h

llvm-svn: 63033
2009-01-26 20:04:19 +00:00
Sebastian Redl a7bc8473a3 Remove an implemented FIXME and extend test cases. Follow-up on Doug's review.
llvm-svn: 63032
2009-01-26 19:54:48 +00:00
Sebastian Redl 54cb4c88e1 Correct size assumption; fixes a crash on amd64.
llvm-svn: 63031
2009-01-26 19:54:12 +00:00
Chris Lattner 31af4e08d1 fix a negated conditional in getDecomposedInstantiationLocSlowCase,
which I think is rdar://6527005, and make getDecomposedSpellingLocSlowCase
handle nested spelling locations.

llvm-svn: 63030
2009-01-26 19:41:58 +00:00
Chris Lattner 5a7971e0c3 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.

llvm-svn: 63028
2009-01-26 19:29:26 +00:00
Fariborz Jahanian 0c8d060715 Meta-data for nonfragile-abi's categories
llvm-svn: 63020
2009-01-26 18:32:24 +00:00
Daniel Dunbar 02fe821021 Comment fix.
llvm-svn: 63016
2009-01-26 18:02:34 +00:00
Chris Lattner b5fba6f8d8 start plumbing together the line table information. So far we just
unique the Filenames in #line directives, assigning them UIDs.

llvm-svn: 63010
2009-01-26 07:57:50 +00:00
Chris Lattner 43a85b1e4c Lazily paging in file contents is a big win for PTH, strip out the old
testing code.

llvm-svn: 63006
2009-01-26 07:37:49 +00:00
Chris Lattner 76e689636b add parsing and constraint enforcement for GNU line marker directives.
llvm-svn: 63003
2009-01-26 06:19:46 +00:00
Ted Kremenek e9193283c6 Use tag classes instead of typedefs for GDM entries 'ConstNotEq' and 'ConstEq'. This avoids collisions in the GDM.
llvm-svn: 63002
2009-01-26 06:04:53 +00:00
Chris Lattner 38d7fd252a a few minor cleanups
llvm-svn: 63000
2009-01-26 05:30:54 +00:00
Chris Lattner 100c65e810 parse and enforce required constraints on #line directives. Right now
we just discard them.

llvm-svn: 62999
2009-01-26 05:29:08 +00:00
Chris Lattner ad13cf4e7a 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.

llvm-svn: 62994
2009-01-26 04:33:10 +00:00
Chris Lattner 5a5d67101b 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.

llvm-svn: 62993
2009-01-26 04:06:48 +00:00
Chris Lattner dd9babc79a 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.

llvm-svn: 62992
2009-01-26 03:46:22 +00:00
Eli Friedman 16c88df1a0 PR3269: create an empty InitListExpr as a child for the
CompoundLiteralExpr so that there aren't any null pointers in the AST.

llvm-svn: 62981
2009-01-26 01:33:06 +00:00
Chris Lattner 4fa23625ab Check in the long promised SourceLocation rewrite. This lays the
ground work for implementing #line, and fixes the "out of macro ID's" 
problem.

There is nothing particularly tricky about the code, other than the
very performance sensitive SourceManager::getFileID() method.

llvm-svn: 62978
2009-01-26 00:43:02 +00:00
Sebastian Redl 72b597d6b6 Implement implicit conversions for pointers-to-member.
llvm-svn: 62971
2009-01-25 19:43:20 +00:00
Sebastian Redl 8b2540439f Introduce an explicit case for member pointers in CodeGenTypes. However, it simply asserts.
llvm-svn: 62960
2009-01-25 13:35:30 +00:00