Commit Graph

60243 Commits

Author SHA1 Message Date
Mike Stump a35af82429 Fix typo.
llvm-svn: 72308
2009-05-23 02:02:29 +00:00
Ted Kremenek 20e2630877 Use 'Exprs.data()' instead of 'Exprs.empty() ? NULL : ...'
llvm-svn: 72304
2009-05-23 00:22:11 +00:00
Douglas Gregor 4a9f481db9 Template instantiation for qualified declaration reference
expressions. We are now missing template instantiation logic for only
three classes of expressions:
  - Blocks-related expressions (BlockExpr, BlockDeclRefExpr)
  - C++ default argument expressions
  - Objective-C expressions

Additionally, our handling of DeclRefExpr is still quite poor, since
it cannot handle references to many kinds of declarations.

As part of this change, converted the TemplateExprInstantiator to use
iteration through all of the expressions via clang/AST/StmtNodes.def,
ensuring that we don't forget to add template instantiation logic for
any new expression node kinds.

llvm-svn: 72303
2009-05-22 23:47:06 +00:00
Douglas Gregor 93fcf93bc6 Template instantiation for the GNU address-of-label extension.
llvm-svn: 72301
2009-05-22 23:25:52 +00:00
Evan Cheng a838a40bc4 Fix bug in FoldFCmp_IntToFP_Cst. If inttofp is a uintofp, use unsigned instead of signed integer constant.
llvm-svn: 72300
2009-05-22 23:10:53 +00:00
Douglas Gregor 36fe6901d4 Template instantiation for ExtVectorElementExpr.
llvm-svn: 72299
2009-05-22 23:07:44 +00:00
Argyrios Kyrtzidis 4a6dad68a3 Add a test case to make sure that an ambiguous paren expression is only parsed once.
llvm-svn: 72298
2009-05-22 23:05:39 +00:00
Douglas Gregor 5ce0f0eccf Fix the parent classes in TypeNodes.def, from Olaf Krzikalla
llvm-svn: 72293
2009-05-22 22:48:45 +00:00
Douglas Gregor 038c338949 Fix lots of PCH crashes caused by the new assertions in
llvm::SmallVector, using data() instead of &[0]. The PCH testsuite now
runs cleanly (again).

llvm-svn: 72292
2009-05-22 22:45:36 +00:00
Ted Kremenek 92f3d1ff1c Fix PCH crash caused by new assertions in llvm::SmallVector. Use
ProtoRefs.data() instead of &ProtoRefs[0] to access the raw buffer.

llvm-svn: 72291
2009-05-22 22:34:23 +00:00
Ted Kremenek ed28b6d028 Modify begin()/end() for AsmStmt iterators to handle the case when Exprs.empty()
is true. Because of recent changes to llvm::SmallVector, using these iterators
when Exprs was empty would cause an assertion failure.

This fixes: PR 4245.

llvm-svn: 72286
2009-05-22 22:03:22 +00:00
Dan Gohman 9069d890e8 Add a note mentioning that uses of the return value of an invoke
must be dominated by the normal label.

llvm-svn: 72285
2009-05-22 21:47:08 +00:00
Fariborz Jahanian 88fead8c48 Cannot type cast @selector expressions.
llvm-svn: 72284
2009-05-22 21:42:52 +00:00
Daniel Dunbar 0721c2c155 In assembler-with-cpp mode, don't error on '#' (stringize) operator applied to
non-argument names, pass the tokens through.

llvm-svn: 72283
2009-05-22 21:35:34 +00:00
Douglas Gregor efe7c393e1 Add a few tests to ensure that member functions of class templates can
call other member functions of class templates, including after
template instantiation. No functionality change.

llvm-svn: 72282
2009-05-22 21:26:58 +00:00
Douglas Gregor a8db954f24 Representation of and template instantiation for member
expressions. This change introduces another AST node,
CXXUnresolvedMemberExpr, that captures member references (x->m, x.m)
when the base of the expression (the "x") is type-dependent, and we
therefore cannot resolve the member reference yet.

