summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* DebugInfo: Use the preferred location rather than the start location for ↵David Blaikie2015-01-257-6/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | expression line info This causes things like assignment to refer to the '=' rather than the LHS when attributing the store instruction, for example. There were essentially 3 options for this: * The beginning of an expression (this was the behavior prior to this commit). This meant that stepping through subexpressions would bounce around from subexpressions back to the start of the outer expression, etc. (eg: x + y + z would go x, y, x, z, x (the repeated 'x's would be where the actual addition occurred)). * The end of an expression. This seems to be what GCC does /mostly/, and certainly this for function calls. This has the advantage that progress is always 'forwards' (never jumping backwards - except for independent subexpressions if they're evaluated in interesting orders, etc). "x + y + z" would go "x y z" with the additions occurring at y and z after the respective loads. The problem with this is that the user would still have to think fairly hard about precedence to realize which subexpression is being evaluated or which operator overload is being called in, say, an asan backtrace. * The preferred location or 'exprloc'. In this case you get sort of what you'd expect, though it's a bit confusing in its own way due to going 'backwards'. In this case the locations would be: "x y + z +" in lovely postfix arithmetic order. But this does mean that if the op+ were an operator overload, say, and in a backtrace, the backtrace will point to the exact '+' that's being called, not to the end of one of its operands. (actually the operator overload case doesn't work yet for other reasons, but that's being fixed - but this at least gets scalar/complex assignments and other plain operators right) llvm-svn: 227027
* DebugInfo: Correct the line location of geps on array accessesDavid Blaikie2015-01-241-0/+1
| | | | llvm-svn: 227023
* InstrProf: Use an Optional instead of an out parameterJustin Bogner2015-01-241-32/+27
| | | | llvm-svn: 227015
* [PM] Update Clang to reflect the TLI API change in LLVM r226981.Chandler Carruth2015-01-241-8/+9
| | | | llvm-svn: 226982
* InstrProf: Use the stream when dumping countersJustin Bogner2015-01-231-1/+1
| | | | llvm-svn: 226968
* DebugInfo: Remove outdated comment. Column info is no longer needed to ↵David Blaikie2015-01-231-6/+0
| | | | | | differentiate inline callsites. llvm-svn: 226955
* Replace size() calls on containers with empty() calls where appropriate. NFCAlexander Kornienko2015-01-232-2/+2
| | | | | | | | http://reviews.llvm.org/D7090 Patch by Gábor Horváth! llvm-svn: 226914
* [pr22293] Don't crash during codegen of a recursive destructor.Rafael Espindola2015-01-231-1/+1
| | | | | | | | | | | In ItaniumCXXABI::EmitCXXDestructors we first emit the base destructor and then try to emit the complete one as an alias. If in the base ends up calling the complete destructor, the GD for the complete will be in the list of deferred decl by the time we replace it with an alias and delete the original GV. llvm-svn: 226896
* Support ‘omp for’ with static chunked schedule kind.Alexander Musman2015-01-224-2/+108
| | | | | | Differential Revision: http://reviews.llvm.org/D7006 llvm-svn: 226795
* [OPENMP] CodeGen for "omp atomic read [seq_cst]" directive.Alexey Bataev2015-01-222-74/+270
| | | | | | | | | | | | | "omp atomic read [seq_cst]" accepts expressions "v=x;". In this patch we perform an atomic load of "x" (using builtin atomic loading instructions or a call to "atomic_load()" for simple lvalues and "kmpc_atomic_start();load <x>;kmpc_atomic_end();" for other lvalues), convert the result of loading to type of "v" (using EmitScalarConversion() for simple types and EmitComplexToScalarConversion() for conversions from complex to scalar) and then store the result in "v".) Differential Revision: http://reviews.llvm.org/D6431 llvm-svn: 226788
* Revert commit revision 226786Alexey Bataev2015-01-222-269/+74
| | | | | | Need to add initialization of AtomicInfo::EvaluationKind field llvm-svn: 226787
* [OPENMP] CodeGen for "omp atomic read [seq_cst]" directive.Alexey Bataev2015-01-222-74/+269
| | | | | | | | | | | | | "omp atomic read [seq_cst]" accepts expressions "v=x;". In this patch we perform an atomic load of "x" (using builtin atomic loading instructions or a call to "atomic_load()" for simple lvalues and "kmpc_atomic_start();load <x>;kmpc_atomic_end();" for other lvalues), convert the result of loading to type of "v" (using EmitScalarConversion() for simple types and EmitComplexToScalarConversion() for conversions from complex to scalar) and then store the result in "v".) Differential Revision: http://reviews.llvm.org/D6431 llvm-svn: 226786
* Revert commit r226784.Alexey Bataev2015-01-222-269/+74
| | | | | | Accidentally modified file SemaType.cpp must be restored to its original state. llvm-svn: 226785
* [OPENMP] CodeGen for "omp atomic read [seq_cst]" directive.Alexey Bataev2015-01-222-74/+269
| | | | | | | | | | | | | "omp atomic read [seq_cst]" accepts expressions "v=x;". In this patch we perform an atomic load of "x" (using builtin atomic loading instructions or a call to "atomic_load()" for simple lvalues and "kmpc_atomic_start();load <x>;kmpc_atomic_end();" for other lvalues), convert the result of loading to type of "v" (using EmitScalarConversion() for simple types and EmitComplexToScalarConversion() for conversions from complex to scalar) and then store the result in "v". Differential Revision: http://reviews.llvm.org/D6431 llvm-svn: 226784
* SEH: Emit the constant filter 1 as a catch-allReid Kleckner2015-01-221-0/+12
| | | | | | Minor optimization of code like __try { ... } __except(1) { ... }. llvm-svn: 226766
* InstrProf: Avoid creating profile names for symbols in system headersJustin Bogner2015-01-221-2/+1
| | | | | | | | | | We don't emit any coverage mapping for uncovered functions that come from system headers, but we were creating a GlobalVariable with each of their names. This is wasteful since the linker will need to dead strip the unused symbols, and it can lead to issues when merging coverage with others TUs that do have coverage for those functions. llvm-svn: 226764
* Initial support for Win64 SEH IR emissionReid Kleckner2015-01-224-5/+273
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The lowering looks a lot like normal EH lowering, with the exception that the exceptions are caught by executing filter expression code instead of matching typeinfo globals. The filter expressions are outlined into functions which are used in landingpad clauses where typeinfo would normally go. Major aspects that still need work: - Non-call exceptions in __try bodies won't work yet. The plan is to outline the __try block in the frontend to keep things simple. - Filter expressions cannot use local variables until capturing is implemented. - __finally blocks will not run after exceptions. Fixing this requires work in the LLVM SEH preparation pass. The IR lowering looks like this: // C code: bool safe_div(int n, int d, int *r) { __try { *r = normal_div(n, d); } __except(_exception_code() == EXCEPTION_INT_DIVIDE_BY_ZERO) { return false; } return true; } ; LLVM IR: define i32 @filter(i8* %e, i8* %fp) { %ehptrs = bitcast i8* %e to i32** %ehrec = load i32** %ehptrs %code = load i32* %ehrec %matches = icmp eq i32 %code, i32 u0xC0000094 %matches.i32 = zext i1 %matches to i32 ret i32 %matches.i32 } define i1 zeroext @safe_div(i32 %n, i32 %d, i32* %r) { %rr = invoke i32 @normal_div(i32 %n, i32 %d) to label %normal unwind to label %lpad normal: store i32 %rr, i32* %r ret i1 1 lpad: %ehvals = landingpad {i8*, i32} personality i32 (...)* @__C_specific_handler catch i8* bitcast (i32 (i8*, i8*)* @filter to i8*) %ehptr = extractvalue {i8*, i32} %ehvals, i32 0 %sel = extractvalue {i8*, i32} %ehvals, i32 1 %filter_sel = call i32 @llvm.eh.seh.typeid.for(i8* bitcast (i32 (i8*, i8*)* @filter to i8*)) %matches = icmp eq i32 %sel, %filter_sel br i1 %matches, label %eh.except, label %eh.resume eh.except: ret i1 false eh.resume: resume } Reviewers: rjmccall, rsmith, majnemer Differential Revision: http://reviews.llvm.org/D5607 llvm-svn: 226760
* Emit DeferredDeclsToEmit in a DFS order.Rafael Espindola2015-01-221-14/+26
| | | | | | | | | | | | | | Currently we emit DeferredDeclsToEmit in reverse order. This patch changes that. The advantages of the change are that * The output order is a bit closer to the source order. The change to test/CodeGenCXX/pod-member-memcpys.cpp is a good example. * If we decide to deffer more, it will not cause as large changes in the estcases as it would without this patch. llvm-svn: 226751
* DebugInfo: Remove forced column-info workaround for inlined callsDavid Blaikie2015-01-215-32/+12
| | | | | | | | | | | | | | | | | This workaround was to provide unique call sites to ensure LLVM's inline debug info handling would properly unique two calls to the same function on the same line. Instead, this has now been fixed in LLVM (r226736) and the workaround here can be removed. Originally committed in r176895, but this isn't a straight revert due to all the changes since then. I just searched for anything ForcedColumn* related and removed them. We could test this - but it didn't strike me as terribly valuable once we're no longer adding this workaround everything just works as expected & it's no longer a special case to test for. llvm-svn: 226738
* Add the "thunk" attribute to MS ABI virtual member pointersReid Kleckner2015-01-211-0/+6
| | | | | | | | | | | | | | | | This attribute implies indicates that the function musttail calls another function and returns whatever it returns. The return type of the thunk is meaningless, as the thunk can dynamically call different functions with different return types. So long as the callers bitcast the thunk with the correct type, behavior is well defined. This attribute was necessary to fix PR20944, where the indirect call combiner noticed that the thunk returned void and replaced the results of the indirect call instruction with undef. Over-the-shoulder reviewed by David Majnemer. llvm-svn: 226707
* clang-format function. NFC.Rafael Espindola2015-01-211-2/+2
| | | | llvm-svn: 226662
* MS ABI: Virtual member pointer thunks should be in COMDAT groupsDavid Majnemer2015-01-211-0/+2
| | | | | | | They can be emitted by multiple translation units and thus belong in a COMDAT group. llvm-svn: 226630
* MS ABI: Let guard variables be present in COMDATsDavid Majnemer2015-01-211-0/+3
| | | | | | A guard variable in a COMDAT'd function should also be in a COMDAT. llvm-svn: 226629
* CodeGen: Compiler generated __declspec(uuid) objects should be COMDAT'dDavid Majnemer2015-01-211-0/+2
| | | | llvm-svn: 226628
* Implement command line options for stack probe spaceHans Wennborg2015-01-201-0/+33
| | | | | | | | | | | | | This code adds the -mstack-probe-size command line option and implements the /Gs compiler switch for clang-cl. This should fix http://llvm.org/bugs/show_bug.cgi?id=21896 Patch by Andrew H! Differential Revision: http://reviews.llvm.org/D6685 llvm-svn: 226601
* Re-apply "r226548 - Introduce SPIR calling conventions" reverted in r226558.Alexander Kornienko2015-01-201-0/+2
| | | | | | | | | | | | | | | | | | | | | | | The test was fixed after a discussion with the revision author: the check pattern was made more flexible as the "%call" part is not what we actually want to check strictly there. The original patch description: === Introduce SPIR calling conventions. This implements Section 3.7 from the SPIR 1.2 spec: SPIR kernels should use "spir_kernel" calling convention. Non-kernel functions use "spir_func" calling convention. All other calling conventions are disallowed. The patch works only for OpenCL source. Any other uses will need to ensure that kernels are assigned the spir_kernel calling convention correctly. === llvm-svn: 226561
* Reverting r226548 as one of the tests fails in some configurations.Alexander Kornienko2015-01-201-2/+0
| | | | | | | | | | | | | | | | | | | | | | Here's the fail log from our internal setup: === .../tools/clang/clang -cc1 -internal-isystem .../tools/clang/staging/include -nostdsysteminc .../tools/clang/test/CodeGenOpenCL/spir-calling-conv.cl -triple spir-unknown-unknown -emit-llvm -o - FileCheck .../tools/clang/test/CodeGenOpenCL/spir-calling-conv.cl .../tools/clang/test/CodeGenOpenCL/spir-calling-conv.cl:11:12: error: expected string not found in input // CHECK: %call = tail call spir_func i32 @get_dummy_id(i32 0) ^ <stdin>:6:52: note: scanning from here define spir_kernel void @foo(i32 addrspace(1)* %A) #0 { ^ <stdin>:7:2: note: possible intended match here %1 = tail call spir_func i32 @get_dummy_id(i32 0) #2 ^ === Here's a failure on a public CI server: http://lab.llvm.org:8080/green/job/clang-stage2-configure-Rlto_check/1183/ llvm-svn: 226558
* Introduce SPIR calling conventions.Sameer Sahasrabuddhe2015-01-201-0/+2
| | | | | | | | | | | | | | This implements Section 3.7 from the SPIR 1.2 spec: SPIR kernels should use "spir_kernel" calling convention. Non-kernel functions use "spir_func" calling convention. All other calling conventions are disallowed. The patch works only for OpenCL source. Any other uses will need to ensure that kernels are assigned the spir_kernel calling convention correctly. llvm-svn: 226548
* CodeGen: Update LoopAttributes for LLVM API changeDuncan P. N. Exon Smith2015-01-191-3/+2
| | | | | | `MDNode::getTemporary()` returns a `unique_ptr<>` as of r226504. llvm-svn: 226505
* Migrate all uses of DIVariable's FlagIndirectVariable to use a DIExpressionAdrian Prantl2015-01-191-11/+12
| | | | | | with a DW_OP_deref instead. llvm-svn: 226474
* Add comdat to thunks.Rafael Espindola2015-01-191-1/+4
| | | | llvm-svn: 226465
* Add comment after API changes in r225090David Blaikie2015-01-181-2/+4
| | | | | | Code review suggestion by Eric Christopher. llvm-svn: 226395
* DebugInfo: Attribute complex expressions to the source location of the ↵David Blaikie2015-01-181-0/+1
| | | | | | | | | expression Just as r225956 did for scalar expressions (CGExprScalar::Visit), do the same for complex expressions. llvm-svn: 226390
* DebugInfo: Attribute aggregate expressions to the source location of the ↵David Blaikie2015-01-181-0/+5
| | | | | | | | | expression Just as r225956 did for scalar expressions (CGExprScalar::Visit), do the same for aggregate expressions. llvm-svn: 226388
* Recommit r225083 (reverted in r225361) now that calls to aggregate ↵David Blaikie2015-01-182-11/+0
| | | | | | | | | | | | | | | | | | | initializers from in class non-static data members are explicitly attributed to the desired line. The code setting the debug location being removed here was accidentally leaking a location into the call to the non-static data member's ctor call. Without it the call had no location and could cause assertion failures if it was inlined. Now that it has a location (and a correct one at that) this code should hopefully be no longer needed. It's possible of course that other parts of the debug info are also relying on the debug locations being set here to leak to where they're needed - so we might see the same assertions again & will have to investigate what the dependence was/is. But the chances are good that any of those are debug info line table quality bugs we've just not found yet anyway - so it'll be good to flush them out. llvm-svn: 226383
* DebugInfo: Correct the debug location of non-static data member initializersDavid Blaikie2015-01-181-2/+1
| | | | | | | | | | This was causing some trouble for otherwise dead code removed in r225085 (reverted in r225361). The location being set for function arguments was leaking out to the call which wasn't setting its own location (so a quality bug turned into a crasher with r225085). Fix this so r225085 can be recommitted. llvm-svn: 226382
* Wrap to 80 columns. No behavior change.Nico Weber2015-01-171-1/+2
| | | | llvm-svn: 226364
* Make sure all weak destructors go in a comdat in the ms abi.Rafael Espindola2015-01-171-1/+2
| | | | | | | Destructors have a special treatment in getFunctionLinkage. Instead of duplicating the logic, check the resulting linkage. llvm-svn: 226361
* Also put vtables in a comdat when rtti is disabled.Rafael Espindola2015-01-161-0/+4
| | | | llvm-svn: 226325
* Add comdat to string literal variables on COFF.Rafael Espindola2015-01-161-2/+8
| | | | llvm-svn: 226317
* Add comdats to the RTTI variables in the microsoft abi.Rafael Espindola2015-01-161-7/+16
| | | | llvm-svn: 226303
* Add comdats to dynamic init functions in the microsoft abi.Rafael Espindola2015-01-161-1/+3
| | | | llvm-svn: 226286
* Add comdats to constructs and destructor in the microsoft abi.Rafael Espindola2015-01-161-2/+4
| | | | llvm-svn: 226280
* Use a trivial comdat for C++ tables.Rafael Espindola2015-01-153-3/+16
| | | | | | | | | This produces comdats for vtables, typeinfo, typeinfo names, and vtts. When combined with llvm not producing implicit comdats, not doing this would cause code bloat on ELF and link errors on COFF. llvm-svn: 226227
* Use a trivial comdat for inline ctor/dtor when not using C5/D5.Rafael Espindola2015-01-153-4/+12
| | | | | | | When combined with llvm not producing implicit comdats, not doing this would cause code bloat on ELF and link errors on COFF. llvm-svn: 226211
* [PM] Track an LLVM API update which separates the TargetLibraryInfoChandler Carruth2015-01-151-1/+2
| | | | | | | | | | object from the pass that provides access to it. We should probably refactor the createTLI code here in Clang in light of the new structure, but I wanted this patch to be a minimal one that just patches the behavior back together. llvm-svn: 226158
* [CMake] clangCodeGen: Prune a redundant "Target" out of libdeps. It is ↵NAKAMURA Takumi2015-01-151-1/+0
| | | | | | supplied by Analysis. llvm-svn: 226152
* [CMake] Update libdeps on clangCodeGen, corresponding to r226079.NAKAMURA Takumi2015-01-151-0/+1
| | | | llvm-svn: 226142
* Remove unused parameter, followup to r179639. No behavior change.Nico Weber2015-01-152-3/+1
| | | | llvm-svn: 226128
* Remove ASTConsumer::HandleVTable()'s bool parameter.Nico Weber2015-01-154-17/+11
| | | | | | | | | | | Sema calls HandleVTable() with a bool parameter which is then threaded through three layers. The only effect of this bool is an early return at the last layer. Instead, remove this parameter and call HandleVTable() only if the bool is true. No intended behavior change. llvm-svn: 226096
OpenPOWER on IntegriCloud