Commit Graph

5420 Commits

Author SHA1 Message Date
Eli Friedman 27ef75b0be Handle an edge case involving the conditional operator and throw expressions. PR10582.
llvm-svn: 142047
2011-10-15 02:10:40 +00:00
Anton Korobeynikov f0c267e6e0 Provide half floating point support as a storage only type.
Lack of half FP was a regression compared to llvm-gcc.

llvm-svn: 142016
2011-10-14 23:23:15 +00:00
Eli Friedman 4b72fddd99 Misc fixes for atomics. Biggest fix is doing alignment correctly for _Atomic types.
llvm-svn: 142002
2011-10-14 20:59:01 +00:00
Benjamin Kramer 47b5b31e61 Simplify code to avoid a useless string copy.
llvm-svn: 141970
2011-10-14 18:45:16 +00:00
Benjamin Kramer fd0b05f341 Upgrade to PathV2.
llvm-svn: 141969
2011-10-14 18:45:11 +00:00
Benjamin Kramer 13481e27cb Add parens to pacify GCC.
llvm-svn: 141968
2011-10-14 18:45:06 +00:00
Eli Friedman fde961dbf3 PR11124: Don't overwrite memory outside of a base class when performing zero-initialization before running its constructor.
llvm-svn: 141933
2011-10-14 02:27:24 +00:00
Eric Christopher 7cdf948601 Recommit:
Start handling debug line and scope information better:

    Migrate most of the location setting within the larger API in CGDebugInfo and
    update a lot of callers.
    Remove the existing file/scope change machinery in UpdateLineDirectiveRegion
    and replace it with DILexicalBlockFile usage.

    Finishes off the rest of rdar://10246360

after fixing a few bugs that were exposed in gdb testsuite testing.

llvm-svn: 141893
2011-10-13 21:45:18 +00:00
Peter Collingbourne adcf7c9203 TCE target: conversion of OpenCL reqd_work_group_size attr to metadata
Patch by Pekka Jääskeläinen!

llvm-svn: 141865
2011-10-13 16:24:41 +00:00
Rafael Espindola 2d21ab024e Add returns_twice to functions that are known to return twice. This implements
the same behavior of gcc by keeping the attribute out of the function type.

llvm-svn: 141803
2011-10-12 19:51:18 +00:00
Eric Christopher 93663b3c62 Revert file/scope handling patches. gdb testing revealed a couple of bugs.
llvm-svn: 141796
2011-10-12 18:39:35 +00:00
Jim Goodnow II 5a793d3762 Removed extra line in comment.
llvm-svn: 141773
2011-10-12 09:55:01 +00:00
Eric Christopher 663b7f353e Remember to set the location in EmitGlobalVariable to the current decl
if we're going to delete the setLocation as we did in 141732.

llvm-svn: 141762
2011-10-12 01:11:30 +00:00
Eric Christopher 498b7fd7fe Start handling debug line and scope information better:
Migrate most of the location setting within the larger API in CGDebugInfo and
update a lot of callers.
Remove the existing file/scope change machinery in UpdateLineDirectiveRegion
and replace it with DILexicalBlockFile usage.

Finishes off the rest of rdar://10246360

llvm-svn: 141732
2011-10-11 23:00:55 +00:00
Eric Christopher fefafacf68 80-column and tab cleanup.
llvm-svn: 141731
2011-10-11 23:00:51 +00:00
Eric Christopher fb4cd4082c Reorder this to make it easier to add more changes for a location set.
llvm-svn: 141730
2011-10-11 23:00:45 +00:00
Eli Friedman c2025567f5 Silence some -Wuninitialized false positives with gcc.
llvm-svn: 141701
2011-10-11 20:00:47 +00:00
Eli Friedman df14b3a837 Initial implementation of __atomic_* (everything except __atomic_is_lock_free).
llvm-svn: 141632
2011-10-11 02:20:01 +00:00
Richard Smith caf3390d44 Constant expression evaluation refactoring:
- Remodel Expr::EvaluateAsInt to behave like the other EvaluateAs* functions,
   and add Expr::EvaluateKnownConstInt to capture the current fold-or-assert
   behaviour.
 - Factor out evaluation of bitfield bit widths.
 - Fix a few places which would evaluate an expression twice: once to determine
   whether it is a constant expression, then again to get the value.