Note that our parsing of member references for C++ is still quite
poor, e.g., we don't handle x->Base::m or x->operator int.

llvm-svn: 72281
2009-05-22 21:13:27 +00:00
Argyrios Kyrtzidis c996521508 Add -fblocks for the test.
llvm-svn: 72280
2009-05-22 21:10:04 +00:00
Argyrios Kyrtzidis f73f2d28a2 The disambiguation process for ambiguous paren expressions is not "side effects free", e.g:
(T(*)(int[x+y]));

is an (invalid) paren expression, but "x+y" will be parsed as part of the (rejected) type-id,
so unnecessary Action calls are made for an unused (and possibly leaked) "x+y".

Use a different scheme, similar to parsing inline methods. The parenthesized tokens are cached,
the context that follows is determined (possibly by parsing a cast-expression),
and then we re-introduce the cached tokens into the token stream and parse them appropriately.

llvm-svn: 72279
2009-05-22 21:09:47 +00:00
Argyrios Kyrtzidis 48ce3b553b The TokenLexer may encounter annotations if the parser enters them using Preprocessor::EnterTokenStream.
So check for annotation before using the Token's IdentifierInfo.

llvm-svn: 72278
2009-05-22 21:09:31 +00:00
Oscar Fuentes 770c8e7927 CMake: Use libpthread in tblgen when needed. Updated list of source
files for PIC16 target.

llvm-svn: 72277
2009-05-22 20:55:15 +00:00
Duncan Sands d6fb6501e3 Add a new codegen pass that normalizes dwarf exception handling
code in preparation for code generation.  The main thing it does
is handle the case when eh.exception calls (and, in a future
patch, eh.selector calls) are far away from landing pads.  Right
now in practice you only find eh.exception calls close to landing
pads: either in a landing pad (the common case) or in a landing
pad successor, due to loop passes shifting them about.  However
future exception handling improvements will result in calls far
from landing pads:
(1) Inlining of rewinds.  Consider the following case:
In function @f:
...
  invoke @g to label %normal unwind label %unwinds
...
unwinds:
  %ex = call i8* @llvm.eh.exception()
...

In function @g:
...
  invoke @something to label %continue unwind label %handler
...
handler:
  %ex = call i8* @llvm.eh.exception()
... perform cleanups ...
  "rethrow exception"

Now inline @g into @f.  Currently this is turned into:
In function @f:
...
  invoke @something to label %continue unwind label %handler
...
handler:
  %ex = call i8* @llvm.eh.exception()
... perform cleanups ...
  invoke "rethrow exception" to label %normal unwind label %unwinds
unwinds:
  %ex = call i8* @llvm.eh.exception()
...

However we would like to simplify invoke of "rethrow exception" into
a branch to the %unwinds label.  Then %unwinds is no longer a landing
pad, and the eh.exception call there is then far away from any landing
pads.

(2) Using the unwind instruction for cleanups.
It would be nice to have codegen handle the following case:
  invoke @something to label %continue unwind label %run_cleanups
...
handler:
... perform cleanups ...
  unwind

This requires turning "unwind" into a library call, which
necessarily takes a pointer to the exception as an argument
(this patch also does this unwind lowering).  But that means
you are using eh.exception again far from a landing pad.

(3) Bugpoint simplifications.  When bugpoint is simplifying
exception handling code it often generates eh.exception calls
far from a landing pad, which then causes codegen to assert.
Bugpoint then latches on to this assertion and loses sight
of the original problem.

Note that it is currently rare for this pass to actually do
anything.  And in fact it normally shouldn't do anything at
all given the code coming out of llvm-gcc!  But it does fire
a few times in the testsuite.  As far as I can see this is
almost always due to the LoopStrengthReduce codegen pass
introducing pointless loop preheader blocks which are landing
pads and only contain a branch to another block.  This other
block contains an eh.exception call.  So probably by tweaking
LoopStrengthReduce a bit this can be avoided.

