summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
* Forward #pragma comment(lib/linker) through as flags metadataReid Kleckner2013-05-086-17/+92
| | | | | | | | | | | | | | | | | | | | | | Summary: Most of this change is wiring the pragma all the way through from the lexer, parser, and sema to codegen. I considered adding a Decl AST node for this, but it seemed too heavyweight. Mach-O already uses a metadata flag called "Linker Options" to do this kind of auto-linking. This change follows that pattern. LLVM knows how to forward the "Linker Options" metadata into the COFF .drectve section where these flags belong. ELF support is not implemented, but possible. This is related to auto-linking, which is http://llvm.org/PR13016. CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D723 llvm-svn: 181426
* Debug Info: Using declarations/DW_TAG_imported_declaration of variables, ↵David Blaikie2013-05-083-9/+53
| | | | | | | | | | | | types, and functions. Basic support is implemented here - it still doesn't account for declared-but-not-defined variables or functions. It cannot handle out of order (declared, 'using', then defined) cases for variables, but can handle that for functions (& can handle declared, 'using'd, and not defined at all cases for types). llvm-svn: 181393
* The style guide prefers preincrement expressions :-)Adrian Prantl2013-05-071-2/+2
| | | | llvm-svn: 181373
* remove commented out code.Adrian Prantl2013-05-071-2/+1
| | | | llvm-svn: 181372
* Don't crash in IRGen if a conditional with 'throw' in one of its branches isRichard Smith2013-05-073-5/+19
| | | | | | used as a branch condition. llvm-svn: 181368
* Weaken an assertion in memcpyization to account forJohn McCall2013-05-071-2/+6
| | | | | | | | | | | unnamed bitfields. Unnamed bitfields won't have an explicit copy operation in the AST, which breaks the strong form of the invariant. rdar://13816940 llvm-svn: 181289
* DebugInfo: Support imported modules (using directives) within lexical blocks.David Blaikie2013-05-061-2/+5
| | | | llvm-svn: 181272
* Add SystemZ supportUlrich Weigand2013-05-061-0/+290
| | | | | | | | | | | | | | This patch then adds all the usual platform-specific pieces for SystemZ: driver support, basic target info, register names and constraints, ABI info and vararg support. It also adds new tests to verify pre-defined macros and inline asm, and updates a test for the minimum alignment change. This version of the patch incorporates feedback from reviews by Eric Christopher and John McCall. Thanks to all reviewers! Patch by Richard Sandiford. llvm-svn: 181211
* Allow targets to define minimum alignment for global variablesUlrich Weigand2013-05-062-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds a new common code feature that allows platform code to request minimum alignment of global symbols. The background for this is that on SystemZ, the most efficient way to load addresses of global symbol is the LOAD ADDRESS RELATIVE LONG (LARL) instruction. This instruction provides PC-relative addressing, but only to *even* addresses. For this reason, existing compilers will guarantee that global symbols are always aligned to at least 2. [ Since symbols would otherwise already use a default alignment based on their type, this will usually only affect global objects of character type or character arrays. ] GCC also allows creating symbols without that extra alignment by using explicit "aligned" attributes (which then need to be used on both definition and each use of the symbol). To enable support for this with Clang, this patch adds a TargetInfo::MinGlobalAlign variable that provides a global minimum for the alignment of every global object (unless overridden via explicit alignment attribute), and adds code to respect this setting. Within this patch, no platform actually sets the value to anything but the default 1, resulting in no change in behaviour on any existing target. This version of the patch incorporates feedback from reviews by Eric Christopher and John McCall. Thanks to all reviewers! Patch by Richard Sandiford. llvm-svn: 181210
* Make all 'is in extern "C"' tests use the lexical context.Rafael Espindola2013-05-051-2/+2
| | | | | | | I was not able to find a case (other than the fix in r181163) where this makes a difference, but it is a more obviously correct API to have. llvm-svn: 181165
* Replace ArrayRef<T>() with None, now that we have an implicit ArrayRef ↵Dmitri Gribenko2013-05-052-10/+5
| | | | | | | | constructor from None Patch by Robert Wilhelm. llvm-svn: 181139
* In VarDecl nodes, store the thread storage class specifier as written.Enea Zaffanella2013-05-041-1/+1
| | | | llvm-svn: 181113
* AArch64: teach Clang about __clear_cache intrinsicTim Northover2013-05-042-0/+22
| | | | | | | libgcc provides a __clear_cache intrinsic on AArch64, much like it does on 32-bit ARM. llvm-svn: 181111
* Reapply r180982 with repaired logic and an additional testcase.Adrian Prantl2013-05-034-22/+35
| | | | | | | | | | | | | | Un-break the gdb buildbot. - Use the debug location of the return expression for the cleanup code if the return expression is trivially evaluatable, regardless of the number of stop points in the function. - Ensure that any EH code in the cleanup still gets the line number of the closing } of the lexical scope. - Added a testcase with EH in the cleanup. rdar://problem/13442648 llvm-svn: 181056
* Correctly emit certain implicit references to 'self' even withinJohn McCall2013-05-037-40/+32
| | | | | | | | | | | | | | | | | | a lambda. Bug #1 is that CGF's CurFuncDecl was "stuck" at lambda invocation functions. Fix that by generally improving getNonClosureContext to look through lambdas and captured statements but only report code contexts, which is generally what's wanted. Audit uses of CurFuncDecl and getNonClosureAncestor for correctness. Bug #2 is that lambdas weren't specially mapping 'self' when inside an ObjC method. Fix that by removing the requirement for that and using the normal EmitDeclRefLValue path in LoadObjCSelf. rdar://13800041 llvm-svn: 181000
* Revert "Attempt to un-break the gdb buildbot."Adrian Prantl2013-05-034-33/+22
| | | | | | This reverts commit 180982. llvm-svn: 180990
* [ms-cxxabi] Emit non-virtual member function pointersReid Kleckner2013-05-031-18/+87
| | | | | | | | | | | | | | Without any conversion, this is pretty straightforward. Most of the fields can be zeros. The order is: - field offset or pointer - nonvirtual adjustment (for MI functions) - vbptr offset (for unspecified) - virtual adjustment offset (for virtual inheritance) Differential Revision: http://llvm-reviews.chandlerc.com/D699 llvm-svn: 180985
* Attempt to un-break the gdb buildbot.Adrian Prantl2013-05-034-22/+33
| | | | | | | | | | | | | - Use the debug location of the return expression for the cleanup code if the return expression is trivially evaluatable, regardless of the number of stop points in the function. - Ensure that any EH code in the cleanup still gets the line number of the closing } of the lexical scope. - Added a testcase with EH in the cleanup. rdar://problem/13442648 llvm-svn: 180982
* Move parsing of identifiers in MS-style inline assembly intoJohn McCall2013-05-031-4/+8
| | | | | | | | | | | | | | | | | | | | | the actual parser and support arbitrary id-expressions. We're actually basically set up to do arbitrary expressions here if we wanted to. Assembly operands permit things like A::x to be written regardless of language mode, which forces us to embellish the evaluation context logic somewhat. The logic here under template instantiation is incorrect; we need to preserve the fact that an expression was unevaluated. Of course, template instantiation in general is fishy here because we have no way of delaying semantic analysis in the MC parser. It's all just fishy. I've also fixed the serialization of MS asm statements. This commit depends on an LLVM commit. llvm-svn: 180976
* Use the Itanium ABI for thread_local on Darwin.Bill Wendling2013-05-022-2/+12
| | | | | | | | | | | After some discussion, it was decided to use the Itanium ABI for thread_local on Darwin OS X platforms. This involved a couple of changes. First, we use "_tlv_atexit" instead of "__cxa_thread_atexit". Secondly, the global variables are marked with 'internal' linkage, because we want all access to be calls to the Itanium-specific entry point, which has normal linkage. <rdar://problem/13733006> llvm-svn: 180941
* Ensure that the line table for functions with cleanups is sequential.Adrian Prantl2013-05-024-7/+45
| | | | | | | | | | | | | | | | If there is cleanup code, the cleanup code gets the debug location of the closing '}'. The subsequent ret IR-instruction does not get a debug location. The return _expression_ will get the debug location of the return statement. If the function contains only a single, simple return statement, the cleanup code may become the first breakpoint in the function. In this case we set the debug location for the cleanup code to the location of the return statement. rdar://problem/13442648 llvm-svn: 180932
* Use a more idiomatic way to disable debug locations.Adrian Prantl2013-05-021-4/+2
| | | | llvm-svn: 180931
* Revert 180817 because 180816 was reverted.Adrian Prantl2013-04-301-0/+16
| | | | llvm-svn: 180823
* Do not generate VLAs as complex variables any more, as they are nowAdrian Prantl2013-04-301-16/+0
| | | | | | | | | | correctly represented as breg+0 locations in the backend. (Paired commit with LLVM: r180815) rdar://problem/13658587 llvm-svn: 180817
* Revert r180739 and r180748: they broke C++11 thread_local on non-Darwin ↵Richard Smith2013-04-303-38/+0
| | | | | | | | | | | | | | | | systems and did not do the right thing on Darwin. Original commit message: Emit the TLS intialization functions into a list. Add the TLS initialization functions to a list of initialization functions. The back-end takes this list and places the function pointers into the correct section. This way they're called before `main().' <rdar://problem/13733006> llvm-svn: 180809
* [ms-cxxabi] Implement member pointer comparisonsReid Kleckner2013-04-301-0/+72
| | | | | | | | | | | | | | | | | | Summary: Like Itanium, comparisons are basically bitwise comparisons of the two values, with an exception for null member function pointers. If two function pointers are null, only the function pointer field matters for comparison purposes. The rest of the bits can be arbitrary. We take advantage of this in isZeroInitializable(), and it may matter once we start emitting conversions. Reviewers: rjmccall CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D695 llvm-svn: 180800
* Struct-path aware TBAA: enable struct-path aware TBAA for classes.Manman Ren2013-04-301-2/+4
| | | | llvm-svn: 180795
* Don't treat a non-deduced 'auto' type as being type-dependent. Instead, thereRichard Smith2013-04-303-0/+11
| | | | | | | | are now two distinct canonical 'AutoType's: one is the undeduced 'auto' placeholder type, and the other is a deduced-but-dependent type. All deduced-to-a-non-dependent-type cases are still non-canonical. llvm-svn: 180789
* Emit the TLS intialization functions into a list.Bill Wendling2013-04-293-0/+38
| | | | | | | | | | Add the TLS initialization functions to a list of initialization functions. The back-end takes this list and places the function pointers into the correct section. This way they're called before `main().' <rdar://problem/13733006> llvm-svn: 180739
* Struct-path aware TBAA: fix handling of may_alias attribute.Manman Ren2013-04-271-2/+2
| | | | llvm-svn: 180656
* Struct-path aware TBAA: change the format of TBAAStructType node.Manman Ren2013-04-271-3/+3
| | | | | | | We switch the order of offset and field type to make TBAAStructType node (name, parent node, offset) similar to scalar TBAA node (name, parent node). llvm-svn: 180653
* ArrayRefize code. No functionality change.Benjamin Kramer2013-04-262-18/+13
| | | | llvm-svn: 180632
* Support debug info for using directives at global/namespace scope.David Blaikie2013-04-261-1/+4
| | | | llvm-svn: 180594
* TBAA: make sure zero-length bitfield works for tbaa.struct and path-aware tbaaManman Ren2013-04-221-1/+24
| | | | | | | | For ms structs, zero-length bitfields following non-bitfield members are completely ignored, we should not increase the field index. Before the fix, we will have an assertion failure. llvm-svn: 180038
* Use the ugly PRIx64 macro to make format string portable.Benjamin Kramer2013-04-221-1/+1
| | | | | | | This is debugging code so functionality isn't a concern, but mingw32 warns because it doesn't understand the %llx format specifier. llvm-svn: 180024
* Don't emit _ZTW wrappers for TLS variables which don't use the C++ ↵Richard Smith2013-04-221-1/+2
| | | | | | thread_local keyword. llvm-svn: 180004
* Revert "Revert "PR14606: Debug info for using ↵David Blaikie2013-04-223-1/+14
| | | | | | | | directives/DW_TAG_imported_module"" This reverts commit 179839 now that the corresponding LLVM patch has been fixed. llvm-svn: 179997
* C++1y: Allow aggregates to have default initializers.Richard Smith2013-04-208-1/+69
| | | | | | | | | | | Add a CXXDefaultInitExpr, analogous to CXXDefaultArgExpr, and use it both in CXXCtorInitializers and in InitListExprs to represent a default initializer. There's an additional complication here: because the default initializer can refer to the initialized object via its 'this' pointer, we need to make sure that 'this' points to the right thing within the evaluation. llvm-svn: 179958
* Emit the underlying type in the debug info for all kinds of fixed enumsAdrian Prantl2013-04-191-1/+1
| | | | | | | | instead of only C++11-scoped-with-class-tag enums. rdar://problem/13463793 llvm-svn: 179879
* Implement CodeGen for C++11 thread_local, following the Itanium ABI ↵Richard Smith2013-04-198-13/+254
| | | | | | specification as discussed on cxx-abi-dev. llvm-svn: 179858
* Revert "PR14606: Debug info for using directives/DW_TAG_imported_module"Eric Christopher2013-04-193-14/+1
| | | | | | This reverts commit r179837 as it seems to be causing test failures. llvm-svn: 179839
* PR14606: Debug info for using directives/DW_TAG_imported_moduleDavid Blaikie2013-04-193-1/+14
| | | | | | More changes later for using declarations/DW_TAG_imported_declaration. llvm-svn: 179837
* Give CGDebugInfo::getContextDescriptor a more specific return typeDavid Blaikie2013-04-192-10/+7
| | | | | | | Not that the DI* hierarchy is terribly type safe, but this makes the contract a little clearer I think. llvm-svn: 179835
* Set SRet flags properly in '-cxx-abi microsoft'.Timur Iskhodzhanov2013-04-174-72/+125
| | | | | | | | | Also, - abstract out the indirect/in memory/in registers decisions into the CGCXXABI - fix handling of empty struct arguments for '-cxx-abi microsoft' - add/fix tests llvm-svn: 179681
* Don't propagate around TargetOptions in IR-gen; we don't use it.John McCall2013-04-163-14/+9
| | | | | | Patch by Stephen Lin! llvm-svn: 179639
* Standardize accesses to the TargetInfo in IR-gen.John McCall2013-04-1624-120/+126
| | | | | | Patch by Stephen Lin! llvm-svn: 179638
* objc_autoreleasePoolPop() can throw if a -dealloc does.John McCall2013-04-161-1/+3
| | | | | | | | | | | | | Model it as throwing so that the exception can be caught. This is generally not expected to have significant code-size impact because the contents of the @autoreleasepool block are very likely to contain a call, very likely at the same cleanup level as the @autoreleasepool itself. rdar://13660038 llvm-svn: 179630
* Sema for Captured StatementsTareq A. Siraj2013-04-161-0/+1
| | | | | | | | | | | | | Add CapturedDecl to be the DeclContext for CapturedStmt, and perform semantic analysis. Currently captures all variables by reference. TODO: templates Author: Ben Langmuir <ben.langmuir@intel.com> Differential Revision: http://llvm-reviews.chandlerc.com/D433 llvm-svn: 179618
* Implement CapturedStmt ASTTareq A. Siraj2013-04-162-1/+8
| | | | | | | | | | | | | | | CapturedStmt can be used to implement generic function outlining as described in http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-January/027540.html. CapturedStmt is not exposed to the C api. Serialization and template support are pending. Author: Wei Pan <wei.pan@intel.com> Differential Revision: http://llvm-reviews.chandlerc.com/D370 llvm-svn: 179615
* [Modules] Convert module specific -fno-modules-autolink into -fno-autolink.Daniel Dunbar2013-04-161-1/+1
| | | | | | | | | - There is no reason to have a modules specific flag for disabling autolinking. Instead, convert the existing flag into -fno-autolink (which should cover other autolinking code generation paths like #pragmas if and when we support them). llvm-svn: 179612
OpenPOWER on IntegriCloud