summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* CodeGen: Remove a comment that isn't in the right placeJustin Bogner2014-04-151-4/+0
| | | | | | | This comment also appears elsewhere where it actually makes sense, and it's just confusing here. llvm-svn: 206321
* Replace push_back()s by initializer list for shorter and cleaner code.Eli Bendersky2014-04-151-5/+3
| | | | llvm-svn: 206304
* Add support for CUDA __launch_bounds__ attribute to CodeGen.Eli Bendersky2014-04-151-10/+28
| | | | | | | | | | Sema does have a CUDALaunchBoundsAttr, but CodeGen was doing nothing with it. This change translates CUDALaunchBoundsAttr to maxntidx and minctasm metadata, which NVPTX then translates to the correct PTX directives. Patch by Manjunath Kudlur. llvm-svn: 206302
* verify-di: Call debug info verifier from clangDuncan P. N. Exon Smith2014-04-151-0/+2
| | | | | | | | | This is paired with a patch to LLVM that creates a separate pass for verifying debug info. <rdar://problem/15500563> llvm-svn: 206301
* ARM64: track alignment padding registers on AAPCS targetsTim Northover2014-04-151-1/+9
| | | | | | | | | | This implements clause C.8 of the AAPCS in the front-end, so that Clang accurately knows when the registers run out and it has to insert padding before the stack objects begin. PR19432. llvm-svn: 206296
* CodeGen: Handle CapturedStmt in instrumentation based profilingJustin Bogner2014-04-153-0/+19
| | | | | | | | CapturedStmt was being ignored by instrumentation based profiling, and its counters attributed to the containing function. Instead, we need to treat this as a top level entity, like we do with blocks. llvm-svn: 206231
* Ensure we evaluate VLA bounds if a variably-modified type is used as theRichard Smith2014-04-141-0/+4
| | | | | | | argument to __builtin_va_arg. Patch by Rahul Jain, some test massaging and IR emission order changes by me. llvm-svn: 206223
* Follow-up to r205999: Emit an artificial location (valid scope, line 0)Adrian Prantl2014-04-111-43/+54
| | | | | | | | | for CXXGlobalInit/Dtor helper functions. This makes _GLOBAL__I_a regain its DW_AT_high/low_pc in the debug info. Thanks to echristo for catching this! llvm-svn: 206088
* CodeGen: Fix handling of C++11 lambdas in profilingJustin Bogner2014-04-111-3/+9
| | | | | | | | | Until now we were generating duplicate counters for lambdas: one set in the function where the lambda was declared and another for the lambda itself. Instead, we should skip over the bodies of lambdas in their containing contexts. llvm-svn: 206081
* [PGO] Change MapRegionCounters to be a RecursiveASTVisitor.Bob Wilson2014-04-111-132/+75
| | | | | | | This avoids the overhead of specifying all the traversal code when using ConstStmtVisitor and makes it a lot easier to maintain this. llvm-svn: 206039
* CodeGen: Handle binary conditional operators in PGO instrumentationJustin Bogner2014-04-111-2/+4
| | | | | | | This treats binary conditional operators in the same way as ternary conditional operators for instrumentation based profiling. llvm-svn: 206021
* Cleanup: Add default arguments to CodeGenFunction::StartFunction.Adrian Prantl2014-04-114-16/+12
| | | | | | Thanks dblaikie for the suggestion! llvm-svn: 206012
* Switch from constexpr to const char *constDuncan P. N. Exon Smith2014-04-111-2/+2
| | | | | | Responding to Richard Smith's review of r205037. llvm-svn: 206008
* InstrProf: Rename Decl parameters from S to DDuncan P. N. Exon Smith2014-04-101-21/+21
| | | | | | | | No functionality change. <rdar://problem/16435801> llvm-svn: 206002
* InstrProf: Read unsigned numbers with strtoul and strtoullDuncan P. N. Exon Smith2014-04-101-6/+6
| | | | | | | | | | | | | | | | | | Fixes a bug where unsigned numbers are read using strtol and strtoll. I don't have a testcase because this bug is effectively unobservable right now. To expose the problem in the hash, we would need a function with greater than INT64_MAX counters, which we don't handle anyway. To expose the problem in the function count, we'd need a function with greater than INT32_MAX counters; this is theoretically observable, but it isn't a practical testcase to check in. An upcoming commit changes the hash to be non-trivial, so we'll get some coverage eventually. <rdar://problem/16435801> llvm-svn: 206001
* Debug info: (Bugfix) Make sure artificial functions like _GLOBAL__I_aAdrian Prantl2014-04-109-41/+61
| | | | | | | | | | | | | | | | are not associated with any source lines. Previously, if the Location of a Decl was empty, EmitFunctionStart would just keep using CurLoc, which would sometimes be correct (e.g., thunks) but in other cases would just point to a hilariously random location. This patch fixes this by completely eliminating all uses of CurLoc from EmitFunctionStart and rather have clients explicitly pass in a SourceLocation for the function header and the function body. rdar://problem/14985269 llvm-svn: 205999
* Update Clang for LLVM split stack API changes in r205997Reid Kleckner2014-04-102-1/+2
| | | | | | Patch by Alex Crichton! llvm-svn: 205998
* inalloca: Pad the struct *after* inserting each argReid Kleckner2014-04-101-9/+7
| | | | | | | This ensures that the overall struct size will be a multiple of 4, as required by the ABI. llvm-svn: 205981
* CodeGen: Move PGO initialization into Release()Justin Bogner2014-04-102-7/+5
| | | | | | | | Emitting the PGO initialization in EmitGlobalFunctionDefinition is inefficient, since this only has an effect once per module. We move this to Release() with the rest of the once-per-module logic. llvm-svn: 205977
* CodeGen: Clean up CommonLinkage calculationDavid Majnemer2014-04-101-10/+35
| | | | | | No functionality change. llvm-svn: 205972
* Add global static variables for anonymous union fields. This makesEric Christopher2014-04-102-6/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | sure that a debugger can find them when stepping through code, for example from the included testcase: 12 int test_it() { 13 c = 1; 14 d = 2; -> 15 a = 4; 16 return (c == 1); 17 } 18 (lldb) p a (int) $0 = 2 (lldb) p c (int) $1 = 2 (lldb) p d (int) $2 = 2 and a, c, d are all part of the file static anonymous union: static union { int c; int d; union { int a; }; struct { int b; }; }; Fixes PR19221. llvm-svn: 205952
* Avoid crashing when failing to emit a thunkReid Kleckner2014-04-101-2/+8
| | | | | | | | If we crash, we raise a crash handler dialog, and that's really annoying. Even though we can't emit correct IR until we have musttail, don't crash. llvm-svn: 205948
* Add support for MSVC's __FUNCSIG__Reid Kleckner2014-04-081-21/+13
| | | | | | | | | | | It is very similar to GCC's __PRETTY_FUNCTION__, except it prints the calling convention. Reviewers: majnemer Differential Revision: http://reviews.llvm.org/D3311 llvm-svn: 205780
* DebugInfo: Support type alias templatesDavid Blaikie2014-04-062-4/+36
| | | | | | | | We already got the type alias correct (though I've included a test case here) since Clang represents that like any other typedef - but type alias templates weren't being handled. llvm-svn: 205691
* DebugInfo: emit namespace aliases as named imported declarations instead of ↵David Blaikie2014-04-061-2/+2
| | | | | | | | named imported entities Apparently that's how DWARF4 suggests they be emitted. So let's do that. llvm-svn: 205686
* Reapply r205655, DebugInfo: Place global constants in their appropriate context.David Blaikie2014-04-051-1/+4
| | | | | | | This was reverted in 205664 and seems to be fixed by 205668... though that may be more by accident than anything well founded. llvm-svn: 205669
* DebugInfo: Avoid emitting constnants for every useDavid Blaikie2014-04-051-1/+5
| | | | | | | | While the folding set would deduplicate the nodes themselves and LLVM would handle not emitting the same global twice, it still meant creating a long/redundant list of global variables. llvm-svn: 205668
* Revert "DebugInfo: Place global constants in their appropriate context."David Blaikie2014-04-051-4/+1
| | | | | | | | | This reverts commit r205655. Breaks the compiler-rt build with an assertion failure in LLVM... reverting while I investigate. llvm-svn: 205664
* DebugInfo: Place global constants in their appropriate context.David Blaikie2014-04-041-1/+4
| | | | | | | We also don't need to duplicate the name in the LinkageName field. Just leave it empty. llvm-svn: 205655
* DebugInfo: PR19298: function local const variables duplicated in the root scopeDavid Blaikie2014-04-041-0/+3
| | | | | | | | | | | | | | See the comment for CodeGenFunction::tryEmitAsConstant that describes how in some contexts (lambdas) we must not emit references to the variable, but instead use the constant directly - because of this we end up emitting a constant for the variable, as well as emitting the variable itself. Should we just skip putting the variable on the stack at all and omit the debug info for the constant? It's not clear to me - what if the address of the local is taken? llvm-svn: 205651
* When printing types for the OpenCL kernel metadata, use the PrintingPolicy.Joey Gouly2014-04-041-2/+5
| | | | | | | | This allows 'half' to be printed as 'half' and not as '__fp16'. Patch by Fraser Cormack! llvm-svn: 205624
* CodeGen: Don't create branch weight metadata from empty profilesJustin Bogner2014-04-041-2/+6
| | | | | | | | | | | If all of our weights are zero when calculating branch weights, it means we haven't profiled the code in question. Avoid creating a metadata node that says all branches are equally likely in this case. The test also checks constructs that hit the other createBranchWeights overload. These were already working. llvm-svn: 205606
* CodeGen: Emit some functions as weak_odr under -fms-compatibilityDavid Majnemer2014-04-021-3/+2
| | | | | | | | | | | | | | | | | | | Summary: MSVC always emits inline functions marked with the extern storage class specifier. The result is something similar to the opposite of __attribute__((gnu_inline)). This extension is also available in C. This fixes PR19264. Reviewers: rnk, rsmith CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D3207 llvm-svn: 205485
* DebugInfo: Include default template arguments in template type namesDavid Blaikie2014-04-021-22/+8
| | | | | | | | | | | | | | | This was committed 4 years ago in 108916 with insufficient testing to explain why the "getTypeAsWritten" case was appropriate. Experience says that it isn't - the presence or absence of an explicit instantiation declaration was causing this code to generate either i<int> or i<int, int>. That didn't seem to be a useful distinction, and omitting the template arguments was destructive to debuggers being able to associate the two types across translation units or across compilers (GCC, reasonably, never omitted the arguments). llvm-svn: 205447
* Fix type mismatch assertion related to inalloca and PR19287Reid Kleckner2014-04-021-2/+5
| | | | | | | | Augment the test case from r205217 to catch this related bug. Fixes the Windows self-host which was failing on VariantValue.cpp. llvm-svn: 205378
* Partially revert r204517 and fix a different way:Eric Christopher2014-04-011-6/+15
| | | | | | | | | | | | | We don't want to encourage the code to emit a lexical block for a function that needs one in order for the line table to change, we need to grab the line information from the body of the pattern that we were instantiated from, this code should do that. Modify the test case to ensure that we're still looking in the right place for all of the scopes and also that we haven't created a lexical block where we didn't need one. llvm-svn: 205368
* Debug info: fix a crash when emitting IndirectFieldDecls, which wereAdrian Prantl2014-04-011-1/+1
| | | | | | | previously not handled at all. rdar://problem/16348575 llvm-svn: 205331
* ARM64: add a few bits of polynomial intrinsic codegen.Tim Northover2014-04-011-0/+11
| | | | llvm-svn: 205303
* ARM64: add missing ldN/stN intrinsics and enable tests.Tim Northover2014-04-011-3/+6
| | | | llvm-svn: 205296
* Adapt CGDebugInfo to interface changes in DIBuilder/DIImportedEntity.Adrian Prantl2014-04-012-6/+6
| | | | | | | The Decl field in a DIImportedEntity is now a DIRef. Paired commit with LLVM. llvm-svn: 205278
* Disable this-return optimizations when targeting iOS 5 and earlier.Bob Wilson2014-04-011-1/+6
| | | | | | | | | | | | | | | | Clang implements the part of the ARM ABI saying that certain functions (e.g., constructors and destructors) return "this", but Apple's version of gcc and llvm-gcc did not. The libstdc++ dylib on iOS 5 was built with llvm-gcc, which means that clang cannot safely assume that code from the C++ runtime will correctly follow the ABI. It is also possible to run into this problem when linking with other libraries built with gcc or llvm-gcc. Even though there is no way to reliably detect that situation, it is most likely to come up when targeting older versions of iOS. Disabling the optimization for any code targeting iOS 5 solves the libstdc++ problem and has a reasonably good chance of fixing the issue for other older libraries as well. <rdar://problem/16377159> llvm-svn: 205272
* Implement the 'optnone' attribute, which suppresses most optimizationsPaul Robinson2014-03-311-0/+10
| | | | | | on a function. llvm-svn: 205255
* MS ABI: Use the proper type for inalloca argsDavid Majnemer2014-03-311-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | Summary: The definition of a type later in a translation unit may change it's type from {}* to (%struct.foo*)*. Earlier function definitions may use the former while more recent definitions might use the later. This is fine until they interact with one another (like one calling the other). In these cases, a bitcast is needed because the inalloca must match the function call but the store to the lvalue which initializes the argument slot has to match the rvalue's type. This technique is along the same lines with what the other, non-inalloca, codepaths perform. This fixes PR19287. Reviewers: rnk CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D3224 llvm-svn: 205217
* ARM64: enable aarch64-neon-intrinsics.c testTim Northover2014-03-311-28/+56
| | | | | | | | | | | | This adds support for the various NEON intrinsics used by aarch64-neon-intrinsics.c (originally written for AArch64) and enables the test. My implementations are designed to be semantically correct, the actual code quality looks like its a wash between the two backends, and is frequently different (hence the large number of CHECK changes). llvm-svn: 205210
* Remove unused variableDmitri Gribenko2014-03-311-1/+0
| | | | llvm-svn: 205169
* ARM64: remove currently trivial switch statementTim Northover2014-03-311-4/+0
| | | | llvm-svn: 205167
* RTTI: refactor the uniqueness question into CGCXXABI.Tim Northover2014-03-304-56/+72
| | | | | | | This also brings the code into closer conformance with usual LLVM coding style and other surrounding conventions. llvm-svn: 205158
* ARM64: Fix GCC warning in CGBuiltin.cppTim Northover2014-03-291-1/+1
| | | | llvm-svn: 205104
* CodeGen: Allow different RTTI emission strategiesTim Northover2014-03-291-2/+70
| | | | | | | | Some ABIs and C++ libraries may make different trade-offs in how RTTI is emitted (currently with respect to visibility and so on). This implements one scheme, as used by ARM64. llvm-svn: 205101
* ARM64: initial clang support commit.Tim Northover2014-03-296-255/+2979
| | | | | | | | | | | This adds Clang support for the ARM64 backend. There are definitely still some rough edges, so please bring up any issues you see with this patch. As with the LLVM commit though, we think it'll be more useful for merging with AArch64 from within the tree. llvm-svn: 205100
OpenPOWER on IntegriCloud