llvm-svn: 141561
2011-10-10 18:28:20 +00:00
David Chisnall e0dc7cb2e2 Apparently getPtrToInt() takes an explicit type parameter to allow you to generate invalid bitcode, not so that it can actually produce a value of this type. This should fix PR11085.
llvm-svn: 141482
2011-10-08 08:54:36 +00:00
Ted Kremenek c168e50722 Free 'TheTargetCodeGenInfo' in the class CodeGenModule. This looks like an obvious memory leak that was reported from LLDB devs. The comment indicates the leak is deliberate, but I have no idea why this needs to be so. Please comment/revert if you know otherwise.
llvm-svn: 141479
2011-10-08 05:28:26 +00:00
Eli Friedman 235266700a Fix warning on MSVC. Patch by Aaron Ballman.
llvm-svn: 141467
2011-10-08 01:03:47 +00:00
John McCall f937c023bf Rename TagDecl::isDefinition -> isCompleteDefinition
for better self-documenting code, since the semantics
are subtly different from getDefinition().

llvm-svn: 141355
2011-10-07 06:10:15 +00:00
John McCall 0710e551ef Record layout requires not just a definition, but a complete
definition.  Assert this.  Change IR generation to not try to
aggressively emit the IR translation of a record during its
own definition.  Fixes PR10912.

llvm-svn: 141350
2011-10-07 02:39:22 +00:00
Eli Friedman c8b57f6683 llvm.memory.barrier is going away; remove the wrapper intrinsic __builtin_llvm_memory_barrier.
__atomic_thread_fence will be landing soon as a replacement, wrapping around the new fence instruction.

llvm-svn: 141332
2011-10-06 23:12:03 +00:00
Eli Friedman 0dfb889575 Support for C1x _Atomic specifier (see testcase). This is primarily being committed at the moment to help support C++0x <atomic>, but it should be a solid base for implementing the full specification of C1x _Atomic.
Thanks to Jeffrey Yasskin for the thorough review!

llvm-svn: 141330
2011-10-06 23:00:33 +00:00
Peter Collingbourne fa4d6033a3 CUDA: IR generation support for device stubs
llvm-svn: 141304
2011-10-06 18:51:56 +00:00
Peter Collingbourne a9455ec9f8 CUDA: add -fcuda-is-device flag
This frontend-only flag is used by the IR generator to determine
whether to filter CUDA declarations for the host or for the device.

llvm-svn: 141301
2011-10-06 18:29:46 +00:00
Peter Collingbourne fe88342240 CUDA: IR generation support for kernel call expressions
llvm-svn: 141300
2011-10-06 18:29:37 +00:00
Peter Collingbourne 5bad4afa2f CUDA: set proper calling conventions for PTX
llvm-svn: 141296
2011-10-06 16:49:54 +00:00
Eric Christopher fab289a47d When constructing debug information for synthesized variables for the
non-fragile ABI we may not be able to lay out the type and the debugger
would ignore us even if we did put in the offset. Go ahead and just
put any value there and don't look up the offset since it may not exist.

rdar://10210157

llvm-svn: 141261
2011-10-06 00:31:18 +00:00
Eric Christopher 8c552308c6 Reformat comment.
llvm-svn: 141260
2011-10-06 00:30:52 +00:00
Justin Holewinski 38031978b5 PTX: Set proper calling conventions for PTX in OpenCL mode.
llvm-svn: 141193
2011-10-05 17:58:44 +00:00
David Chisnall cdd207e43e Add bitmaps for strong / weak ivar layout (GNUstep runtime).
llvm-svn: 141085
2011-10-04 15:35:30 +00:00
John McCall ff61303bd0 Mark calls to objc_retainBlock that don't result from casts
to id so that we can still optimize them appropriately.

llvm-svn: 141064
2011-10-04 06:23:45 +00:00
Rafael Espindola 70107f989c Propagate __attribute__((returns_twice)) from C to IL.
llvm-svn: 141002
2011-10-03 14:59:42 +00:00
Argyrios Kyrtzidis b8c3aaf479 Allow getting all source locations of selector identifiers in a ObjCMethodDecl.
Instead of always storing all source locations for the selector identifiers
we check whether all the identifiers are in a "standard" position; "standard" position is

  -Immediately before the arguments: -(id)first:(int)x second:(int)y;
  -With a space between the arguments: -(id)first: (int)x second: (int)y;
  -For nullary selectors, immediately before ';': -(void)release;

In such cases we infer the locations instead of storing them.

llvm-svn: 140989
2011-10-03 06:37:04 +00:00
Argyrios Kyrtzidis dfd6570643 Pass from the parser the locations of selector identifiers when creating
objc method decls.

They are not stored in the AST yet.

llvm-svn: 140984
2011-10-03 06:36:36 +00:00
John McCall 9b0a7cea0f Make -fobjc-nonfragile-abi the -cc1 default, since it's the
increasingly prevailing case to the point that new features
like ARC don't even support the fragile ABI anymore.

