summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* Apply BlackList -> SpecialCaseList rename in Clang.Peter Collingbourne2013-07-091-3/+3
| | | | | | Differential Revision: http://llvm-reviews.chandlerc.com/D1095 llvm-svn: 185979
* Reapply an improved version of r180816/180817.Adrian Prantl2013-07-091-16/+0
| | | | | | | | | | | Do not generate VLAs as complex variables any more, as they are now correctly represented as breg+0 locations in the backend. (Paired commit with LLVM: r185966) rdar://problem/13658587 llvm-svn: 185967
* Simplify code. No functional change.Craig Topper2013-07-081-3/+1
| | | | llvm-svn: 185792
* Don't use mangleCXXRTTIName in TBAA for C code.Eli Friedman2013-07-051-9/+1
| | | | | | | | | | | | | | This changes the TBAA code so it doesn't use mangleCXXRTTIName in C, because it doesn't really make sense there. Also, as sort of a defense-in-depth change, fix the mangler so it handles C RecordDecls correctly. No tests because I don't know the TBAA code well enough to write a test, and I don't know how else to trigger mangling a local struct in C. Fixes a crash with r185450 reported by Joerg Sonnenberger. llvm-svn: 185721
* Use SmallVectorImpl& for function arguments instead of SmallVector.Craig Topper2013-07-054-5/+5
| | | | llvm-svn: 185715
* Add target hook CodeGen queries when generating builtin pow*.Eli Bendersky2013-07-033-7/+20
| | | | | | | | | | | Without fmath-errno, Clang currently generates calls to @llvm.pow.* intrinsics when it sees pow*(). This may not be suitable for all targets (for example le32/PNaCl), so the attached patch adds a target hook that CodeGen queries. The target can state its preference for having or not having the intrinsic generated. Non-PNaCl behavior remains unchanged; PNaCl-specific test added. llvm-svn: 185568
* Debug Info: clean up usage of Verify.Manman Ren2013-07-021-14/+14
| | | | | | | No functionality change. It should suffice to check the type of a debug info metadata, instead of calling Verify. llvm-svn: 185463
* Simplify linkage code for static local vars.Eli Friedman2013-07-013-55/+4
| | | | | | | | | The key insight here is that weak linkage for a static local variable should always mean linkonce_odr, because every file that needs it will generate a definition. We don't actually care about the precise linkage of the parent context. I feel a bit silly that I didn't realize this before. llvm-svn: 185381
* Fix mangling for block literals.Eli Friedman2013-07-013-14/+43
| | | | | | | | | | | | | | | Blocks, like lambdas, can be written in contexts which are required to be treated as the same under ODR. Unlike lambdas, it isn't possible to actually take the address of a block, so the mangling of the block itself doesn't matter. However, objects like static variables inside a block do need to be mangled in a consistent way. There are basically three components here. One, block literals need a consistent numbering. Two, objects/types inside a block literal need to be mangled using it. Three, objects/types inside a block literal need to have their linkage computed correctly. llvm-svn: 185372
* Restore r184205 and associated commits (after commit of r185290)Stephen Lin2013-06-3010-208/+135
| | | | | | This allows clang to use the backend parameter attribute 'returned' when generating 'this'-returning constructors and destructors in ARM and MSVC C++ ABIs. llvm-svn: 185291
* Remove dead code.Eli Friedman2013-06-281-55/+2
| | | | llvm-svn: 185231
* [ms-cxxabi] Move CodeGenVTables::needsVTTParameter to ItaniumCXXABI.Peter Collingbourne2013-06-286-31/+38
| | | | | | | | | This function only makes sense there. Eventually it should no longer be part of the CGCXXABI interface, as it is an Itanium-specific detail. Differential Revision: http://llvm-reviews.chandlerc.com/D821 llvm-svn: 185213
* Delete dead code.Eli Friedman2013-06-282-40/+16
| | | | llvm-svn: 185119
* Use the zero-argument DIBuilder::createNullPtrType in Clang.Peter Collingbourne2013-06-271-2/+1
| | | | | | Differential Revision: http://llvm-reviews.chandlerc.com/D1051 llvm-svn: 185115
* Ensure that debugger calls to signature-less functions default toJohn McCall2013-06-271-0/+7
| | | | | | | | | | | | | | | | | | | | | passing arguments in the fixed style. We have an abstraction for deciding this, but it's (1) deep in IR-generation, (2) necessarily tied to exact argument lists, and (3) triggered by unprototyped function types, which we can't legitimately make in C++ mode. So this solution, wherein Sema rewrites the function type to an exact prototype but leaves the variadic bit enabled so as to request x86-64-like platforms to pass the extra variadic info, is very much a hack, but it's one that works in practice on the platforms that LLDB will support in the medium term --- the only place we know of where it's a problem is instance methods in Windows, where variadic functions are implicitly cdecl. We may have a more abstracted base on which to build a solution by then. rdar://13731520 llvm-svn: 185112
* Rewrite record layout for ms_struct structs.Eli Friedman2013-06-264-95/+4
| | | | | | | | | | | | | | The old implementation of ms_struct in RecordLayoutBuilder was a complete mess: it depended on complicated conditionals which didn't really reflect the underlying logic, and placed a burden on users of the resulting RecordLayout. This commit rips out almost all of the old code, and replaces it with simple checks in RecordLayoutBuilder::LayoutBitField. This commit also fixes <rdar://problem/14252115>, a bug where class inheritance would cause us to lay out bitfields incorrectly. llvm-svn: 185018
* Remove misplaced commentEli Bendersky2013-06-251-1/+0
| | | | llvm-svn: 184862
* Make -vectorize-... proper cc1 flags instead of abusing -backend-option. FixesNick Lewycky2013-06-251-0/+3
| | | | | | usage of clang as a library. llvm-svn: 184812
* [AST] Introduce a new DecayedType sugar nodeReid Kleckner2013-06-242-0/+8
| | | | | | | | | | | | | | The goal of this sugar node is to be able to look at an arbitrary FunctionType and tell if any of the parameters were decayed from an array or function type. Ultimately this is necessary to implement Microsoft's C++ name mangling scheme, which mangles decayed arrays differently from normal pointers. Reviewers: rsmith Differential Revision: http://llvm-reviews.chandlerc.com/D1014 llvm-svn: 184763
* DebugInfo: ensure negative enumerators are emitted as suchDavid Blaikie2013-06-241-1/+1
| | | | | | | | | | There's still a problem here - since we're not appropriately using the signedness/range of the enum to chooset the encoding and emission of enumerators, but GCC has some bugs around this too so I assume that's not /such/ a high priority though I may get to it soon out of completeness. llvm-svn: 184695
* DebugInfo: Support (using GNU extensions) for template template parameters ↵David Blaikie2013-06-222-17/+27
| | | | | | and parameter packs llvm-svn: 184644
* DebugInfo: Random tidying up/simplificationDavid Blaikie2013-06-221-24/+16
| | | | | | No functionality change intended. llvm-svn: 184614
* Teach ARM va_arg to ignore empty structs.Tim Northover2013-06-211-0/+6
| | | | | | | | Empty structs are ignored for parameter passing purposes, but va_arg was incrementing the pointer anyway which could lead to va_list getting out of sync. llvm-svn: 184605
* Check for trivial constructibility before emptiness in ARM ABI.Tim Northover2013-06-211-3/+3
| | | | | | | | | | | | According to the Itanium ABI (3.1.1), types with non-trivial copy constructors passed by value should be passed indirectly, with the caller creating a temporary. We got this mostly correct, but forgot that empty structs can have non-trivial constructors too and passed them incorrectly. This simply reverses the order of the check. llvm-svn: 184603
* Fix a leak of TargetMachine in clang. We'll continue to leak it on purpose ifNick Lewycky2013-06-211-0/+1
| | | | | | given -disable-free. (Reviewed by John McCall over IRC.) llvm-svn: 184595
* PR16214: Debug info for types first used via pointers or qualified types & ↵David Blaikie2013-06-211-1/+8
| | | | | | later require definitions llvm-svn: 184594
* [ms-cxxabi] Destroy temporary record arguments in the calleeReid Kleckner2013-06-214-5/+78
| | | | | | | | | | | | | | | | | | Itanium destroys them in the caller at the end of the full expression, but MSVC destroys them in the callee. This is further complicated by the need to emit EH-only destructor cleanups in the caller. This should help clang compile MSVC's debug iterators more correctly. There is still an outstanding issue in PR5064 of a memcpy emitted by the LLVM backend, which is not correct for C++ records. Fixes PR16226. Reviewers: rjmccall Differential Revision: http://llvm-reviews.chandlerc.com/D929 llvm-svn: 184543
* Fix all the silly things I committed in r184509David Blaikie2013-06-213-4/+5
| | | | llvm-svn: 184512
* Alternative fix for r184473.David Blaikie2013-06-213-26/+20
| | | | | | | | | | | This just seems a bit tidier/more principled. Based on a patch provided by Adrian - with the only minor tweak that it needed to use "getTypeOrNull" rather than "getCompletedTypeOrNull" since we don't store declarations in the CompletedTypes cache. No intended functionality change. llvm-svn: 184509
* [checked-arithmetic builtins] Added builtins to enable users to perform ↵Michael Gottesman2013-06-201-0/+71
| | | | | | | | | | | | | checked-arithmetic in c. This will enable users in security critical applications to perform checked-arithmetic in a fast safe manner that is amenable to c. Tests/an update to Language Extensions is included as well. rdar://13421498. llvm-svn: 184497
* Fix typo in comment. Patch by Matthew Dempsky!Richard Smith2013-06-201-1/+1
| | | | llvm-svn: 184495
* Call __cxa_begin_catch before std::terminate() in a noexcept trap.John McCall2013-06-201-2/+9
| | | | | | | | | | r174939-40 caused us to do this in the canonical terminate lpad, but when the EH stack has other cleanups on it we use the terminate handler block, which wasn't doing this. Fixes the rest of rdar://11904428 given appropriate stdlib support. llvm-svn: 184475
* Debug Info: Attempt to resolve forward declarations if we are not emittingAdrian Prantl2013-06-201-2/+27
| | | | | | | | | | limited debug info. This is another small addendum to r184252. rdar://problem/14101097 llvm-svn: 184473
* CodeGen: Don't set 'PMBuilder.DisableSimplifyLibCalls'Meador Inge2013-06-201-1/+0
| | | | | | | | | | The simplify-libcalls pass has been removed from LLVM. Thus 'PMBuilder.DisableSimplifyLibCalls' does not exist anymore. The disabling/enabling of library call simplifications is done through the TargetLibraryInfo which is already wired up in Clang. llvm-svn: 184458
* Revert r184205 and associated patches while investigating issue with broken ↵Stephen Lin2013-06-1910-135/+208
| | | | | | | | buildbot (possible interaction with LTO) <rdar://problem/14209661> llvm-svn: 184384
* Debug Info: PR14763/r183329 - specify that non-trivial pass-by-value ↵David Blaikie2013-06-191-0/+3
| | | | | | | | | | parameters are stored indirectly This is to fix the location information for such parameters to refer to the object accessible through the pointer rather than to the pointer parameter itself. llvm-svn: 184367
* Corrections to r184205 ('this'-return optimization) due to the wrong version ↵Stephen Lin2013-06-195-89/+75
| | | | | | | | | of the patch being committed originally. 1) Removed useless return value of CGCXXABI::EmitConstructorCall and CGCXXABI::EmitVirtualDestructorCall and implementations 2) Corrected last portion of CodeGenCXX/constructor-destructor-return-this to correctly test for non-'this'-return of virtual destructor calls llvm-svn: 184330
* [CodeGen] Move EHScopeStack into its own headerReid Kleckner2013-06-193-463/+498
| | | | | | | CGCleanup.h isn't meant to be included by all of CodeGen according to John. llvm-svn: 184321
* [ms-cxxabi] Emit and install appropriately mangled vbtablesReid Kleckner2013-06-199-18/+461
| | | | | | | | | | | | | | | | | | | | | | | | | In Itanium, dynamic classes have one vtable with several different address points for dynamic base classes that can't share vtables. In the MS C++ ABI, each vbtable that can't be shared gets its own symbol, similar to how ctor vtables work in Itanium. However, instead of mangling the subobject offset into the symbol, the unique portions of the inheritance path are mangled into the symbol to make it unique. This patch implements the MSVC 2012 scheme for forming unique vbtable symbol names. MSVC 2010 use the same mangling with a different subset of the path. Implementing that mangling and possibly others is TODO. Each vbtable is an array of i32 offsets from the vbptr that points to it to another virtual base subobject. The first entry of a vbtable always points to the base of the current subobject, implying that it is the same no matter which parent class contains it. Reviewers: rjmccall Differential Revision: http://llvm-reviews.chandlerc.com/D636 llvm-svn: 184309
* Fix a warning. [-Wunused-variable]NAKAMURA Takumi2013-06-191-2/+2
| | | | llvm-svn: 184284
* Debug Info: support for gdwarf-2 gdwarf-3 gdwarf-4Manman Ren2013-06-191-0/+5
| | | | | | | | These options will add a module flag with name "Dwarf Version". The behavior flag is currently set to Warning, so when two values disagree, a warning will be emitted. llvm-svn: 184276
* Add some comments to r184252.Adrian Prantl2013-06-181-0/+5
| | | | | | rdar://problem/14101097 llvm-svn: 184259
* Emit forward decls for structs with declarations only when we areAdrian Prantl2013-06-181-1/+1
| | | | | | | | | | limiting debug info. FIXME: There is still work left to do here, the testcase should work even with -flimit-debug-info. rdar://problem/14101097 llvm-svn: 184252
* [multiprecision-builtins] Added missing builtin __builtin_{add,sub}cb for ↵Michael Gottesman2013-06-181-0/+4
| | | | | | | | | | | | | | {add,sub} with carry for bytes. I have had several people ask me about why this builtin was not available in clang (since it seems like a logical conclusion). This patch implements said builtins. Relevant tests are included as well. I also updated the Clang language extension reference. rdar://14192664. llvm-svn: 184227
* CodeGen: Have 'this'-returning constructors and destructors to take ↵Stephen Lin2013-06-189-175/+116
| | | | | | | | | | advantage of the new backend 'returned' attribute. The backend will now use the generic 'returned' attribute to form tail calls where possible, as well as avoid save-restores of 'this' in some cases (specifically the cases that matter for the ARM C++ ABI). This patch also reverts a prior front-end only partial implementation of these optimizations, since it's no longer required. llvm-svn: 184205
* Add support for -fpcc-struct-return. Patch by Arthur O'Dwyer!John McCall2013-06-181-22/+47
| | | | llvm-svn: 184166
* Remove an ugly hack that was meant to eliminate the breakpoint ambiguityAdrian Prantl2013-06-181-4/+1
| | | | | | | | | | | | | | between a block assignment and the entry of the block function. In reality this wouldn't work anyway because blocks are predominantly created on-the-fly inside of an ObjC method invocation. The proper fix for the ambiguity is to use -gcolumn-info to differentiate the breakpoints. This is expected to break some block-related darwin-gdb tests. rdar://problem/14039866 llvm-svn: 184157
* Compute the visibility of static local variables consistently. Fixes PR16208.Eli Friedman2013-06-171-2/+1
| | | | llvm-svn: 184137
* Cleanup linkage computation for static locals.Rafael Espindola2013-06-171-5/+3
| | | | | | | With this patch we assign VisibleNoLinkage to static locals in inline functions. This lets us simplify CodeGen a bit. llvm-svn: 184114
* Emit initializers for static-storage-duration temporaries as constants whereRichard Smith2013-06-142-16/+43
| | | | | | possible. llvm-svn: 183967
OpenPOWER on IntegriCloud