summaryrefslogtreecommitdiffstats
path: root/clang
Commit message (Collapse)AuthorAgeFilesLines
* finally get around to doing a significant cleanup to irgen:Chris Lattner2010-06-2716-233/+164
| | | | | | | | have CGF create and make accessible standard int32,int64 and intptr types. This fixes a ton of 80 column violations introduced by LLVMContextification and cleans up stuff a lot. llvm-svn: 106977
* tidy up OrderGlobalInitsChris Lattner2010-06-272-14/+12
| | | | llvm-svn: 106976
* If coercing something from int or pointer type to int or pointer typeChris Lattner2010-06-272-2/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (potentially after unwrapping it from a struct) do it without going through memory. We now compile: struct DeclGroup { unsigned NumDecls; }; int foo(DeclGroup D) { return D.NumDecls; } into: %struct.DeclGroup = type { i32 } define i32 @_Z3foo9DeclGroup(i64) nounwind ssp noredzone { entry: %D = alloca %struct.DeclGroup, align 4 ; <%struct.DeclGroup*> [#uses=2] %coerce.dive = getelementptr %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1] %coerce.val.ii = trunc i64 %0 to i32 ; <i32> [#uses=1] store i32 %coerce.val.ii, i32* %coerce.dive %tmp = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1] %tmp1 = load i32* %tmp ; <i32> [#uses=1] ret i32 %tmp1 } instead of: %struct.DeclGroup = type { i32 } define i32 @_Z3foo9DeclGroup(i64) nounwind ssp noredzone { entry: %D = alloca %struct.DeclGroup, align 4 ; <%struct.DeclGroup*> [#uses=2] %tmp = alloca i64 ; <i64*> [#uses=2] %coerce.dive = getelementptr %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1] store i64 %0, i64* %tmp %1 = bitcast i64* %tmp to i32* ; <i32*> [#uses=1] %2 = load i32* %1, align 1 ; <i32> [#uses=1] store i32 %2, i32* %coerce.dive %tmp1 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1] %tmp2 = load i32* %tmp1 ; <i32> [#uses=1] ret i32 %tmp2 } ... which is quite a bit less terrifying. llvm-svn: 106975
* Same patch as the previous on the store side. Before we compiled this:Chris Lattner2010-06-272-10/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | struct DeclGroup { unsigned NumDecls; }; int foo(DeclGroup D) { return D.NumDecls; } to: %struct.DeclGroup = type { i32 } define i32 @_Z3foo9DeclGroup(i64) nounwind ssp noredzone { entry: %D = alloca %struct.DeclGroup, align 4 ; <%struct.DeclGroup*> [#uses=2] %tmp = alloca i64 ; <i64*> [#uses=2] store i64 %0, i64* %tmp %1 = bitcast i64* %tmp to %struct.DeclGroup* ; <%struct.DeclGroup*> [#uses=1] %2 = load %struct.DeclGroup* %1, align 1 ; <%struct.DeclGroup> [#uses=1] store %struct.DeclGroup %2, %struct.DeclGroup* %D %tmp1 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1] %tmp2 = load i32* %tmp1 ; <i32> [#uses=1] ret i32 %tmp2 } which caused fast isel bailouts due to the FCA load/store of %2. Now we generate this just blissful code: %struct.DeclGroup = type { i32 } define i32 @_Z3foo9DeclGroup(i64) nounwind ssp noredzone { entry: %D = alloca %struct.DeclGroup, align 4 ; <%struct.DeclGroup*> [#uses=2] %tmp = alloca i64 ; <i64*> [#uses=2] %coerce.dive = getelementptr %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1] store i64 %0, i64* %tmp %1 = bitcast i64* %tmp to i32* ; <i32*> [#uses=1] %2 = load i32* %1, align 1 ; <i32> [#uses=1] store i32 %2, i32* %coerce.dive %tmp1 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1] %tmp2 = load i32* %tmp1 ; <i32> [#uses=1] ret i32 %tmp2 } This avoids fastisel bailing out and is groundwork for future patch. This reduces bailouts on CGStmt.ll to 911 from 935. llvm-svn: 106974
* improve CreateCoercedLoad a bit to generate slightly less awfulChris Lattner2010-06-271-1/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | IR when handling X86-64 by-value struct stuff. For example, we use to compile this: struct DeclGroup { unsigned NumDecls; }; int foo(DeclGroup D); void bar(DeclGroup *D) { foo(*D); } into: define void @_Z3barP9DeclGroup(%struct.DeclGroup* %D) ssp nounwind { entry: %D.addr = alloca %struct.DeclGroup*, align 8 ; <%struct.DeclGroup**> [#uses=2] %agg.tmp = alloca %struct.DeclGroup, align 4 ; <%struct.DeclGroup*> [#uses=2] %tmp3 = alloca i64 ; <i64*> [#uses=2] store %struct.DeclGroup* %D, %struct.DeclGroup** %D.addr %tmp = load %struct.DeclGroup** %D.addr ; <%struct.DeclGroup*> [#uses=1] %tmp1 = bitcast %struct.DeclGroup* %agg.tmp to i8* ; <i8*> [#uses=1] %tmp2 = bitcast %struct.DeclGroup* %tmp to i8* ; <i8*> [#uses=1] call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp1, i8* %tmp2, i64 4, i32 4, i1 false) %0 = bitcast i64* %tmp3 to %struct.DeclGroup* ; <%struct.DeclGroup*> [#uses=1] %1 = load %struct.DeclGroup* %agg.tmp ; <%struct.DeclGroup> [#uses=1] store %struct.DeclGroup %1, %struct.DeclGroup* %0, align 1 %2 = load i64* %tmp3 ; <i64> [#uses=1] call void @_Z3foo9DeclGroup(i64 %2) ret void } which would cause fastisel to bail out due to the first class aggregate load %1. With this patch we now compile it into the (still awful): define void @_Z3barP9DeclGroup(%struct.DeclGroup* %D) nounwind ssp noredzone { entry: %D.addr = alloca %struct.DeclGroup*, align 8 ; <%struct.DeclGroup**> [#uses=2] %agg.tmp = alloca %struct.DeclGroup, align 4 ; <%struct.DeclGroup*> [#uses=2] %tmp3 = alloca i64 ; <i64*> [#uses=2] store %struct.DeclGroup* %D, %struct.DeclGroup** %D.addr %tmp = load %struct.DeclGroup** %D.addr ; <%struct.DeclGroup*> [#uses=1] %tmp1 = bitcast %struct.DeclGroup* %agg.tmp to i8* ; <i8*> [#uses=1] %tmp2 = bitcast %struct.DeclGroup* %tmp to i8* ; <i8*> [#uses=1] call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp1, i8* %tmp2, i64 4, i32 4, i1 false) %coerce.dive = getelementptr %struct.DeclGroup* %agg.tmp, i32 0, i32 0 ; <i32*> [#uses=1] %0 = bitcast i64* %tmp3 to i32* ; <i32*> [#uses=1] %1 = load i32* %coerce.dive ; <i32> [#uses=1] store i32 %1, i32* %0, align 1 %2 = load i64* %tmp3 ; <i64> [#uses=1] %call = call i32 @_Z3foo9DeclGroup(i64 %2) noredzone ; <i32> [#uses=0] ret void } which doesn't bail out. On CGStmt.ll, this reduces fastisel bail outs from 958 to 935, and is the precursor of better things to come. llvm-svn: 106973
* Implicitly compare symbolic expressions to zero when they're being used as ↵Jordy Rose2010-06-272-3/+25
| | | | | | constraints. Part of PR7491. llvm-svn: 106972
* merge two tests.Chris Lattner2010-06-272-4/+6
| | | | llvm-svn: 106971
* Change IR generation for return (in the simple case) to avoid doing sillyChris Lattner2010-06-278-103/+122
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | load/store nonsense in the epilog. For example, for: int foo(int X) { int A[100]; return A[X]; } we used to generate: %arrayidx = getelementptr inbounds [100 x i32]* %A, i32 0, i64 %idxprom ; <i32*> [#uses=1] %tmp1 = load i32* %arrayidx ; <i32> [#uses=1] store i32 %tmp1, i32* %retval %0 = load i32* %retval ; <i32> [#uses=1] ret i32 %0 } which codegen'd to this code: _foo: ## @foo ## BB#0: ## %entry subq $408, %rsp ## imm = 0x198 movl %edi, 400(%rsp) movl 400(%rsp), %edi movslq %edi, %rax movl (%rsp,%rax,4), %edi movl %edi, 404(%rsp) movl 404(%rsp), %eax addq $408, %rsp ## imm = 0x198 ret Now we generate: %arrayidx = getelementptr inbounds [100 x i32]* %A, i32 0, i64 %idxprom ; <i32*> [#uses=1] %tmp1 = load i32* %arrayidx ; <i32> [#uses=1] ret i32 %tmp1 } and: _foo: ## @foo ## BB#0: ## %entry subq $408, %rsp ## imm = 0x198 movl %edi, 404(%rsp) movl 404(%rsp), %edi movslq %edi, %rax movl (%rsp,%rax,4), %eax addq $408, %rsp ## imm = 0x198 ret This actually does matter, cutting out 2000 lines of IR from CGStmt.ll for example. Another interesting effect is that altivec.h functions which are dead now get dce'd by the inliner. Hence all the changes to builtins-ppc-altivec.c to ensure the calls aren't dead. llvm-svn: 106970
* reduce indentationChris Lattner2010-06-261-34/+35
| | | | llvm-svn: 106967
* Implement rdar://7530813 - collapse multiple GEP instructions in IRgenChris Lattner2010-06-265-20/+53
| | | | | | | | | | | | | | | | | | | | This avoids generating two gep's for common array operations. Before we would generate something like: %tmp = load i32* %X.addr ; <i32> [#uses=1] %arraydecay = getelementptr inbounds [100 x i32]* %A, i32 0, i32 0 ; <i32*> [#uses=1] %arrayidx = getelementptr inbounds i32* %arraydecay, i32 %tmp ; <i32*> [#uses=1] %tmp1 = load i32* %arrayidx ; <i32> [#uses=1] Now we generate: %tmp = load i32* %X.addr ; <i32> [#uses=1] %arrayidx = getelementptr inbounds [100 x i32]* %A, i32 0, i32 %tmp ; <i32*> [#uses=1] %tmp1 = load i32* %arrayidx ; <i32> [#uses=1] Less IR is better at -O0. llvm-svn: 106966
* Allow '__extension__' to be analyzed in a lvalue context.Ted Kremenek2010-06-261-2/+6
| | | | llvm-svn: 106964
* minor cleanup: don't emit the base of an array subscript until after Chris Lattner2010-06-261-8/+7
| | | | | | | we're done diddling around with the index stuff. Use a cheaper type comparison. llvm-svn: 106963
* fix inc/dec to honor -fwrapv and -ftrapv, implementing PR7426.Chris Lattner2010-06-262-9/+37
| | | | llvm-svn: 106962
* move scalar inc/dec codegen into ScalarExprEmitter instead Chris Lattner2010-06-262-97/+111
| | | | | | of being in CGF. No functionality change. llvm-svn: 106961
* use more efficient type comparison predicates.Chris Lattner2010-06-264-6/+6
| | | | llvm-svn: 106958
* Fix unary minus to trap on overflow with -ftrapv, refactoring binopChris Lattner2010-06-262-32/+35
| | | | | | code so we can use it from VisitUnaryMinus. llvm-svn: 106957
* Implement support for -fwrapv, rdar://7221421Chris Lattner2010-06-2613-73/+125
| | | | | | | | | | | | As part of this, pull together trapv handling into the same enum. This also add support for NSW multiplies. This also makes PCH disagreement on overflow behavior silent, since it really doesn't matter except for warnings and codegen (no macros get defined etc). llvm-svn: 106956
* implement rdar://7432000 - signed negate should codegen as NSW.Chris Lattner2010-06-264-10/+28
| | | | | | While I'm in there, adjust pointer to member adjustments as well. llvm-svn: 106955
* Implement support for #pragma message, patch by Michael Spencer!Chris Lattner2010-06-265-2/+113
| | | | llvm-svn: 106950
* Change EmitReferenceBindingToExpr to take a decl instead of a boolean.Anders Carlsson2010-06-268-11/+15
| | | | llvm-svn: 106949
* Add function for mangling reference temporaries.Anders Carlsson2010-06-262-0/+11
| | | | llvm-svn: 106948
* Mangle pointer and (lvalue) reference types in the Microsoft C++ Mangler.Charles Davis2010-06-262-47/+96
| | | | | | | Also, fix mangling of throw specs. Turns out MSVC totally ignores throw specs when mangling names. llvm-svn: 106937
* Remove cruft that I didn't intend to commit.Daniel Dunbar2010-06-261-5/+0
| | | | llvm-svn: 106932
* Add a missing dependency to try to fix a buildbot failure.Bob Wilson2010-06-261-1/+1
| | | | | | | | | It complained with: llvm[5]: Building Clang arm_neon.h.inc with tblgen cp: cannot create regular file `/build/buildbot-llvm/clang-x86_64-linux-selfhost-rel/llvm.obj.2/Release/lib/clang/2.0/include/arm_neon.h': No such file or directory llvm-svn: 106922
* Relax assertion since non-pod C++ classes are not aggregates, but still can ↵Ted Kremenek2010-06-251-4/+9
| | | | | | appear in this context. llvm-svn: 106919
* Add support for CXXRecordDecl in CFGRecStmtDeclVisitor.Ted Kremenek2010-06-251-0/+5
| | | | llvm-svn: 106918
* clang: Derive version name from LLVM unless specified explicitly. This meansDaniel Dunbar2010-06-254-14/+11
| | | | | | clang is now clang 2.8. llvm-svn: 106914
* When a constant size array is casted to another type, its length should be ↵Jordy Rose2010-06-253-4/+21
| | | | | | scaled as well. llvm-svn: 106911
* Add dead stores C++ test case that was previously asserting due to anTed Kremenek2010-06-251-0/+8
| | | | | | invalid source range for CXXNewExpr. llvm-svn: 106904
* Use TypeSourceInfo to help determine the SourceRange of a CXXNewExpr. This ↵Ted Kremenek2010-06-251-3/+6
| | | | | | | | | fixes several cases where we generated an invalid SourceRange for this expression. Thanks to John McCall for helping me figure this out. llvm-svn: 106903
* Try making BuildBot happy again.Fariborz Jahanian2010-06-251-3/+3
| | | | llvm-svn: 106898
* Test case for pr7490.Fariborz Jahanian2010-06-251-0/+16
| | | | llvm-svn: 106887
* Add "checker caching" to GRExprEngine::CheckerVisit to progressively buildTed Kremenek2010-06-254-18/+87
| | | | | | | | | | | | a winowed list of checkers that actually do something for a given StmtClass. As the number of checkers grows, this may potentially significantly reduce the number of checkers called at any one time. My own measurements show that for the ~20 registered Checker objects, only ~5 of them respond at any one time to a give statement. While this isn't a net performance win right now (there is a minor slowdown on sqlite.3) this improvement does greatly improve debugging when stepping through the checkers used to evaluate a given statement. llvm-svn: 106884
* Fix -analyze-display-progress (once again), this time with an additional ↵Ted Kremenek2010-06-252-5/+13
| | | | | | regression test. llvm-svn: 106883
* Minor change to my last patch to fix PR7490.Fariborz Jahanian2010-06-251-4/+8
| | | | llvm-svn: 106875
* Translate numbers properly.Eric Christopher2010-06-251-1/+1
| | | | llvm-svn: 106873
* IRGen for trivial initialization of dynamiccaly allocatedFariborz Jahanian2010-06-252-19/+80
| | | | | | array of other done c++ objects. Fixes PR7490. llvm-svn: 106869
* Change RegionStoreManager::Retrieve to infer the type of a symbolic region ↵Tom Care2010-06-251-1/+6
| | | | | | from the context when it is not already available. llvm-svn: 106868
* build: Get CLANG_VERSION from Version.inc instead of depending on VER file ↵Daniel Dunbar2010-06-253-3/+7
| | | | | | directly. llvm-svn: 106864
* build: Add a generated Version.inc file instead of duplicating information.Daniel Dunbar2010-06-255-12/+54
| | | | llvm-svn: 106863
* Support NonTypeTemplateParmDecl for PCH.Argyrios Kyrtzidis2010-06-255-6/+30
| | | | llvm-svn: 106860
* Make PCHWriter::FlushStmts() robust. If we added null Stmts, reading them ↵Argyrios Kyrtzidis2010-06-251-0/+1
| | | | | | back got messed up. llvm-svn: 106859
* Support DependentTemplateSpecializationType and ElaboratedType for PCH.Argyrios Kyrtzidis2010-06-253-16/+33
| | | | llvm-svn: 106858
* Add forgotten breaks in case statements.Argyrios Kyrtzidis2010-06-251-0/+2
| | | | llvm-svn: 106857
* A bug I've introduced in STDIN handling surfaced a few broken tests, fix them.Benjamin Kramer2010-06-255-8/+9
| | | | | | Lexer/hexfloat.cpp is now XFAIL'd, I'd appreciate if someone could look into it. llvm-svn: 106840
* Support UnresolvedLookupExpr for PCH.Argyrios Kyrtzidis2010-06-256-1/+58
| | | | llvm-svn: 106832
* Support UnresolvedMemberExpr for PCH.Argyrios Kyrtzidis2010-06-257-8/+148
| | | | llvm-svn: 106831
* Print source location when we encounter unhandled statement during PCH writing.Argyrios Kyrtzidis2010-06-251-1/+3
| | | | llvm-svn: 106830
* I don't know when I committed this, but it's probably a "bad thing".Chris Lattner2010-06-251-1/+1
| | | | llvm-svn: 106821
* Implement dependent alignment attribute support. This is a bit gross given theChandler Carruth2010-06-255-27/+87
| | | | | | | | | | | | | current attribute system, but it is enough to handle class templates which specify parts of their alignment in terms of their template parameters. This also replaces the attributes test in SemaTemplate with one that actually tests working attributes instead of broken ones. I plan to add more tests here for non-dependent attributes in a subsequent patch. Thanks to John for walking me through some of this. =D llvm-svn: 106818
OpenPOWER on IntegriCloud