summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
* vdup_lane was missingNate Begeman2010-08-062-2/+11
| | | | | | <rdar://problem/8278732> llvm-svn: 110420
* Attempt to fix uninitialized value warning reported on cfe-commits.Eli Friedman2010-08-061-2/+1
| | | | llvm-svn: 110418
* Don't crash when mangling empty anonymous unions. We never actually *need*John McCall2010-08-051-1/+5
| | | | | | | these, but it's convenient to mangle them when deferring them (in the 99.99% case where it's not an anonymous union, of course). llvm-svn: 110381
* Add support for block imported struct variable layout info.Fariborz Jahanian2010-08-051-2/+10
| | | | | | (objc gc and blocks in NeXt runtime). llvm-svn: 110377
* It turns out that linkers (at least, the Darwin linker) don't necessarilyJohn McCall2010-08-052-16/+19
| | | | | | | | | | | do the right thing with mixed-visibility symbols, so disable the visibility optimization where that's possible, i.e. with template classes (since it's possible that an arbitrary template might be subject to an explicit instantiation elsewhere). 447.dealII actually does this. I've put the code under an option that's currently not hooked up to anything. llvm-svn: 110374
* Argument evaluation order is not guaranteed. Split these out to force an order.John McCall2010-08-051-6/+7
| | | | llvm-svn: 110354
* Fix a major bug with -ftrapv and ++/--. Patch by David Keaton!John McCall2010-08-051-1/+2
| | | | llvm-svn: 110347
* For now skip over aggregate non-byref block variables.Fariborz Jahanian2010-08-051-1/+4
| | | | | | (objc gc specific). llvm-svn: 110340
* Trying to unbreak buildbot.Fariborz Jahanian2010-08-051-1/+2
| | | | llvm-svn: 110339
* Add IRGen support for non-constant OffsetOfExpr.Eli Friedman2010-08-051-14/+90
| | | | llvm-svn: 110326
* Implement #pragma GCC visibility.Eli Friedman2010-08-051-2/+4
| | | | llvm-svn: 110315
* Clean up of my last patch.Fariborz Jahanian2010-08-051-13/+16
| | | | llvm-svn: 110290
* Block variable layout bitmap API generation.Fariborz Jahanian2010-08-041-80/+136
| | | | llvm-svn: 110287
* Extend the visibility-hidden optimization to linkonce_odr thunks forJohn McCall2010-08-041-1/+51
| | | | | | | | | functions with in-line definitions, since such thunks will be emitted at any use of the function. Completes the feature work for rdar://problem/7523229. llvm-svn: 110285
* More objc block variable layout info. work.Fariborz Jahanian2010-08-043-9/+26
| | | | llvm-svn: 110239
* Some early work for providing block layout info. Fariborz Jahanian2010-08-045-40/+57
| | | | | | for objective-c/c++ blocks (NeXt runtime). llvm-svn: 110213
* Emit standard-library RTTI with external linkage, not weak_odr.John McCall2010-08-044-45/+90
| | | | | | | | | | Apply hidden visibility to most RTTI; libstdc++ does not rely on exact pointer equality for the type info (just the type info names). Apply the same optimization to RTTI that we do to vtables. Fixes PR5962. llvm-svn: 110192
* Extend the hidden-visibility vtables optimization to template classes thatJohn McCall2010-08-041-10/+26
| | | | | | haven't been explicitly instantiated. llvm-svn: 110189
* Some more correctness fixes and code-size optimizations for fragile-ABIJohn McCall2010-08-041-80/+93
| | | | | | | | | | | ObjC exceptions: - don't enter a try for the catch blocks unless there's a finally - put the setjmp buffer in the locals set for liveness reasons - dump the sync object into an alloca in the locals set for liveness reasons Some of this can go away if the backend starts to properly calculate liveness in the presence of setjmp (which would also be a *much* stabler solution). llvm-svn: 110188
* Do a very simple pass over every function we emit to infer whether we canJohn McCall2010-08-031-0/+18
| | | | | | | mark it nounwind based on whether it contains any non-nounwind calls. <rdar://problem/8087431> llvm-svn: 110163
* Add support for VFP status & control operations for ARM.Nate Begeman2010-08-031-3/+19
| | | | llvm-svn: 110153
* Emit weak vtables of non-template classes with hidden visibility.John McCall2010-08-031-0/+16
| | | | llvm-svn: 110107
* Further adjustments to -Wglobal-constructors; works for references and directJohn McCall2010-08-021-2/+2
| | | | | | initializations now. llvm-svn: 110063
* Fix fragile-ABI ObjC exceptions in the presence of optimization withJohn McCall2010-07-311-3/+165
| | | | | | | | | the magic of inline assembly. Essentially we use read and write hazards on the set of local variables to force flushing locals to memory immediately before any protected calls and to inhibit optimizing locals across the setjmp->catch edge. Fixes rdar://problem/8160285 llvm-svn: 109960
* Emit global destructors even if the destroyed object has no initializers or hasJohn McCall2010-07-301-7/+3
| | | | | | | | an initializer requiring temporary object disposal. Fixes rdar:://problem/8246444. llvm-svn: 109849
* fix PR5179 and correctly fix PR5831 to not miscompile.Chris Lattner2010-07-303-42/+111
| | | | | | | | | | | | | | | | | | | | The X86-64 ABI code didn't handle the case when a struct would get classified and turn up as "NoClass INTEGER" for example. This is perfectly possible when the first slot is all padding (e.g. due to empty base classes). In this situation, the first 8-byte doesn't take a register at all, only the second 8-byte does. This fixes this by enhancing the x86-64 abi stuff to allow and handle this case, reverts the broken fix for PR5831, and enhances the target independent stuff to be able to handle an argument value in registers being accessed at an offset from the memory value. This is the last x86-64 calling convention related miscompile that I'm aware of. llvm-svn: 109848
* Revert "Re-apply fixed version of 108749, correctly conditionalizing the newDaniel Dunbar2010-07-291-15/+5
| | | | | | | sections on", this change uncovered a possible linker bug which resulted in the wrong messages getting dispatched. Backing this out while we investigate... llvm-svn: 109817
* Wire up sema checking for __builtin_arm_usat and __builtin_arm_ssat immediates.Nate Begeman2010-07-291-1/+1
| | | | llvm-svn: 109814
* move the last hunk of getCoerceResult into the placeChris Lattner2010-07-292-34/+29
| | | | | | that needs it and remove getCoerceResult. llvm-svn: 109807
* now that direct and coerce are merged, getCoerceResult gets simpler.Chris Lattner2010-07-291-5/+0
| | | | llvm-svn: 109805
* now that GetSSETypeAtOffset handles passing SSE class values asChris Lattner2010-07-291-14/+0
| | | | | | float, the special case hack in getCoerceResult can go away. llvm-svn: 109804
* Change the name to something less terrible; suggestion by Doug. No ↵Argyrios Kyrtzidis2010-07-291-1/+1
| | | | | | functionality change. llvm-svn: 109797
* Implement the clang-side of detection for when to pass asChris Lattner2010-07-291-3/+39
| | | | | | | | <2 x float> instead of double. This works but can't be turned on until I teach codegen to pass <2 x float> as one XMM register instead of two. llvm-svn: 109790
* Look at me, I can count!Chris Lattner2010-07-291-1/+1
| | | | llvm-svn: 109786
* Merge PCHWriterDecl.cpp's isRequiredDecl and ↵Argyrios Kyrtzidis2010-07-292-163/+5
| | | | | | | | | | | | | | | CodeGenModule::MayDeferGeneration into a new function, DeclIsRequiredFunctionOrFileScopedVar. This is essentially a CodeGen predicate that is also needed by the PCH mechanism to determine whether a decl needs to be deserialized during PCH loading for codegen purposes. Since this logic is shared by CodeGen and the PCH mechanism, move it to the ASTContext, thus CodeGenModule's GetLinkageForFunction/GetLinkageForVariable and the GVALinkage enum is moved out of CodeGen. This fixes current (and avoids future) codegen-from-PCH bugs. llvm-svn: 109784
* fix rdar://8251384, another case where we could access beyond theChris Lattner2010-07-291-21/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | end of a struct. This improves the case when the struct being passed contains 3 floats, either due to a struct or array of 3 things. Before we'd generate this IR for the testcase: define float @bar(double %X.coerce0, double %X.coerce1) nounwind { entry: %X = alloca %struct.foof, align 8 ; <%struct.foof*> [#uses=2] %0 = bitcast %struct.foof* %X to %1* ; <%1*> [#uses=2] %1 = getelementptr %1* %0, i32 0, i32 0 ; <double*> [#uses=1] store double %X.coerce0, double* %1 %2 = getelementptr %1* %0, i32 0, i32 1 ; <double*> [#uses=1] store double %X.coerce1, double* %2 %tmp = getelementptr inbounds %struct.foof* %X, i32 0, i32 2 ; <float*> [#uses=1] %tmp1 = load float* %tmp ; <float> [#uses=1] ret float %tmp1 } which compiled (with optimization) to: _bar: ## @bar ## BB#0: ## %entry movd %xmm1, %rax movd %eax, %xmm0 ret Now we produce: define float @bar(double %X.coerce0, float %X.coerce1) nounwind { entry: %X = alloca %struct.foof, align 8 ; <%struct.foof*> [#uses=2] %0 = bitcast %struct.foof* %X to %0* ; <%0*> [#uses=2] %1 = getelementptr %0* %0, i32 0, i32 0 ; <double*> [#uses=1] store double %X.coerce0, double* %1 %2 = getelementptr %0* %0, i32 0, i32 1 ; <float*> [#uses=1] store float %X.coerce1, float* %2 %tmp = getelementptr inbounds %struct.foof* %X, i32 0, i32 2 ; <float*> [#uses=1] %tmp1 = load float* %tmp ; <float> [#uses=1] ret float %tmp1 } and: _bar: ## @bar ## BB#0: ## %entry movaps %xmm1, %xmm0 ret llvm-svn: 109776
* start setting up infrastructure for passing multi-floatsChris Lattner2010-07-291-15/+33
| | | | | | | as <2 x float> instead of as double. The backend isn't ready yet, but infrastructure in the frontend can come up. llvm-svn: 109768
* rename Get8ByteTypeAtOffset -> GetINTEGERTypeAtOffset toChris Lattner2010-07-291-17/+18
| | | | | | | make it clear that this function should only return a type that the codegen will classify the same as an INTEGER type. llvm-svn: 109763
* handle a case where we could access off the end of a functionChris Lattner2010-07-291-9/+6
| | | | | | that Eli pointed out, rdar://8249586 llvm-svn: 109762
* fix PR7742 / rdar://8250764, a miscompilation of structChris Lattner2010-07-291-2/+3
| | | | | | | | | | | return where the struct has a base but no fields. This was because the x86-64 abi logic was checking the wrong predicate in one place. This was introduced in r91874, which was a fix for PR5831, which lacked a CHECK line, so I verified and added it. llvm-svn: 109759
* This is a little bit far, but optimize cases like:Chris Lattner2010-07-291-3/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | struct a { struct c { double x; int y; } x[1]; }; void foo(struct a A) { } into: define void @foo(double %A.coerce0, i32 %A.coerce1) nounwind { entry: %A = alloca %struct.a, align 8 ; <%struct.a*> [#uses=1] %0 = bitcast %struct.a* %A to %struct.c* ; <%struct.c*> [#uses=2] %1 = getelementptr %struct.c* %0, i32 0, i32 0 ; <double*> [#uses=1] store double %A.coerce0, double* %1 %2 = getelementptr %struct.c* %0, i32 0, i32 1 ; <i32*> [#uses=1] store i32 %A.coerce1, i32* %2 instead of: define void @foo(double %A.coerce0, i64 %A.coerce1) nounwind { entry: %A = alloca %struct.a, align 8 ; <%struct.a*> [#uses=1] %0 = bitcast %struct.a* %A to %0* ; <%0*> [#uses=2] %1 = getelementptr %0* %0, i32 0, i32 0 ; <double*> [#uses=1] store double %A.coerce0, double* %1 %2 = getelementptr %0* %0, i32 0, i32 1 ; <i64*> [#uses=1] store i64 %A.coerce1, i64* %2 I only do this now because I never want to look at this code again :) llvm-svn: 109738
* implement a todo: pass a eight-byte that consists of aChris Lattner2010-07-291-6/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | small integer + padding as that small integer. On code like: struct c { double x; int y; }; void bar(struct c C) { } This means that we compile to: define void @bar(double %C.coerce0, i32 %C.coerce1) nounwind { entry: %C = alloca %struct.c, align 8 ; <%struct.c*> [#uses=2] %0 = getelementptr %struct.c* %C, i32 0, i32 0 ; <double*> [#uses=1] store double %C.coerce0, double* %0 %1 = getelementptr %struct.c* %C, i32 0, i32 1 ; <i32*> [#uses=1] store i32 %C.coerce1, i32* %1 instead of: define void @bar(double %C.coerce0, i64 %C.coerce1) nounwind { entry: %C = alloca %struct.c, align 8 ; <%struct.c*> [#uses=3] %0 = bitcast %struct.c* %C to %0* ; <%0*> [#uses=2] %1 = getelementptr %0* %0, i32 0, i32 0 ; <double*> [#uses=1] store double %C.coerce0, double* %1 %2 = getelementptr %0* %0, i32 0, i32 1 ; <i64*> [#uses=1] store i64 %C.coerce1, i64* %2 which gives SRoA heartburn. This implements rdar://5711709, a nice low number :) llvm-svn: 109737
* fix a builder, why didn't clang++ catch this?Chris Lattner2010-07-292-2/+3
| | | | llvm-svn: 109735
* Kill off the 'coerce' ABI passing form. Now 'direct' and 'extend' alwaysChris Lattner2010-07-294-194/+178
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | have a "coerce to" type which often matches the default lowering of Clang type to LLVM IR type, but the coerce case can be handled by making them not be the same. This simplifies things and fixes issues where X86-64 abi lowering would return coerce after making preferred types exactly match up. This caused us to compile: typedef float v4f32 __attribute__((__vector_size__(16))); v4f32 foo(v4f32 X) { return X+X; } into this code at -O0: define <4 x float> @foo(<4 x float> %X.coerce) nounwind { entry: %retval = alloca <4 x float>, align 16 ; <<4 x float>*> [#uses=2] %coerce = alloca <4 x float>, align 16 ; <<4 x float>*> [#uses=2] %X.addr = alloca <4 x float>, align 16 ; <<4 x float>*> [#uses=3] store <4 x float> %X.coerce, <4 x float>* %coerce %X = load <4 x float>* %coerce ; <<4 x float>> [#uses=1] store <4 x float> %X, <4 x float>* %X.addr %tmp = load <4 x float>* %X.addr ; <<4 x float>> [#uses=1] %tmp1 = load <4 x float>* %X.addr ; <<4 x float>> [#uses=1] %add = fadd <4 x float> %tmp, %tmp1 ; <<4 x float>> [#uses=1] store <4 x float> %add, <4 x float>* %retval %0 = load <4 x float>* %retval ; <<4 x float>> [#uses=1] ret <4 x float> %0 } Now we get: define <4 x float> @foo(<4 x float> %X) nounwind { entry: %X.addr = alloca <4 x float>, align 16 ; <<4 x float>*> [#uses=3] store <4 x float> %X, <4 x float>* %X.addr %tmp = load <4 x float>* %X.addr ; <<4 x float>> [#uses=1] %tmp1 = load <4 x float>* %X.addr ; <<4 x float>> [#uses=1] %add = fadd <4 x float> %tmp, %tmp1 ; <<4 x float>> [#uses=1] ret <4 x float> %add } This implements rdar://8248065 llvm-svn: 109733
* ignore structs that wrap vectors in IR, the abstraction shouldn't add penalty.Chris Lattner2010-07-291-2/+13
| | | | | | | | | | | | | | | | | Before we'd compile the example into something like: %coerce.dive2 = getelementptr %struct.v4f32wrapper* %retval, i32 0, i32 0 ; <<4 x float>*> [#uses=1] %1 = bitcast <4 x float>* %coerce.dive2 to <2 x double>* ; <<2 x double>*> [#uses=1] %2 = load <2 x double>* %1, align 1 ; <<2 x double>> [#uses=1] ret <2 x double> %2 Now we produce: %coerce.dive2 = getelementptr %struct.v4f32wrapper* %retval, i32 0, i32 0 ; <<4 x float>*> [#uses=1] %0 = load <4 x float>* %coerce.dive2, align 1 ; <<4 x float>> [#uses=1] ret <4 x float> %0 llvm-svn: 109732
* move the 'pretty 16-byte vector' inferring code up to be sharedChris Lattner2010-07-291-14/+24
| | | | | | with return values, improving stuff that returns __m128 etc. llvm-svn: 109731
* simplify code by eliminating a premature optimization.Chris Lattner2010-07-291-30/+11
| | | | llvm-svn: 109730
* now that we have CGT around, we can start using preferred typesChris Lattner2010-07-291-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | for return values too. Instead of compiling something like: struct foo { int *X; float *Y; }; struct foo test(struct foo *P) { return *P; } to: %1 = type { i64, i64 } define %1 @test(%struct.foo* %P) nounwind { entry: %retval = alloca %struct.foo, align 8 ; <%struct.foo*> [#uses=2] %P.addr = alloca %struct.foo*, align 8 ; <%struct.foo**> [#uses=2] store %struct.foo* %P, %struct.foo** %P.addr %tmp = load %struct.foo** %P.addr ; <%struct.foo*> [#uses=1] %tmp1 = bitcast %struct.foo* %retval to i8* ; <i8*> [#uses=1] %tmp2 = bitcast %struct.foo* %tmp to i8* ; <i8*> [#uses=1] call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp1, i8* %tmp2, i64 16, i32 8, i1 false) %0 = bitcast %struct.foo* %retval to %1* ; <%1*> [#uses=1] %1 = load %1* %0, align 1 ; <%1> [#uses=1] ret %1 %1 } We now get the result more type safe, with: define %struct.foo @test(%struct.foo* %P) nounwind { entry: %retval = alloca %struct.foo, align 8 ; <%struct.foo*> [#uses=2] %P.addr = alloca %struct.foo*, align 8 ; <%struct.foo**> [#uses=2] store %struct.foo* %P, %struct.foo** %P.addr %tmp = load %struct.foo** %P.addr ; <%struct.foo*> [#uses=1] %tmp1 = bitcast %struct.foo* %retval to i8* ; <i8*> [#uses=1] %tmp2 = bitcast %struct.foo* %tmp to i8* ; <i8*> [#uses=1] call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp1, i8* %tmp2, i64 16, i32 8, i1 false) %0 = load %struct.foo* %retval ; <%struct.foo> [#uses=1] ret %struct.foo %0 } That memcpy is completely terrible, but I don't know how to fix it. llvm-svn: 109729
* sink preferred type stuff lower. It's possible that this mightChris Lattner2010-07-291-27/+33
| | | | | | | improve codegen for vaarg or something, because its codepath is getting preferred types now. llvm-svn: 109728
* dissolve some more complexity: make the x86-64 abi lowering codeChris Lattner2010-07-293-57/+13
| | | | | | | compute its own preferred types instead of having CGT compute them then pass them (circuituously) down into ABIInfo. llvm-svn: 109726
OpenPOWER on IntegriCloud