summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExprScalar.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* fix rdar://6586493, a bug in codegen of the GNU Chris Lattner2009-02-131-9/+19
| | | | | | missing-?:-true-value extension. llvm-svn: 64505
* Condense all the blocks code into CGBlocks.cpp.Mike Stump2009-02-131-132/+1
| | | | llvm-svn: 64457
* Initial codegen for block literals. This is a work in progress. I'veMike Stump2009-02-121-6/+142
| | | | | | | | tried to put FIXMEs on the most important things to fix up. Lots left to do including more codegen, more documentation and cleaning code and style cleanups. llvm-svn: 64390
* Use EmitVAListRef instead of EmitLValue directly to handle array decayDaniel Dunbar2009-02-111-1/+0
| | | | | | case on x86_64. llvm-svn: 64333
* Fix rdar://6518463, increment of a bool is always true, due toChris Lattner2009-02-111-0/+7
| | | | | | | subtle and non-obvious promotion rules. We already handle += and +1 correctly. llvm-svn: 64296
* finish off codegen support for sub of pointer to functions, Chris Lattner2009-02-111-2/+7
| | | | | | finishing off rdar://6520707 llvm-svn: 64295
* Follow Eli's advice and store the VLA size with the native size_t type. ↵Anders Carlsson2009-02-051-3/+1
| | | | | | Fixes PR3491. llvm-svn: 63879
* Make sure to cast the VLA size of array to the type of size_t. Fixes PR3442.Anders Carlsson2009-01-301-1/+4
| | | | llvm-svn: 63394
* Make CodeGen produce an error if we come across a non-constant initializer ↵Douglas Gregor2009-01-291-0/+4
| | | | | | list that involves the GNU array-range designator extension llvm-svn: 63327
* Introduce a new expression node, ImplicitValueInitExpr, thatDouglas Gregor2009-01-291-0/+3
| | | | | | | | | | | | | represents an implicit value-initialization of a subobject of a particular type. This replaces the (ab)use of CXXZeroValueInitExpr within initializer lists for the "holes" that occur due to the use of C99 designated initializers. The new test case is currently XFAIL'd, because CodeGen's ConstExprEmitter (in lib/CodeGen/CGExprConstant.cpp) needs to be taught to value-initialize when it sees ImplicitValueInitExprs. llvm-svn: 63317
* Code generation support for C99 designated initializers.Douglas Gregor2009-01-281-5/+0
| | | | | | | | | | | | | | | | | | | | The approach I've taken in this patch is relatively straightforward, although the code itself is non-trivial. Essentially, as we process an initializer list we build up a fully-explicit representation of the initializer list, where each of the subobject initializations occurs in order. Designators serve to "fill in" subobject initializations in a non-linear way. The fully-explicit representation makes initializer lists (both with and without designators) easy to grok for codegen and later semantic analyses. We keep the syntactic form of the initializer list linked into the AST for those clients interested in exactly what the user wrote. Known limitations: - Designating a member of a union that isn't the first member may result in bogus initialization (we warn about this) - GNU array-range designators are not supported (we warn about this) llvm-svn: 63242
* Fix for PR2910: implement CodeGen for non-constant offsetof.Eli Friedman2009-01-241-7/+42
| | | | | | Note that there are still other issues in this area; see PR3396. llvm-svn: 62942
* Refactor sizeof handling to use constant folding logic for constant Eli Friedman2009-01-241-36/+14
| | | | | | sizeof expressions. llvm-svn: 62941
* remove a bunch of alignment handling code out of CGExprScalar, sinceChris Lattner2009-01-241-20/+18
| | | | | | | alignment must always be a constant. Just let the constant folder do it. llvm-svn: 62933
* Handle pointer arithmetic on function pointers.Daniel Dunbar2009-01-231-5/+28
| | | | | | - <rdar://problem/6518844> Clang-generated bitcode crashes LLVM while compiling function pointer addition expression llvm-svn: 62857
* Slight cleanup, and fix for va_arg on architectures where va_list is a Eli Friedman2009-01-201-1/+1
| | | | | | struct. llvm-svn: 62585
* Vector codegen improvementsNate Begeman2009-01-181-4/+20
| | | | llvm-svn: 62458
* Changed the API yet again.Fariborz Jahanian2009-01-161-5/+3
| | | | llvm-svn: 62335
* Used a more suitable api to get to the type of a recordFariborz Jahanian2009-01-161-1/+1
| | | | | | in code gen. llvm-svn: 62326
* Implemented code gen for sizeof(objc class interface).Fariborz Jahanian2009-01-161-1/+8
| | | | llvm-svn: 62289
* make ScalarExprEmitter::EmitCompare() emit the expression with the correct ↵Nuno Lopes2009-01-111-3/+2
| | | | | | | | type instead of always zext it to an int this fixes codegen of simple exprs in C++ like 'if (x != 0)' llvm-svn: 62060
* Emit more refined "unsupported" error for block expressions.Daniel Dunbar2009-01-091-0/+5
| | | | llvm-svn: 61993
* Add codegen support for __nullAnders Carlsson2008-12-211-0/+3
| | | | llvm-svn: 61314
* Implement alignof for vla types.Anders Carlsson2008-12-211-2/+7
| | | | llvm-svn: 61305
* Make sure to emit the size expression for sizeof(type)Anders Carlsson2008-12-211-1/+6
| | | | llvm-svn: 61301
* Make VLAs usable, and make basic usage work correctly. Also, add a Eli Friedman2008-12-201-9/+7
| | | | | | | | | | simple test that actually does VLA codegen. Note that despite the fact that the alloca isn't in the entry block, it should dominate all uses; this is guaranteed by the restrictions on goto into VLA scope in C99. llvm-svn: 61291
* disable Anders' recent VLA patch, this fixes PR3209.Chris Lattner2008-12-131-2/+2
| | | | llvm-svn: 60989
* Implement allocation and sizeof VLAs. This is very basic for now.Anders Carlsson2008-12-121-1/+8
| | | | llvm-svn: 60943
* Fix for PR3150: obvious copy-paste bug in Eli Friedman2008-12-021-2/+2
| | | | | | ScalarExprEmitter::VisitBinLOr. llvm-svn: 60415
* Implemented ir-gen for 'implicit' properties using the new AST nodes.Fariborz Jahanian2008-11-221-0/+3
| | | | llvm-svn: 59886
* Add spec ref to comment.Daniel Dunbar2008-11-191-2/+6
| | | | llvm-svn: 59622
* Fix redundant load of bit-fields on assignment (to get the updatedDaniel Dunbar2008-11-191-16/+13
| | | | | | | | | value). - Use extra argument to EmitStoreThroughLValue to provide place to write update bit-field value if caller requires it. - This fixes several FIXMEs. llvm-svn: 59615
* daniel prefers completed thoughts.Chris Lattner2008-11-161-1/+1
| | | | llvm-svn: 59404
* Normalize many BasicBlock names.Daniel Dunbar2008-11-131-5/+5
| | | | | | | | | | - Use dotted notation for blocks related to a particular statement type. - Use .end for landing pads. No functionality change in NDEBUG mode. :) llvm-svn: 59210
* 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
* 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
* 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-121-18/+16
| | | | | | | | | | 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
* Clean up some code to use isZero instead of calling getZExtValue.Chris Lattner2008-11-121-3/+3
| | | | llvm-svn: 59103
* Use createBasicBlock here too.Daniel Dunbar2008-11-121-2/+2
| | | | llvm-svn: 59095
* Rework IRgen invariant w.r.t. current insert point.Daniel Dunbar2008-11-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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
* 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-111-16/+8
| | | | | | expressions, both of values and types. llvm-svn: 59057
* Add CodeGenFunction::EmitBranch.Daniel Dunbar2008-11-111-2/+2
| | | | | | | - Emits an unconditional branch, with extra logic to avoid generating spurious branches out of dummy blocks. llvm-svn: 59037
* short circuit && and || when possible. This substantially reducesChris Lattner2008-11-111-0/+28
| | | | | | | | 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
* Centralize basic block creation in CodeGenFunction::createBasicBlock.Daniel Dunbar2008-11-111-5/+5
| | | | | | - No functionality change. llvm-svn: 59017
* Implement lowering of va_arg in clang directly. (This is 32-bit X86 only for ↵Anders Carlsson2008-11-041-2/+8
| | | | | | now). llvm-svn: 58681
* Move IRBuilder type definition to common file.Daniel Dunbar2008-11-011-1/+1
| | | | | | - No functionality change. llvm-svn: 58546
OpenPOWER on IntegriCloud