summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExprScalar.cpp
Commit message (Collapse)AuthorAge
...
* Follow Eli's advice and store the VLA size with the native size_t type. ↵Anders Carlsson2009-02-05
| | | | | | Fixes PR3491. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63879 91177308-0d34-0410-b5e6-96231b3b80d8
* Make sure to cast the VLA size of array to the type of size_t. Fixes PR3442.Anders Carlsson2009-01-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63394 91177308-0d34-0410-b5e6-96231b3b80d8
* Make CodeGen produce an error if we come across a non-constant initializer ↵Douglas Gregor2009-01-29
| | | | | | list that involves the GNU array-range designator extension git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63327 91177308-0d34-0410-b5e6-96231b3b80d8
* Introduce a new expression node, ImplicitValueInitExpr, thatDouglas Gregor2009-01-29
| | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63317 91177308-0d34-0410-b5e6-96231b3b80d8
* Code generation support for C99 designated initializers.Douglas Gregor2009-01-28
| | | | | | | | | | | | | | | | | | | | | | 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) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63242 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix for PR2910: implement CodeGen for non-constant offsetof.Eli Friedman2009-01-24
| | | | | | | | Note that there are still other issues in this area; see PR3396. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62942 91177308-0d34-0410-b5e6-96231b3b80d8
* Refactor sizeof handling to use constant folding logic for constant Eli Friedman2009-01-24
| | | | | | | | sizeof expressions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62941 91177308-0d34-0410-b5e6-96231b3b80d8
* remove a bunch of alignment handling code out of CGExprScalar, sinceChris Lattner2009-01-24
| | | | | | | | alignment must always be a constant. Just let the constant folder do it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62933 91177308-0d34-0410-b5e6-96231b3b80d8
* Handle pointer arithmetic on function pointers.Daniel Dunbar2009-01-23
| | | | | | | - <rdar://problem/6518844> Clang-generated bitcode crashes LLVM while compiling function pointer addition expression git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62857 91177308-0d34-0410-b5e6-96231b3b80d8
* Slight cleanup, and fix for va_arg on architectures where va_list is a Eli Friedman2009-01-20
| | | | | | | | struct. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62585 91177308-0d34-0410-b5e6-96231b3b80d8
* Vector codegen improvementsNate Begeman2009-01-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62458 91177308-0d34-0410-b5e6-96231b3b80d8
* Changed the API yet again.Fariborz Jahanian2009-01-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62335 91177308-0d34-0410-b5e6-96231b3b80d8
* Used a more suitable api to get to the type of a recordFariborz Jahanian2009-01-16
| | | | | | | in code gen. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62326 91177308-0d34-0410-b5e6-96231b3b80d8
* Implemented code gen for sizeof(objc class interface).Fariborz Jahanian2009-01-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62289 91177308-0d34-0410-b5e6-96231b3b80d8
* make ScalarExprEmitter::EmitCompare() emit the expression with the correct ↵Nuno Lopes2009-01-11
| | | | | | | | type instead of always zext it to an int this fixes codegen of simple exprs in C++ like 'if (x != 0)' git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62060 91177308-0d34-0410-b5e6-96231b3b80d8
* Emit more refined "unsupported" error for block expressions.Daniel Dunbar2009-01-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61993 91177308-0d34-0410-b5e6-96231b3b80d8
* Add codegen support for __nullAnders Carlsson2008-12-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61314 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement alignof for vla types.Anders Carlsson2008-12-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61305 91177308-0d34-0410-b5e6-96231b3b80d8
* Make sure to emit the size expression for sizeof(type)Anders Carlsson2008-12-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61301 91177308-0d34-0410-b5e6-96231b3b80d8
* Make VLAs usable, and make basic usage work correctly. Also, add a Eli Friedman2008-12-20
| | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61291 91177308-0d34-0410-b5e6-96231b3b80d8
* disable Anders' recent VLA patch, this fixes PR3209.Chris Lattner2008-12-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60989 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement allocation and sizeof VLAs. This is very basic for now.Anders Carlsson2008-12-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60943 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix for PR3150: obvious copy-paste bug in Eli Friedman2008-12-02
| | | | | | | | ScalarExprEmitter::VisitBinLOr. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60415 91177308-0d34-0410-b5e6-96231b3b80d8
* Implemented ir-gen for 'implicit' properties using the new AST nodes.Fariborz Jahanian2008-11-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59886 91177308-0d34-0410-b5e6-96231b3b80d8
* Add spec ref to comment.Daniel Dunbar2008-11-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59622 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix redundant load of bit-fields on assignment (to get the updatedDaniel Dunbar2008-11-19
| | | | | | | | | | value). - Use extra argument to EmitStoreThroughLValue to provide place to write update bit-field value if caller requires it. - This fixes several FIXMEs. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59615 91177308-0d34-0410-b5e6-96231b3b80d8
* daniel prefers completed thoughts.Chris Lattner2008-11-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59404 91177308-0d34-0410-b5e6-96231b3b80d8
* Normalize many BasicBlock names.Daniel Dunbar2008-11-13
| | | | | | | | | | | - Use dotted notation for blocks related to a particular statement type. - Use .end for landing pads. No functionality change in NDEBUG mode. :) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59210 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename ?: operator blocks to cond.true and cond.false (I don't knowDaniel Dunbar2008-11-12
| | | | | | | what "cond.?" means, and this avoids quoting). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59128 91177308-0d34-0410-b5e6-96231b3b80d8
* Lower ?: into select when the selected values are cheap and side-effect-free.Chris Lattner2008-11-12
| | | | | | | This cuts another 200 lines off expr.ll, forming 23 selects. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59124 91177308-0d34-0410-b5e6-96231b3b80d8
* emit better codegen for ||/&&, shrinking expr.ll by another 240 lines.Chris Lattner2008-11-12
| | | | | | | | | | This happens for stuff like this: x = cond1 || cond2 || cond3 || cond4; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59123 91177308-0d34-0410-b5e6-96231b3b80d8
* use ConstantFoldsToSimpleInteger instead of code emission to doChris Lattner2008-11-12
| | | | | | | constant folding. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59121 91177308-0d34-0410-b5e6-96231b3b80d8
* Use EmitBranchOnBoolExpr in VisitConditionalOperator. ThisChris Lattner2008-11-12
| | | | | | | shrinks code yet again by a bit. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59114 91177308-0d34-0410-b5e6-96231b3b80d8
* Move EmitBranchOnBoolExpr and ConstantFoldsToSimpleInteger toChris Lattner2008-11-12
| | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59113 91177308-0d34-0410-b5e6-96231b3b80d8
* Clean up some code to use isZero instead of calling getZExtValue.Chris Lattner2008-11-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59103 91177308-0d34-0410-b5e6-96231b3b80d8
* Use createBasicBlock here too.Daniel Dunbar2008-11-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59095 91177308-0d34-0410-b5e6-96231b3b80d8
* Rework IRgen invariant w.r.t. current insert point.Daniel Dunbar2008-11-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59089 91177308-0d34-0410-b5e6-96231b3b80d8
* Try to not emit the dead side of ?: if the condition is a constant.Chris Lattner2008-11-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59061 91177308-0d34-0410-b5e6-96231b3b80d8
* Introduce a single AST node SizeOfAlignOfExpr for all sizeof and alignof ↵Sebastian Redl2008-11-11
| | | | | | expressions, both of values and types. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59057 91177308-0d34-0410-b5e6-96231b3b80d8
* Add CodeGenFunction::EmitBranch.Daniel Dunbar2008-11-11
| | | | | | | | - Emits an unconditional branch, with extra logic to avoid generating spurious branches out of dummy blocks. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59037 91177308-0d34-0410-b5e6-96231b3b80d8
* short circuit && and || when possible. This substantially reducesChris Lattner2008-11-11
| | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59034 91177308-0d34-0410-b5e6-96231b3b80d8
* Centralize basic block creation in CodeGenFunction::createBasicBlock.Daniel Dunbar2008-11-11
| | | | | | | - No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59017 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement lowering of va_arg in clang directly. (This is 32-bit X86 only for ↵Anders Carlsson2008-11-04
| | | | | | now). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58681 91177308-0d34-0410-b5e6-96231b3b80d8
* Move IRBuilder type definition to common file.Daniel Dunbar2008-11-01
| | | | | | | - No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58546 91177308-0d34-0410-b5e6-96231b3b80d8
* make codegen reject initializes with designators, like this:Chris Lattner2008-10-26
| | | | | | | | | | t.c:1:13: error: cannot codegen this designators yet int a[10] = {2, 4, [8]=9, 10}; ^~~~~~~~~~~~~~~~~ git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58220 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove unneeded EncodingRecordTypes argument to getObjCEncodingForType.Daniel Dunbar2008-10-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57716 91177308-0d34-0410-b5e6-96231b3b80d8
* Adjust calls to APFloat conversion for new interface.Dale Johannesen2008-10-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57332 91177308-0d34-0410-b5e6-96231b3b80d8
* Avoid superfluous errors regarding variable-length arrays (casts).Daniel Dunbar2008-09-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55759 91177308-0d34-0410-b5e6-96231b3b80d8
* Downgrade a number of FIXME asserts to ErrorUnsupported.Daniel Dunbar2008-08-29
| | | | | | | - Notably VLAs git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55544 91177308-0d34-0410-b5e6-96231b3b80d8
* Add special "property reference" CodeGen::LValue type for emittingDaniel Dunbar2008-08-29
| | | | | | | | | Objective-C property references. - This handles property references "more correctly" but setters still don't work. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55534 91177308-0d34-0410-b5e6-96231b3b80d8