llvm-svn: 72276
2009-05-22 20:36:31 +00:00
Fariborz Jahanian a4404f21d1 This patch adds support for sender-aware dispatch in Objective-C for the GNU runtime, when
compiled with -fobjc-sender-dependent-dispatch.  This is used in AOP, COP, implementing object 
planes, and a few other things.
Patch by David Chisnall.

llvm-svn: 72275
2009-05-22 20:17:16 +00:00
Fariborz Jahanian 162af638a9 Added -fblocks to the test's options.
llvm-svn: 72274
2009-05-22 20:06:10 +00:00
Mike Stump c63428b192 Fixup codegen for __block int i; i += rhs();. Should also slightly
improve codegen in some cases.

llvm-svn: 72273
2009-05-22 19:07:20 +00:00
Daniel Dunbar adeeb052ad Don't warn about -funit-at-a-time, and reject -fno-unit-at-a-time.
- We could just warn about -fno-unit-at-a-time, but in practice people using it
   probably aren't going to get what they want out of clang.

Also, use "clang" specified error for unsupported things instead of driver
unsupported error.

llvm-svn: 72272
2009-05-22 19:02:20 +00:00
Bob Wilson ccbc17b3a3 Only 64-bit targets support TImode libcalls. Disable the TImode shift libcalls
for ARM.  This fixes rdar://6908807.

llvm-svn: 72269
2009-05-22 17:38:41 +00:00
Daniel Dunbar 499f3f9c5d x86_64 ABI: Account for sret parameters consuming an integer register.
- PR4242.

llvm-svn: 72268
2009-05-22 17:33:44 +00:00
Fariborz Jahanian db3a4c1388 (Next runtime only) check to see if class implements forwardInvocation method
and objects of this class are derived from 'NSProxy'.
Under such conditions, which means that every method possible is 
implemented in the class, we should not issue "Method definition not found" 
warnings.

llvm-svn: 72267
2009-05-22 17:12:32 +00:00
Dan Gohman 781b75a7df Teach IndVarSimplify's FixUsesBeforeDefs to handle InvokeInsts by
assuming that the use of the value is in a block dominated by the
"normal" destination. LangRef.html and other documentation sources
don't explicitly guarantee this, but it seems to be assumed in
other places in LLVM at least.

This fixes an assertion failure on the included testcase, which
is derived from the Ada testsuite.

FixUsesBeforeDefs is a temporary measure which I'm looking to
replace with a more capable solution.

llvm-svn: 72266
2009-05-22 16:47:11 +00:00
Argyrios Kyrtzidis 24ad692f30 Some minor comments modifications.
There are no unnecessary action calls period (courtesy of the annotation scheme) and too many 'this means'..

llvm-svn: 72263
2009-05-22 15:12:46 +00:00
Sanjiv Gupta 43becc23c2 Emit debug information for globals (which include automatic variables as well because on PIC16 they are emitted as globals by the frontend).
llvm-svn: 72262
2009-05-22 13:58:45 +00:00
Sanjiv Gupta 47e296149e Targets like PIC16 generate Static decls for automatic variables, emit the appropriate debug descriptor as well in that case.
llvm-svn: 72261
2009-05-22 13:54:25 +00:00
Argyrios Kyrtzidis 12179bc014 Handle correctly a very ugly part of the C++ syntax. We cannot disambiguate between a parenthesized type-id and
a paren expression without considering the context past the parentheses.

Behold:
  (T())x;  - type-id
  (T())*x; - type-id
  (T())/x; - expression
  (T());   - expression

llvm-svn: 72260
2009-05-22 10:24:42 +00:00
Argyrios Kyrtzidis 5da1f08587 Factor the compound literal parsing out from ParseParenExpression and into a new ParseCompoundLiteralExpression.
No functionality change.