This required a little bit of reshuffling with exceptions
because a check was assuming that ObjCNonFragileABI was
only being set in ObjC mode, and that's actually a bit
obnoxious to do.

Most, though, it involved a perl script to translate a ton
of test cases.

Mostly no functionality change for driver users, although
there are corner cases with disabling language-specific
exceptions that we should handle more correctly now.

llvm-svn: 140957
2011-10-02 01:16:38 +00:00
John McCall 248512a573 When performing an @throw in ARC, retain + autorelease
the pointer, being sure to do so before running cleanups
associated with that full-expression.  rdar://10042689

llvm-svn: 140945
2011-10-01 10:32:24 +00:00
Fariborz Jahanian 0c78427d50 objc gc: assigning to an objc object struct member through an ivar
pointer to this struct must go through the none ivar writer barrier.

llvm-svn: 140867
2011-09-30 18:23:36 +00:00
Eli Friedman 1b87b29bfd Minor cleanup.
llvm-svn: 140866
2011-09-30 18:19:16 +00:00
Eric Christopher 2f45aaa755 Change "Regions" to be "LexicalBlocks" since that's what they
correspond to.

llvm-svn: 140740
2011-09-29 00:00:45 +00:00
Eric Christopher bfa4dc5512 Rename EmitStopPoint in CGDebugInfo to EmitLocation. "stop points" don't
exist anymore.

llvm-svn: 140739
2011-09-29 00:00:41 +00:00
Eric Christopher 4fd315ffbd Reorder functions in the file.
llvm-svn: 140738
2011-09-29 00:00:37 +00:00
Eric Christopher e655657c94 Call UpdateLineDirectiveRegion every time we want to emit a stop
point in the code. Ensures that we don't miss any places and the
check is reasonably cheap.

llvm-svn: 140737
2011-09-29 00:00:35 +00:00
Eric Christopher 250511bc75 Update comment.
llvm-svn: 140736
2011-09-29 00:00:31 +00:00
Benjamin Kramer 76399eb2ad de-tmpify clang.
llvm-svn: 140637
2011-09-27 21:06:10 +00:00
Eric Christopher 9c13eeac99 Update comments.
llvm-svn: 140531
2011-09-26 15:03:22 +00:00
Eric Christopher 22e157009c Fix comment to reflect reality.
llvm-svn: 140530
2011-09-26 15:03:19 +00:00
Peter Collingbourne cfd2356180 Move VTable builder to AST
llvm-svn: 140510
2011-09-26 01:57:12 +00:00
Peter Collingbourne 1c593c6a38 Have CodeGenVTables::GenerateConstructionVTable use VTableLayout
llvm-svn: 140509
2011-09-26 01:57:04 +00:00
Peter Collingbourne 085095f1ac Move vtable dumper call to VTableBuilder ctor
llvm-svn: 140508
2011-09-26 01:57:00 +00:00
Peter Collingbourne 3b118abd93 Implement VTableContext::createConstructionVTableLayout
llvm-svn: 140507
2011-09-26 01:56:55 +00:00
Peter Collingbourne affe111ba5 Move all vtable layout data into new VTableLayout class
llvm-svn: 140506
2011-09-26 01:56:50 +00:00
Peter Collingbourne cd3c3f4f3d Move VTableComponent to header file
llvm-svn: 140505
2011-09-26 01:56:45 +00:00
Peter Collingbourne 5ee9ee490e Move vtable component accessors to VTableContext
llvm-svn: 140504
2011-09-26 01:56:41 +00:00
Peter Collingbourne 71c26936a0 Remove CodeGenVTables::ComputeVTableRelatedInformation dependency on CodeGen
llvm-svn: 140503
2011-09-26 01:56:36 +00:00
Peter Collingbourne a834166e48 Create a VTableContext class and start moving CodeGenVTables methods to it
llvm-svn: 140502
2011-09-26 01:56:30 +00:00
Peter Collingbourne 2d2595235d Move VTT builder to AST
llvm-svn: 140501
2011-09-26 01:56:24 +00:00
Peter Collingbourne 66c3a83e09 Move BaseSubobject class to AST
llvm-svn: 140500
2011-09-26 01:56:16 +00:00
Peter Collingbourne 2000e4ead5 Remove CodeGenModule field from VTTBuilder
llvm-svn: 140499
2011-09-26 01:56:10 +00:00
Peter Collingbourne d9eb79ca73 Make the VTTBuilder class independent of LLVM core
llvm-svn: 140498
2011-09-26 01:56:06 +00:00
David Blaikie 9c902b5502 Rename Diagnostic to DiagnosticsEngine as per issue 5397
llvm-svn: 140478
2011-09-25 23:23:43 +00:00
Sebastian Redl 12757ab4cb Treat list-initialization of scalars as a first-class citizen in C++11.
Allow empty initializer lists for scalars, which mean value-initialization.
Constant evaluation for single-element and empty initializer lists for scalars.
Codegen for empty initializer lists for scalars.
Test case comes in next commit.

