summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix a FIXME by improving a diagnostic, add a testcase for PR3048Chris Lattner2008-11-121-2/+1
| | | | llvm-svn: 59167
* make TryFixInvalidVariablyModifiedType a static function.Chris Lattner2008-11-122-7/+6
| | | | llvm-svn: 59163
* Shore up transfer function for ObjCForCollectionStmt.Ted Kremenek2008-11-121-9/+17
| | | | llvm-svn: 59162
* Use Stmt* instead of Expr* for block-level expression.Ted Kremenek2008-11-121-1/+1
| | | | llvm-svn: 59161
* ObjCForCollectionStmts are block-level expressions.Ted Kremenek2008-11-121-5/+8
| | | | llvm-svn: 59160
* Restructure code to encourage fallthrough, no functionality change.Chris Lattner2008-11-121-10/+13
| | | | llvm-svn: 59157
* fix PR3048. I'm going to do some more work before closing it off andChris Lattner2008-11-121-0/+1
| | | | | | adding a testcase. llvm-svn: 59156
* Add (preliminary) transfer function support for ObjCForCollectionStmt. ↵Ted Kremenek2008-11-122-8/+123
| | | | | | | | Still need to flesh out some logic. When processing DeclStmt, use the new interface to StateManager::BindDecl. Conjuring of symbols is now done in VisitDeclStmt. llvm-svn: 59155
* Conjured symbols now bind to Stmt* instead of Expr*.Ted Kremenek2008-11-121-1/+1
| | | | llvm-svn: 59154
* Update method names involving GRStateRef. No functionality change.Ted Kremenek2008-11-121-9/+9
| | | | llvm-svn: 59153
* GRStateRef:Ted Kremenek2008-11-122-26/+25
| | | | | | | | | | | | - Rename SetSVal to BindLoc - Add BindDecl - Add BindExpr GRState: - Environment now binds to Stmt* instead of Expr*. This is needed for processing ObjCForCollectionStmt (essentially the declaration of the the 'element' variable can have an SVal attached to it). - BindDecl no longer accepts Expr* for the initialization value; use SVal* instead. llvm-svn: 59152
* StoreManager::BindDecl now takes an SVal* for the initialization value ↵Ted Kremenek2008-11-122-42/+23
| | | | | | instead of an Expr* (which can be null). Lazy symbolication of conjured symbols is now the sole responsibility of GRExprEngine. llvm-svn: 59151
* Implement support for operator overloading using candidate operatorDouglas Gregor2008-11-129-69/+726
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | functions for built-in operators, e.g., the builtin bool operator==(int const*, int const*) can be used for the expression "x1 == x2" given: struct X { operator int const*(); } x1, x2; The scheme for handling these built-in operators is relatively simple: for each candidate required by the standard, create a special kind of candidate function for the built-in. If overload resolution picks the built-in operator, we perform the appropriate conversions on the arguments and then let the normal built-in operator take care of it. There may be some optimization opportunity left: if we can reduce the number of built-in operator overloads we generate, overload resolution for these cases will go faster. However, one must be careful when doing this: GCC generates too few operator overloads in our little test program, and fails to compile it because none of the overloads it generates match. Note that we only support operator overload for non-member binary operators at the moment. The other operators will follow. As part of this change, ImplicitCastExpr can now be an lvalue. llvm-svn: 59148
* Start a README.txt of possible optimizations to do in IRgen.Daniel Dunbar2008-11-121-0/+24
| | | | llvm-svn: 59130
* Handle ?: in EmitBranchOnBoolExpr.Daniel Dunbar2008-11-121-0/+17
| | | | llvm-svn: 59129
* Rename ?: operator blocks to cond.true and cond.false (I don't knowDaniel Dunbar2008-11-121-2/+2
| | | | | | what "cond.?" means, and this avoids quoting). llvm-svn: 59128
* Comment/indentation fix.Daniel Dunbar2008-11-121-2/+2
| | | | llvm-svn: 59127
* Some additions to tryEvaluate I've had sitting around for a while.Eli Friedman2008-11-121-25/+202
| | | | | | | | | | | | | | This pushes it a lot closer to being able to deal with most of the stuff CodeGen's constant expression evaluator knows how to deal with. This also fixes PR3003. The test could possibly use some improvement, but this'll work for now. Test 6 is inspired by PR3003; the other tests are mostly just designed to exercise the new code. The reason for the funny structure of the tests is that type fixing for arrays inside of structs is the only place in Sema that calls tryEvaluate, at least for the moment. llvm-svn: 59125
* Lower ?: into select when the selected values are cheap and side-effect-free.Chris Lattner2008-11-121-0/+37
| | | | | | This cuts another 200 lines off expr.ll, forming 23 selects. llvm-svn: 59124
* emit better codegen for ||/&&, shrinking expr.ll by another 240 lines.Chris Lattner2008-11-121-19/+31
| | | | | | | | This happens for stuff like this: x = cond1 || cond2 || cond3 || cond4; llvm-svn: 59123
* use ConstantFoldsToSimpleInteger instead of code emission to doChris Lattner2008-11-121-24/+22
| | | | | | constant folding. llvm-svn: 59121
* IRgen improvements on unreachable code:Daniel Dunbar2008-11-122-38/+76
| | | | | | | | | | | | | | | | | | | | | | | - Split out "simple" statements which can easily handle IR generation when there is no insert point. These are generally statements which start by emitting a new block or are only containers for other statements. - This fixes a regression in emitting dummy blocks, notably for case statements. - This also fixes spurious emission of a number of debug stoppoint intrinsic instructions. Remove unneeded sw.body block, just clear the insertion point. Lift out CodeGenFunction::EmitStopPoint which calls into the CGDebugInfo class when generating debug info. Normalize definitions of Emit{Break,Continue}Stmt and usage of ErrorUnsupported. llvm-svn: 59118
* Handle Unary ! in EmitBranchOnBoolExpr, so that we can efficientlyChris Lattner2008-11-121-1/+6
| | | | | | codegen stuff like "if (!(X && Y))" llvm-svn: 59115
* Use EmitBranchOnBoolExpr in VisitConditionalOperator. ThisChris Lattner2008-11-121-8/+17
| | | | | | shrinks code yet again by a bit. llvm-svn: 59114
* Move EmitBranchOnBoolExpr and ConstantFoldsToSimpleInteger toChris Lattner2008-11-124-112/+119
| | | | | | | | | | CodeGenFunction.cpp. Change VisitConditionalOperator to use constant fold instead of codegen'ing a constant conditional. Change ForStmt to use EmitBranchOnBoolExpr, this shrinks expr.c very slightly to 40239 lines. llvm-svn: 59113
* Make emission of 'if' conditions much more sophisticated when weChris Lattner2008-11-122-14/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | have a condition that is an &&/||. Before we used to compile things like this: int test() { if (x && y) foo(); else bar(); } into: %0 = load i32* @x ; <i32> [#uses=1] %1 = icmp ne i32 %0, 0 ; <i1> [#uses=1] br i1 %1, label %land_rhs, label %land_cont land_rhs: ; preds = %entry %2 = load i32* @y ; <i32> [#uses=1] %3 = icmp ne i32 %2, 0 ; <i1> [#uses=1] br label %land_cont land_cont: ; preds = %land_rhs, %entry %4 = phi i1 [ false, %entry ], [ %3, %land_rhs ] ; <i1> [#uses=1] br i1 %4, label %ifthen, label %ifelse ifthen: ; preds = %land_cont %call = call i32 (...)* @foo() ; <i32> [#uses=0] br label %ifend ifelse: ; preds = %land_cont %call1 = call i32 (...)* @bar() ; <i32> [#uses=0] br label %ifend ifend: ; preds = %ifelse, %ifthen Now we turn it into the much more svelte code: %0 = load i32* @x ; <i32> [#uses=1] %1 = icmp ne i32 %0, 0 ; <i1> [#uses=1] br i1 %1, label %land_lhs_true, label %ifelse land_lhs_true: ; preds = %entry %2 = load i32* @y ; <i32> [#uses=1] %3 = icmp ne i32 %2, 0 ; <i1> [#uses=1] br i1 %3, label %ifthen, label %ifelse ifthen: ; preds = %land_lhs_true %call = call i32 (...)* @foo() ; <i32> [#uses=0] br label %ifend ifelse: ; preds = %land_lhs_true, %entry %call1 = call i32 (...)* @bar() ; <i32> [#uses=0] br label %ifend ifend: ; preds = %ifelse, %ifthen Note the lack of a phi node. This shrinks the -O0 .ll file for 176.gcc/expr.c from 43176 to 40267 lines. llvm-svn: 59111
* fix a crash analyzing constants in 176.gcc/expr.c with my next patch. It wasChris Lattner2008-11-121-16/+34
| | | | | | | | crashing because we errors are ignored in subexpressions that are not evaluated, but we still evaluate the result of parents. This would cause an assertion because the erroneous subexpr didn't have its result value set to the right type. llvm-svn: 59110
* Teach the aggressive constant folder to fold X && 0 -> 0 and X || 1 -> 1Chris Lattner2008-11-121-1/+21
| | | | llvm-svn: 59105
* Clean up some code to use isZero instead of calling getZExtValue.Chris Lattner2008-11-122-4/+4
| | | | llvm-svn: 59103
* Use createBasicBlock here too.Daniel Dunbar2008-11-121-2/+2
| | | | llvm-svn: 59095
* Disable generation of basic block names in NDEBUG mode.Daniel Dunbar2008-11-122-1/+9
| | | | | | | Revert to enabling generation of instruction names when not in NDEBUG mode. llvm-svn: 59094
* Rework IRgen invariant w.r.t. current insert point.Daniel Dunbar2008-11-117-49/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - EmitStmt is no longer required to finish with a current insertion point defined (i.e. it does not need to make dummy blocks). Instead, it can clear the insertion point in the builder which indicates that the current insertion point is unreachable. - CodeGenFunction provides HaveInsertPoint and EnsureInsertPoint which respectively test if there is an insert point and ensure an insertion point exists (by making a dummy block). - Clearly mark functions in CodeGenFunction which can be called with no insertion point defined. Currently this is a limited set, and EmitStmt simply EnsureInsertPoint()s before emitting subsequent IR. Remove EmitDummyBlock, which is no longer needed. Clients who haven't already cleared the insertion point (typically via EmitBranch) can do so by hand. Remove isDummyBlock, which has effectively been renamed to HaveInsertPoint. The main thrust of this change is that we no longer have create dummy blocks just to destroy them a short time later in EmitBlock in the common case that there is no unreachable code following something like a goto. Additionally, this means that we are not using the hokey condition in isDummyBlock that a block without a name is a dummy block. Guess how well that works when we never emit block names! llvm-svn: 59089
* Change EmitBranch to always clear the insert point to clarify irgenDaniel Dunbar2008-11-112-1/+6
| | | | | | invariants. llvm-svn: 59085
* Emit debug region end in unified return block.Daniel Dunbar2008-11-111-6/+7
| | | | llvm-svn: 59081
* Codegen support for fastcall & stdcall CC.Anton Korobeynikov2008-11-111-1/+4
| | | | | | Patch by Ilya Okonsky! llvm-svn: 59080
* Flow-sensitive uninitialized values analysis:Ted Kremenek2008-11-111-4/+27
| | | | | | | - Added support for ObjCForCollectionStmt - Fixed bug where expression values would be always set to uninitialized when loops were involved llvm-svn: 59076
* Accesses to a collection within a fast enumeration 'for' statement ↵Ted Kremenek2008-11-111-9/+15
| | | | | | constitute a 'use'. llvm-svn: 59075
* Try to not emit the dead side of ?: if the condition is a constant.Chris Lattner2008-11-111-4/+21
| | | | llvm-svn: 59061
* Introduce a single AST node SizeOfAlignOfExpr for all sizeof and alignof ↵Sebastian Redl2008-11-1116-232/+167
| | | | | | expressions, both of values and types. llvm-svn: 59057
* Add transfer function support for ObjCForCollectionStmt to LiveVariables.Ted Kremenek2008-11-111-1/+17
| | | | llvm-svn: 59053
* Add CFG support for Objective-C 2.0 fast enumeration 'for' statement:Ted Kremenek2008-11-111-13/+77
| | | | | | | | http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_7_section_2.html#//apple_ref/doc/uid/TP30001163-CH18-SW3 Need to modify GRExprEngine, LiveVariables, and UninitializedValues to understand this construct. llvm-svn: 59049
* Implement C++ 'typeid' parsing and sema.Sebastian Redl2008-11-1112-7/+169
| | | | llvm-svn: 59042
* Add CodeGenFunction::EmitBranch.Daniel Dunbar2008-11-116-41/+40
| | | | | | | - Emits an unconditional branch, with extra logic to avoid generating spurious branches out of dummy blocks. llvm-svn: 59037
* Fix cmake build, patch from Jjgod Jiang.Daniel Dunbar2008-11-111-0/+2
| | | | llvm-svn: 59036
* short circuit && and || when possible. This substantially reducesChris Lattner2008-11-114-28/+64
| | | | | | | | the size of the -O0 output on some cases. For example, on expr.c from 176.gcc, it shrinks the .ll file from 43164 to 42835 lines, and removed references to two external symbols. llvm-svn: 59034
* Make codegen smart enough to not emit the dead side of an if whoseChris Lattner2008-11-111-5/+49
| | | | | | | condition is a constant. This shrinks -O0 codegen by quite a bit on some cases. llvm-svn: 59033
* implement debug info for typeof()Chris Lattner2008-11-111-6/+9
| | | | llvm-svn: 59032
* Fix PR3031 by silencing follow-on errors in invalid declarations.Chris Lattner2008-11-112-3/+5
| | | | llvm-svn: 59027
* Add CodeGenFunction::EmitDummyBlock for marking places where we makeDaniel Dunbar2008-11-113-7/+16
| | | | | | | "dummy" blocks (blocks just used to make sure we have a place to dump code to). llvm-svn: 59022
* Remove CodeGenFunction::StartBlock.Daniel Dunbar2008-11-112-14/+4
| | | | | | - Was confusing and only used in one small part of the code. llvm-svn: 59020
OpenPOWER on IntegriCloud