summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
* Better codegen support for DLL attributes being dropped after the first ↵Hans Wennborg2014-08-291-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | declaration (PR20792) For the following code: __declspec(dllimport) int f(int x); int user(int x) { return f(x); } int f(int x) { return 1; } Clang will drop the dllimport attribute in the AST, but CodeGen would have already put it on the LLVM::Function, and that would never get updated. (The same thing happens for global variables.) This makes Clang check dropped DLL attribute case each time the LLVM object is referenced. This isn't perfect, because we will still get it wrong if the function is never referenced by codegen after the attribute is dropped, but this handles the common cases and makes us not fail in the verifier. llvm-svn: 216699
* Reverting r216675. This breaks some bots. Before this can be committed ↵Aaron Ballman2014-08-284-58/+7
| | | | | | again, I have to explore runtime ABI requirements with libc++abi. llvm-svn: 216677
* Objective-C IRGen. Fixes an assertion crash caused by inconsistentFariborz Jahanian2014-08-281-2/+1
| | | | | | | | linkage related to generation of OBJC_SELECTOR_REFERENCES symbol needed in generation of call to 'super' in a class method. // rdar://18150301 llvm-svn: 216676
* Throw a std::bad_array_new_length exception when the expression (or ↵Aaron Ballman2014-08-284-7/+58
| | | | | | constant-expression) passed to operator new[] results in overflow in conformance with [expr.new]p7. Fixes PR11644. llvm-svn: 216675
* [C++11] Support for capturing of variable length arrays in lambda expression.Alexey Bataev2014-08-283-9/+20
| | | | | | Differential Revision: http://reviews.llvm.org/D4368 llvm-svn: 216649
* Properly handle multiple nonnull attributes in CodeGenAlexey Samsonov2014-08-281-15/+25
| | | | llvm-svn: 216638
* Kill one of EmitCallArgs overloads. NFC.Alexey Samsonov2014-08-284-54/+38
| | | | llvm-svn: 216635
* Update for LLVM api change.Rafael Espindola2014-08-271-4/+4
| | | | llvm-svn: 216585
* Fix regression in r216520: don't apply nonnull to non-pointer functionRichard Smith2014-08-271-2/+11
| | | | | | parameters in the IR. llvm-svn: 216574
* Allow __fp16 as a function arg or return type for AArch64Oliver Stannard2014-08-274-25/+43
| | | | | | | | | | | ACLE 2.0 allows __fp16 to be used as a function argument or return type. This enables this for AArch64. This also fixes an existing bug that causes clang to not allow homogeneous floating-point aggregates with a base type of __fp16. This is valid for AAPCS64, but not for AAPCS-VFP. llvm-svn: 216558
* Move some ARM-specific code from CGCall.cpp to TargetInfo.cppOliver Stannard2014-08-272-55/+45
| | | | | | | | | This tidies up some ARM-specific code added by r208417 to move it out of the target-independent parts of clang into TargetInfo.cpp. This also has the advantage that we can now flatten struct arguments to variadic AAPCS functions. llvm-svn: 216535
* Simplify creation of a bunch of ArrayRefs by using None, makeArrayRef or ↵Craig Topper2014-08-279-29/+22
| | | | | | just letting them be implicitly created. llvm-svn: 216528
* Fix some cases were ArrayRefs were being passed by reference.Craig Topper2014-08-272-10/+10
| | | | llvm-svn: 216527
* Re-apply r216491 (Win64 ABI shouldn't extend integer type arguments.)Julien Lerouge2014-08-271-1/+4
| | | | | | | | | This time though, preserve the extension for bool types since that's compatible with what MSVC expects. See http://reviews.llvm.org/D4380 llvm-svn: 216507
* Revert 216491, it breaks CodeGenCXX/microsoft-abi-member-pointers.cppJulien Lerouge2014-08-261-0/+3
| | | | llvm-svn: 216496
* Don't segfault in EmitCXXGlobalInitFunc when main file is a membufKeno Fischer2014-08-261-6/+12
| | | | | | | | | | | | | | Summary: When the main file is created from a membuffer, there is no file entry that can be retrieved. This uses "__GLOBAL_I_a" in that case which is what was always used before r208128. Reviewers: majnemer, thakis Reviewed By: thakis Subscribers: yaron.keren, rsmith, cfe-commits Differential Revision: http://reviews.llvm.org/D5043 llvm-svn: 216495
* Update for llvm api change.Rafael Espindola2014-08-261-2/+1
| | | | llvm-svn: 216493
* Win64 ABI shouldn't extend integer type arguments.Julien Lerouge2014-08-261-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: MSVC doesn't extend integer types smaller than 64bit, so to preserve binary compatibility, clang shouldn't either. For example, the following C code built with MSVC: unsigned test(unsigned v); unsigned foobar(unsigned short); int main() { return test(0xffffffff) + foobar(28); } Produces the following: 0000000000000004: B9 FF FF FF FF mov ecx,0FFFFFFFFh 0000000000000009: E8 00 00 00 00 call test 000000000000000E: 89 44 24 20 mov dword ptr [rsp+20h],eax 0000000000000012: 66 B9 1C 00 mov cx,1Ch 0000000000000016: E8 00 00 00 00 call foobar And as you can see, when setting up the call to foobar, only cx is overwritten. If foobar is compiled with clang, then the zero extension added by clang means the rest of the register, which contains garbage, could be used. For example if foobar is: unsigned foobar(unsigned short v) { return v; } Compiled with clang -fomit-frame-pointer -O3 gives the following assembly: foobar: 0000000000000000: 89 C8 mov eax,ecx 0000000000000002: C3 ret And that function would return garbage because the 16 most significant bits of ecx still contain garbage from the first call. With this change, the code for that function is now: foobar: 0000000000000000: 0F B7 C1 movzx eax,cx 0000000000000003: C3 ret Reviewers: chapuni, rnk Reviewed By: rnk Subscribers: majnemer, cfe-commits Differential Revision: http://reviews.llvm.org/D4380 llvm-svn: 216491
* Update for llvm api changeRafael Espindola2014-08-261-1/+1
| | | | llvm-svn: 216489
* Fix an incorrect assert condition added in r216410.Alexey Samsonov2014-08-261-1/+1
| | | | llvm-svn: 216479
* Return a std::unique_ptr from getBufferForFile. NFC.Rafael Espindola2014-08-261-2/+3
| | | | llvm-svn: 216476
* Convert MC command line flag for fatal assembler warnings into a properJoerg Sonnenberger2014-08-261-0/+1
| | | | | | flag. llvm-svn: 216472
* Update for llvm api change.Rafael Espindola2014-08-261-1/+1
| | | | llvm-svn: 216467
* ARM: Add dbg builtin intrinsicYi Kong2014-08-261-0/+5
| | | | llvm-svn: 216452
* [clang/asan] call __asan_poison_cxx_array_cookie after operator new[]Kostya Serebryany2014-08-264-10/+27
| | | | | | | | | | | | | | | | | | | | Summary: PR19838 When operator new[] is called and an array cookie is created we want asan to detect buffer overflow bugs that touch the cookie. For that we need to a) poison the shadow for the array cookie (call __asan_poison_cxx_array_cookie). b) ignore the legal accesses to the cookie generated by clang (add 'nosanitize' metadata) Reviewers: timurrrr, samsonov, rsmith Reviewed By: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D4774 llvm-svn: 216434
* Pass actual CXXConstructExpr instead of argument iteratorsAlexey Samsonov2014-08-253-12/+10
| | | | | | into EmitSynthesizedCXXCopyCtorCall. No functionality change. llvm-svn: 216410
* Pass actual CallExpr instead of CallExpr-specific iteratorsAlexey Samsonov2014-08-255-54/+59
| | | | | | | | | | | into EmitCXXMemberOrOperatorCall methods. In the end we want to make declaration visible in EmitCallArgs() method, that would allow us to alter CodeGen depending on function/parameter attributes. No functionality change. llvm-svn: 216404
* Implement __builtin_signbitl for PowerPCHal Finkel2014-08-241-2/+8
| | | | | | | | | | | PowerPC uses the special PPC_FP128 type for long double on Linux, which is composed of two 64-bit doubles. The higher-order double (which contains the overall sign) comes first, and so the __builtin_signbitl implementation requires special handling to extract the sign bit. Fixes PR20691. llvm-svn: 216341
* DebugInfo: for loop backedge should be attributed to the start of the for ↵David Blaikie2014-08-221-0/+2
| | | | | | | | | | | | | | | | statement. Similar to r215768 (which fixed the same case for while loops). To quote r215768's commit message: "A little test case simplification - this could be simplified further, though there are certainly interesting connections to the if/else construct so I'm hesitant to remove that entirely though it does appear somewhat unrelated. (similar fix to r215766, related to PR19864)" llvm-svn: 216297
* DebugInfo: Provide scopes for C++11 range-for loop variables similar to ↵David Blaikie2014-08-221-9/+2
| | | | | | r216288 (which was for plain-for loop condition variables). llvm-svn: 216291
* DebugInfo: Scope for condition variables more narrowly than the loop variable.David Blaikie2014-08-222-10/+3
| | | | | | | | for loops introduce two scopes - one for the outer loop variable and its initialization, and another for the body of the loop, including any variable declared inside the loop condition. llvm-svn: 216288
* CGCall: Factor out the logic mapping call arguments to LLVM IR arguments.Alexey Samsonov2014-08-222-235/+323
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This refactoring introduces ClangToLLVMArgMapping class, which encapsulates the information about the order in which function arguments listed in CGFunctionInfo should be passed to actual LLVM IR function, such as: 1) positions of sret, if there is any 2) position of inalloca argument, if there is any 3) position of helper padding argument for each call argument 4) positions of regular argument (there can be many if it's expanded). Simplify several related methods (ConstructAttributeList, EmitFunctionProlog and EmitCall): now they don't have to maintain iterators over the list of LLVM IR function arguments, dealing with all the sret/inalloca/this complexities, and just use expected positions of LLVM IR arguments stored in ClangToLLVMArgMapping. This may increase the running time of EmitFunctionProlog, as we have to traverse expandable arguments twice, but in further refactoring we will be able to speed up EmitCall by passing already calculated CallArgsToIRArgsMapping to ConstructAttributeList, thus avoiding traversing expandable argument there. No functionality change. Test Plan: regression test suite Reviewers: majnemer, rnk Reviewed By: rnk Subscribers: cfe-commits, rjmccall, timurrrr Differential Revision: http://reviews.llvm.org/D4938 llvm-svn: 216251
* Update for LLVM API change to remove discriminator tracking from ↵David Blaikie2014-08-211-2/+1
| | | | | | DILexicalBlock (in favor of DILexicalBlockFile - where a default arg is used to avoid the need for API churn of those callers) llvm-svn: 216240
* Pass expressions instead of argument ranges to EmitCall/EmitCXXConstructorCall.Alexey Samsonov2014-08-216-64/+41
| | | | | | | | | | | | | | | | | | | | | | | Summary: This is a first small step towards passing generic "Expr" instead of ArgBeg/ArgEnd pair into EmitCallArgs() family of methods. Having "Expr" will allow us to get the corresponding FunctionDecl and its ParmVarDecls, thus allowing us to alter CodeGen depending on the function/parameter attributes. No functionality change. Test Plan: regression test suite Reviewers: rnk Reviewed By: rnk Subscribers: aemerson, cfe-commits Differential Revision: http://reviews.llvm.org/D4915 llvm-svn: 216214
* Coverage Mapping: store function's hash in coverage function records.Alex Lorenz2014-08-213-5/+8
| | | | | | | | | | The profile data format was recently updated and the new indexing api requires the code coverage tool to know the function's hash as well as the function's name to get the execution counts for a function. Differential Revision: http://reviews.llvm.org/D4995 llvm-svn: 216208
* Refactor TLI creation. NFC.Rafael Espindola2014-08-211-7/+10
| | | | llvm-svn: 216198
* Range'ify some for loops over RecordDecl::fields()Hans Wennborg2014-08-211-8/+7
| | | | | | No functionality change. llvm-svn: 216183
* Coverage mapping: fix mapping for objective-c for statementAlex Lorenz2014-08-201-0/+1
| | | | llvm-svn: 216082
* Coverage mapping: fix mapping for objective-c message expressionAlex Lorenz2014-08-201-0/+10
| | | | llvm-svn: 216081
* ext_vector IRGen. Patch to allow indexing into Fariborz Jahanian2014-08-192-3/+37
| | | | | | | ext_vector_type's 'hi/lo' components when used as lvalue. rdar://18031917 pr20697 llvm-svn: 215991
* Move the body out of line to try to fix a buildbot.Rafael Espindola2014-08-191-0/+4
| | | | llvm-svn: 215980
* Update for llvm api change.Rafael Espindola2014-08-191-2/+0
| | | | llvm-svn: 215968
* DebugInfo: While loop backedge should be attribute to the start of the while ↵David Blaikie2014-08-151-0/+1
| | | | | | | | | | | | | statement. A little test case simplification - this could be simplified further, though there are certainly interesting connections to the if/else construct so I'm hesitant to remove that entirely though it does appear somewhat unrelated. (similar fix to r215766, related to PR19864) llvm-svn: 215768
* DebugInfo: Fix PR19864 better - attribute the jump at the end of a range-for ↵David Blaikie2014-08-151-0/+1
| | | | | | | | | | | | | | | loop, to the start of the loop. This avoids debuggers stepping to strange places (like the last statement in the loop body, or the first statement in the if). This is not the whole answer, though - similar bugs no doubt exist in other loops (patches to follow) and attributing exception handling code to the correct line is also tricky (based on the previous fix to PR19864, exception handling is still erroneously attributed to the 'if' line). llvm-svn: 215766
* Typo fix in comments: definintion -> definitionJames Dennett2014-08-151-1/+1
| | | | llvm-svn: 215764
* MS ABI: Virtual member pointer thunks are not unnamed_addrReid Kleckner2014-08-151-0/+3
| | | | | | They can be compared for identity. llvm-svn: 215745
* R600: Add ldexp intrinsicMatt Arsenault2014-08-151-6/+16
| | | | llvm-svn: 215738
* Revert "CodeGen: When bitfields fall on natural boundaries, split them up"Justin Bogner2014-08-141-9/+2
| | | | | | | | | | | | | | | It fits better with LLVM's memory model to try to do this in the backend. Specifically, narrowing wide loads in the backends should be relatively straightforward and is generally valuable, whereas widening loads tends to be very constrained. Discussion here: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20140811/112581.html This reverts commit r215614. llvm-svn: 215648
* Delete support for AuroraUX.Rafael Espindola2014-08-141-1/+0
| | | | | | auroraux.org is not resolving. llvm-svn: 215644
* Fix a crash when compiling blocks in OpenCL with multiplePekka Jaaskelainen2014-08-141-1/+7
| | | | | | address spaces. llvm-svn: 215629
OpenPOWER on IntegriCloud