llvm-svn: 140459
2011-09-24 17:48:14 +00:00
David Blaikie aa347f9392 Removing a bunch of dead returns/breaks after llvm_unreachables.
llvm-svn: 140407
2011-09-23 20:26:49 +00:00
David Blaikie 83d382b1ca Switch assert(0/false) llvm_unreachable.
llvm-svn: 140367
2011-09-23 05:06:16 +00:00
Bill Wendling 8c4b716352 Don't remove filters.
It's not valid to remove filters from landingpad instructions, even if we catch
the type. The metadata won't be set up correctly.

Testcase is projects/llvm-test/SingleSource/UnitTests/EH/filter-2.cpp.

llvm-svn: 140335
2011-09-22 20:32:54 +00:00
Douglas Gregor eb4089ad01 Only trigger the initialize-an-array-via-elementwise-copy/move code
generation when we're dealing with an implicitly-defined copy or move
constructor. And, actually set the implicitly-defined bit for
implicitly-defined constructors and destructors. Should fix self-host.

llvm-svn: 140334
2011-09-22 20:32:43 +00:00
Douglas Gregor 8a556ce512 Explicitly-defaulted copy/move constructors are not "implicit", but
they still need the logic to cope with array member
initialization. Fixes PR10720.

llvm-svn: 140302
2011-09-22 15:15:51 +00:00
John McCall cbc038a6c3 ANSI C requires that a call to an unprototyped function type succeed
if the definition has a non-variadic prototype with compatible
parameters.  Therefore, the default rule for such calls must be to
use a non-variadic convention.  Achieve this by casting the callee to
the function type with which it is required to be compatible, unless
the target specifically opts out and insists that unprototyped calls
should use the variadic rules.  The only case of that I'm aware of is
the x86-64 convention, which passes arguments the same way in both
cases but also sets a small amount of extra information;  here we seek
to maintain compatibility with GCC, which does set this when calling
an unprototyped function.

Addresses PR10810 and PR10713.

llvm-svn: 140241
2011-09-21 08:08:30 +00:00
Richard Trieu e4f3180fec Change "ivar" to true for a boolean function argument. Since string literals are cast to true, this should no effect on behavior.
llvm-svn: 140231
2011-09-21 02:46:06 +00:00
Akira Hatanaka ec11b4fa5a Create a MipsTargetCodeGenInfo object for mips64/mips64el. The size of the
UnwindException structure is 32 for mips64. 

llvm-svn: 140165
2011-09-20 18:30:57 +00:00
Akira Hatanaka 0486db08bd Add a parameter to MipsTargetCodeGenInfo's constructor.
llvm-svn: 140161
2011-09-20 18:23:28 +00:00
Bill Wendling 5d7469e3e4 Don't assume that the clause is a GlobalVariable. It could be a constant.
llvm-svn: 140123
2011-09-20 00:40:19 +00:00
Eli Friedman 6b9c41ea68 Add list initialization for complex numbers in C. Essentially, this allows "_Complex float x = {1.0f, 2.0f};". See changes to docs/LanguageExtensions.html for a longer description.
<rdar://problem/9397672>.

llvm-svn: 140090
2011-09-19 23:17:44 +00:00
Bill Wendling 58e58fead1 The eh.selector intrinsic isn't used anymore. Replace the check here with a
check for the landingpad instruction instead. This check looks at each of the
clauses in the landingpad instruction. If it's a catch clause, it compares the
name directly with the global. If it's a filter clause, it has to look through
each value in the filer to see if any have the prefix.

llvm-svn: 140075
2011-09-19 22:08:36 +00:00
Peter Collingbourne 2dbb708b8a OpenCL: introduce support for function scope __local variables
llvm-svn: 140068
2011-09-19 21:14:35 +00:00
Argyrios Kyrtzidis 27bf76d6d2 In CodeGenAction::ExecuteAction() use SourceManager::translateFileLineCol()
instead of getLocation() since we don't care about expanded macro arguments.

