summaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CGExprScalar.cpp
AgeCommit message (Collapse)Author
2008-12-20Make VLAs usable, and make basic usage work correctly. Also, add a Eli Friedman
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
2008-12-13disable Anders' recent VLA patch, this fixes PR3209.Chris Lattner
llvm-svn: 60989
2008-12-12Implement allocation and sizeof VLAs. This is very basic for now.Anders Carlsson
llvm-svn: 60943
2008-12-02Fix for PR3150: obvious copy-paste bug in Eli Friedman
ScalarExprEmitter::VisitBinLOr. llvm-svn: 60415
2008-11-22Implemented ir-gen for 'implicit' properties using the new AST nodes.Fariborz Jahanian
llvm-svn: 59886
2008-11-19Add spec ref to comment.Daniel Dunbar
llvm-svn: 59622
2008-11-19Fix redundant load of bit-fields on assignment (to get the updatedDaniel Dunbar
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
2008-11-16daniel prefers completed thoughts.Chris Lattner
llvm-svn: 59404
2008-11-13Normalize many BasicBlock names.Daniel Dunbar
- 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
2008-11-12Rename ?: operator blocks to cond.true and cond.false (I don't knowDaniel Dunbar
what "cond.?" means, and this avoids quoting). llvm-svn: 59128
2008-11-12Lower ?: into select when the selected values are cheap and side-effect-free.Chris Lattner
This cuts another 200 lines off expr.ll, forming 23 selects. llvm-svn: 59124
2008-11-12emit better codegen for ||/&&, shrinking expr.ll by another 240 lines.Chris Lattner
This happens for stuff like this: x = cond1 || cond2 || cond3 || cond4; llvm-svn: 59123
2008-11-12use ConstantFoldsToSimpleInteger instead of code emission to doChris Lattner
constant folding. llvm-svn: 59121
2008-11-12Use EmitBranchOnBoolExpr in VisitConditionalOperator. ThisChris Lattner
shrinks code yet again by a bit. llvm-svn: 59114
2008-11-12Move EmitBranchOnBoolExpr and ConstantFoldsToSimpleInteger toChris Lattner
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
2008-11-12Clean up some code to use isZero instead of calling getZExtValue.Chris Lattner
llvm-svn: 59103
2008-11-12Use createBasicBlock here too.Daniel Dunbar
llvm-svn: 59095
2008-11-11Rework IRgen invariant w.r.t. current insert point.Daniel Dunbar
- 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
2008-11-11Try to not emit the dead side of ?: if the condition is a constant.Chris Lattner
llvm-svn: 59061
2008-11-11Introduce a single AST node SizeOfAlignOfExpr for all sizeof and alignof ↵Sebastian Redl
expressions, both of values and types. llvm-svn: 59057
2008-11-11Add CodeGenFunction::EmitBranch.Daniel Dunbar
- Emits an unconditional branch, with extra logic to avoid generating spurious branches out of dummy blocks. llvm-svn: 59037
2008-11-11short circuit && and || when possible. This substantially reducesChris Lattner
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
2008-11-11Centralize basic block creation in CodeGenFunction::createBasicBlock.Daniel Dunbar
- No functionality change. llvm-svn: 59017
2008-11-04Implement lowering of va_arg in clang directly. (This is 32-bit X86 only for ↵Anders Carlsson
now). llvm-svn: 58681
2008-11-01Move IRBuilder type definition to common file.Daniel Dunbar
- No functionality change. llvm-svn: 58546
2008-10-26make codegen reject initializes with designators, like this:Chris Lattner
t.c:1:13: error: cannot codegen this designators yet int a[10] = {2, 4, [8]=9, 10}; ^~~~~~~~~~~~~~~~~ llvm-svn: 58220
2008-10-17Remove unneeded EncodingRecordTypes argument to getObjCEncodingForType.Daniel Dunbar
llvm-svn: 57716
2008-10-09Adjust calls to APFloat conversion for new interface.Dale Johannesen
llvm-svn: 57332
2008-09-04Avoid superfluous errors regarding variable-length arrays (casts).Daniel Dunbar
llvm-svn: 55759
2008-08-29Downgrade a number of FIXME asserts to ErrorUnsupported.Daniel Dunbar
- Notably VLAs llvm-svn: 55544
2008-08-29Add special "property reference" CodeGen::LValue type for emittingDaniel Dunbar
Objective-C property references. - This handles property references "more correctly" but setters still don't work. llvm-svn: 55534
2008-08-27Initial support for Obj-C dot-syntax for getters.Daniel Dunbar
llvm-svn: 55410
2008-08-25Change another is-a-pointer check to check in terms of LLVM type.Daniel Dunbar
llvm-svn: 55312
2008-08-25Do is-a-pointer checks in terms of LLVM types inDaniel Dunbar
EmitScalarConversion(). - Important for allowing Obj-C void * to id<X> casts and so on. - Not sure about this fix however, perhaps Type should understand that id is effectively a pointer type. llvm-svn: 55311
2008-08-23Add CodeGen support for CXXZeroInitValueExpr.Argyrios Kyrtzidis
llvm-svn: 55249
2008-08-23Implement Obj-C ivar references to aggregates.Daniel Dunbar
Implement Obj-C lvalue message sends (aggregate returns). Update several places to emit more precise ErrorUnsupported warnings for currently unimplemented Obj-C features (main missing chunks are property references, Obj-C exception handling, and the for ... in syntax). llvm-svn: 55234
2008-08-23Trim CGObjCRuntime::GenerateMessageSend[Super]Daniel Dunbar
- Returns an RValue. - Reduced to only taking the CodeGenFunction, Expr, and Receiver. - Becomes responsible for emitting the arguments. Add CodeGenFunction::EmitCallExprExt - Takes optional extra arguments to insert at the head of the call. - This allows the Obj-C runtimes to call into this and isolates the argument and call instruction generation code to one place. Upshot is that we now pass structures (more) correctly. Also, fix one aspect of generating methods which take structure arguments (for NeXT). This probably needs to be merged with the SetFunctionAttributes code in CodeGenModule.cpp llvm-svn: 55223
2008-08-20Move all Obj-C runtime interaction into CodeGenFunction.Daniel Dunbar
- Drop duplicate (and broken) code for sending messages. - Add EmitObjCProtocolExpr to CodeGenFunction. llvm-svn: 55024
2008-08-16Add CodeGen support for AddrLabelExpr in initializers.Daniel Dunbar
llvm-svn: 54837
2008-08-16Change WarnUnsupported to ErrorUnsupported (in name and in practice).Daniel Dunbar
- We are beyond the point where this shows up often and when it does generating miscompiled files is bad. llvm-svn: 54836
2008-08-13Change ObjCRuntime GenerateProtocol[Ref] methods to takeDaniel Dunbar
ObjCProtocolDecl directly. Implement CodeGen support for forward protocol decls (no-ops are so nice to implement). Also moved CGObjCRuntime.h out of CodeGenModule.h llvm-svn: 54709
2008-08-12Drop Sender from GenerateMessageSend*Daniel Dunbar
- Was unused and generated a unnecessary load of self (missed file) llvm-svn: 54668
2008-08-12Protocol related tweaksDaniel Dunbar
- Implement type conversion of ObjCQualifiedIdType - Wire @protocol(...) to GenerateProtocolRef in ScalarExprEmitter llvm-svn: 54666
2008-08-12Add @selector(...) codegen support.Daniel Dunbar
llvm-svn: 54665
2008-08-11Change CodeGenModule to only create ObjC runtime for ObjC filesDaniel Dunbar
- Changed CodeGenModule::getObjCRuntime to return reference. - Added CodeGenModule::hasObjCRuntime predicate. llvm-svn: 54645
2008-08-11More #include cleaningDaniel Dunbar
- Remove internal uses of AST.h llvm-svn: 54628
2008-08-10rename PreDefinedExpr -> PredefinedExprChris Lattner
llvm-svn: 54605
2008-08-08update to make IRBuilder API change.Chris Lattner
llvm-svn: 54548
2008-08-06Fix CodeGen of pointer arithmetic in compound assignment statements.Daniel Dunbar
- Changed EmitSub to work on all cases (arithmetic, ptr - int, ptr - ptr) so that implementation matches that of other operators. - Modify EmitCompoundAssign to compute and perform the appropriate casts of left, right, and result types for the assorted pointer arithmetic cases. - Fix EmitSub (ptr - int) case to negate the rhs *after* extension. This is critical when the rhs is unsigned (and needs extension). - This fixes cfrac. - <rdr://6115726> llvm-svn: 54392
2008-08-05Bug fix, CodeGen of (void*) - (void*) was broken.Daniel Dunbar
- <rdar://problem/6122967> llvm-svn: 54338