llvm-svn: 72259
2009-05-22 10:24:05 +00:00
Argyrios Kyrtzidis 9a9c0f4eff Modification to ParseParenExpression.
Now it parses the cast expression unless 'stopIfCastExpr' is true.

llvm-svn: 72258
2009-05-22 10:23:40 +00:00
Argyrios Kyrtzidis 387a334656 Remove ParseSimpleParenExpression.
Embed its functionality into it's only user, ParseCXXCasts.
CXXCasts now get the "actual" expression directly, they no longer always receive a ParenExpr. This is better since the
parentheses are always part of the C++ casts syntax.

llvm-svn: 72257
2009-05-22 10:23:16 +00:00
Argyrios Kyrtzidis 7bd98440b3 Refactor the common code of 'ParseTypeofSpecifier' and 'ParseSizeofAlignofExpression' into a new
'ParseExprAfterTypeofSizeofAlignof' method.

llvm-svn: 72256
2009-05-22 10:22:50 +00:00
Argyrios Kyrtzidis f5cc7ac4d5 Parse typeof-specifier the same way as sizeof/alignof are parsed.
-Makes typeof consistent with sizeof/alignof
-Fixes a bug when '>' is in a typeof expression, inside a template type param:
  A<typeof(x>1)> a;

llvm-svn: 72255
2009-05-22 10:22:18 +00:00
Duncan Sands dfc2e57137 Hopefully fix the build for people with ocaml.
llvm-svn: 72254
2009-05-22 09:22:17 +00:00
Duncan Sands e5e9f09c6d Always verify dominfo if expensive checking is enabled.
llvm-svn: 72253
2009-05-22 08:52:53 +00:00
Zhongxing Xu 5a187dd21e Pull EmitRecord() out of loop. It should be called only once.
llvm-svn: 72252
2009-05-22 08:38:27 +00:00
Torok Edwin 5b34933b90 Set correct calling convention even if there is a bitcast in the way.
This attempts to fix PR4239.

llvm-svn: 72251
2009-05-22 07:25:06 +00:00
Dan Gohman 88e06db116 Fix a thinko in the code that adapted SCEVMulExpr operands for
use in expanding SCEVAddExprs with GEPs. The operands of a
SCEVMulExpr need to be multiplied together, not added.

llvm-svn: 72250
2009-05-22 07:14:20 +00:00
Torok Edwin 9c4dcfb4a7 Revert this. There's no way to verifiy indirect calls, and an optimizer can turn
indirect call into direct call, thus the verifier would reject something it
previously accepted.

llvm-svn: 72249
2009-05-22 07:12:05 +00:00
Torok Edwin a39d69684a Verify that calling conventions match function prototype.
This only rejects mismatches between target specific calling convention
and C/LLVM specific calling convention.
There are too many fastcc/C, coldcc/cc42 mismatches in the testsuite, these are
not reject by the verifier.

llvm-svn: 72248
2009-05-22 06:41:43 +00:00
Eli Friedman 0cf811df82 Fix loop-index-split to correctly preserve dominance frontiers. Part of
PR4238.

llvm-svn: 72244
2009-05-22 03:22:46 +00:00
Daniel Dunbar 51c7f97bea (llvm up) Use llvm::Triple for storing target triples.
- This commit has some messy stuff in it to extend string lifetimes, but that
   will go away once we switch to using the enum'd Triple interfaces.

llvm-svn: 72243
2009-05-22 02:53:45 +00:00
Daniel Dunbar e3384c4f2e Add llvm::triple constructor from arch, vendor, os strings, and recognize
DragonFly OS type.

llvm-svn: 72242
2009-05-22 02:24:11 +00:00
Daniel Dunbar 5bbebfe9bc Don't rely on getArchName() to return a constant string reference.
llvm-svn: 72241
2009-05-22 02:21:04 +00:00
Eli Friedman 7942674be0 A few more tweaks for Solaris; please correct me if it's wrong somehow.
llvm-svn: 72240
2009-05-22 01:12:57 +00:00