llvm-svn: 140061
2011-09-19 20:40:38 +00:00
Argyrios Kyrtzidis e6e67deeed Rename SourceLocation::getFileLocWithOffset -> getLocWithOffset.
It already works (and is useful with) macro locs as well.

llvm-svn: 140057
2011-09-19 20:40:19 +00:00
Bill Wendling f0724e8e06 Throw the switch to convert clang to the new exception handling model!
This model uses the 'landingpad' instruction, which is pinned to the top of the
landing pad. (A landing pad is defined as the destination of the unwind branch
of an invoke instruction.) All of the information needed to generate the correct
exception handling metadata during code generation is encoded into the
landingpad instruction.

The new 'resume' instruction takes the place of the llvm.eh.resume intrinsic
call. It's lowered in much the same way as the intrinsic is.

llvm-svn: 140049
2011-09-19 20:31:14 +00:00
Devang Patel 5a54065c4f Tighten check to match an ivar with corresponding property by using ObjCImplementationDecl.
Radar 10139522 - Part 1.

llvm-svn: 140038
2011-09-19 18:54:16 +00:00
John McCall 28a5b326e1 In apple-kext mode, use external linkage for explicit template instantiations
instead of internal linkage.

llvm-svn: 140030
2011-09-19 18:05:26 +00:00
Richard Smith 20104048be PR10304: Do not call destructors for data members from union destructors. Prior to C++11, this
has no effect since any such destructors must be trivial, and in C++11 such destructors must not
be called.

llvm-svn: 139997
2011-09-18 12:11:43 +00:00
Bill Wendling 79a70e42b0 Refactor the load of the exception pointer and the exception selector from their
storage slot into helper functions.

llvm-svn: 139826
2011-09-15 18:57:19 +00:00
John McCall 99210dc9d1 Rewrite this loop to use partial destruction; I'm not sure it's
possible for that to matter right now, but eventually I think we'll
need to unify this better, and then it might.  Also, use a more
efficient looping structure.

llvm-svn: 139788
2011-09-15 06:49:18 +00:00
John McCall 3b201b7d5f Sorry, that assertion actually already exists.
llvm-svn: 139770
2011-09-15 01:55:23 +00:00
John McCall 8f8f8d67ea We don't generate null initializer expressions anymore, and
we don't need to.

llvm-svn: 139769
2011-09-15 01:54:21 +00:00
Devang Patel ecaf9ac0bb Emit debug info for c++0x nullptr.
llvm-svn: 139752
2011-09-14 23:14:14 +00:00
Eric Christopher 19329c402f Formatting.
llvm-svn: 139681
2011-09-14 01:10:50 +00:00
Eli Friedman 2dadd3ebee Fix comment.
llvm-svn: 139678
2011-09-14 00:52:45 +00:00
Eric Christopher 47300ad6e4 Fix typo.
llvm-svn: 139668
2011-09-13 23:45:09 +00:00
John McCall 30e4efd458 Correctly generate IR for casted "builtin" functions, where
the builtin is really just a predefined declaration.  These are
totally valid to cast.

llvm-svn: 139657
2011-09-13 23:05:03 +00:00
Eli Friedman 84d2812111 Re-commit r139643.
Make clang use Acquire loads and Release stores where necessary.

llvm-svn: 139650
2011-09-13 22:21:56 +00:00
Eli Friedman acca089617 Revert r139643 while I look into it; it's breaking selfhost.
llvm-svn: 139648
2011-09-13 22:08:16 +00:00
Eli Friedman f92b2e0714 Make clang use Acquire loads and Release stores where necessary.
llvm-svn: 139643
2011-09-13 21:31:32 +00:00
Eli Friedman 5be3e6ae9d Turn off the generation of unaligned atomic load/store; I'm going to explicitly error out on such cases in the backend, at least for the moment.
llvm-svn: 139640
2011-09-13 20:48:30 +00:00
John McCall 4319286337 Refactoring, mostly to give ObjCPropertyDecls stronger invariants for
their semantic attributes and then to take advantage of that.

llvm-svn: 139615
2011-09-13 18:31:23 +00:00
Douglas Gregor 79a91418bd Switch LangOptions over to a .def file that describes header of the
language options. Use that .def file to declare the LangOptions class
and initialize all of its members, eliminating a source of annoying
initialization bugs.

AST serialization changes are next up.

llvm-svn: 139605
2011-09-13 17:21:33 +00:00
John McCall 0bef0badf6 Don't use native atomics on ivars whose size is not a power of two,
even on architectures that support unaligned access (which is the
only way this is otherwise legal, given that ivars apparently do
not honor alignment attributes).

llvm-svn: 139590
2011-09-13 07:33:34 +00:00