summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenFunction.h
Commit message (Collapse)AuthorAgeFilesLines
...
* Even if a constant's evaluated value is used, emit debug info for the ↵Devang Patel2010-08-101-1/+2
| | | | | | constant variable. llvm-svn: 110660
* Store inheritance paths after CastExprs instead of inside them.John McCall2010-08-071-2/+4
| | | | | | | | | | | | | | | This takes some trickery since CastExpr has subclasses (and indeed, is abstract). Also, smoosh the CastKind into the bitfield from Expr. Drops two words of storage from Expr in the common case of expressions which don't need inheritance paths. Avoids a separate allocation and another word of overhead in cases needing inheritance paths. Also has the advantage of not leaking memory, since destructors for AST nodes are never run. llvm-svn: 110507
* vdup_lane was missingNate Begeman2010-08-061-1/+2
| | | | | | <rdar://problem/8278732> llvm-svn: 110420
* More objc block variable layout info. work.Fariborz Jahanian2010-08-041-0/+2
| | | | llvm-svn: 110239
* Some early work for providing block layout info. Fariborz Jahanian2010-08-041-3/+31
| | | | | | for objective-c/c++ blocks (NeXt runtime). llvm-svn: 110213
* When creating a jump destination, its scope should be the scope of theJohn McCall2010-07-281-1/+3
| | | | | | | | | enclosing normal cleanup, not the top of the EH stack. I'm *really* surprised this hasn't been causing more problems. Fixes rdar://problem/8231514. llvm-svn: 109569
* Revise cleanup IR generation to fix a major bug with cleanups (PR7686)John McCall2010-07-231-33/+87
| | | | | | | as well as some significant asymptotic inefficiencies with threading multiple jumps through deep cleanups. llvm-svn: 109274
* Rename LazyCleanup -> Cleanup. No functionality change for these last threeJohn McCall2010-07-211-25/+26
| | | | | | commits. llvm-svn: 109000
* Rip out EHCleanupScope.John McCall2010-07-211-6/+0
| | | | llvm-svn: 108999
* Kill the CleanupBlock API.John McCall2010-07-211-21/+0
| | | | llvm-svn: 108998
* Switch the destructor for a temporary arising from a reference binding over toJohn McCall2010-07-211-0/+6
| | | | | | using a lazy cleanup. llvm-svn: 108994
* Switch finally cleanups over to being lazy cleanups. We get basically nothingJohn McCall2010-07-211-0/+8
| | | | | | | from the laziness features here except better block ordering, but it removes yet another CleanupBlock use. llvm-svn: 108990
* Implement proper base/member destructor EH chaining.John McCall2010-07-211-5/+5
| | | | llvm-svn: 108989
* Implement zero-initialization for array new when there is anDouglas Gregor2010-07-211-2/+4
| | | | | | | | | initializer of (). Make sure to use a simple memset() when we can, or fall back to generating a loop when a simple memset will not suffice. Fixes <rdar://problem/8212208>, a regression due to my work in r107857. llvm-svn: 108977
* Add a little helper method which will be useful soon.John McCall2010-07-211-0/+4
| | | | llvm-svn: 108972
* Follow the implementation approach suggested by PR6687,Chris Lattner2010-07-201-5/+1
| | | | | | | | | | | | | | | | | | | | | | which generates more efficient and more obviously conformant code. We now test for overflow of the multiply then force the result to -1 if so. On X86, this generates nice code like this: __Z4testl: ## @_Z4testl ## BB#0: ## %entry subl $12, %esp movl $4, %eax mull 16(%esp) testl %edx, %edx movl $-1, %ecx cmovel %eax, %ecx movl %ecx, (%esp) call __Znam addl $12, %esp ret llvm-svn: 108927
* implement rdar://5739832 - operator new should check for overflow in multiply,Chris Lattner2010-07-201-2/+6
| | | | | | | | | | | | | | | | | | | | causing clang to compile this code into something that correctly throws a length error, fixing a potential integer overflow security attack: void *test(long N) { return new int[N]; } int main() { test(1L << 62); } We do this even when exceptions are disabled, because it is better for the code to abort than for the attack to succeed. This is heavily based on a patch that Fariborz wrote. llvm-svn: 108915
* Fix for PR3800: make sure not to evaluate the expression for a read-writeEli Friedman2010-07-161-0/+5
| | | | | | asm operand twice. llvm-svn: 108489
* Work around an obnoxious GCC warning by changing semantics in a hopefully-John McCall2010-07-131-7/+12
| | | | | | harmless way. llvm-svn: 108295
* Allow for the possibility that __cxa_end_catch might throw for a catch-all blockJohn McCall2010-07-131-0/+16
| | | | | | | or a catch of a record type by value or reference. Also convert this to a lazy cleanup. llvm-svn: 108287
* Teach IR generation how to lazily emit cleanups. This has a lot of advantages,John McCall2010-07-131-2/+52
| | | | | | | | | | | | | | | mostly in avoiding unnecessary work at compile time but also in producing more sensible block orderings. Move the destructor cleanups for local variables over to use lazy cleanups. Eventually all cleanups will do this; for now we have some awkward code duplication. Tell IR generation just to never produce landing pads in -fno-exceptions. This is a much more comprehensive solution to a problem which previously was half-solved by checks in most cleanup-generation spots. llvm-svn: 108270
* Reinstate the fix for PR7556. A silly use of isTrivial() wasDouglas Gregor2010-07-081-1/+1
| | | | | | suppressing copies of objects with trivial copy constructors. llvm-svn: 107857
* Revert r107828 and r107827, the fix for PR7556, which seems to beDouglas Gregor2010-07-071-1/+1
| | | | | | breaking bootstrap on Linux. llvm-svn: 107837
* Rename CXXZeroInitValueExpr to CXXScalarValueInitExpr, to reflect itsDouglas Gregor2010-07-071-1/+1
| | | | | | newly-narrowed scope. No functionality change. llvm-svn: 107828
* Teach function-try-blocks on constructors and destructors to implicitlyJohn McCall2010-07-071-3/+2
| | | | | | rethrow. Fixes rdar://problem/7696603 llvm-svn: 107757
* Provide a hook for the benefit of clients using clang IR gen as a subroutine:John McCall2010-07-061-0/+2
| | | | | | | | | | | | emit metadata associating allocas and global values with a Decl*. This feature is controlled by an option that (intentionally) cannot be enabled on the command line. To use this feature, simply set CodeGenOptions.EmitDeclMetadata = true; and then interpret the completely underspecified metadata. :) llvm-svn: 107739
* Validated by nightly-test runs on x86 and x86-64 darwin, including afterJohn McCall2010-07-061-218/+362
| | | | | | | | | | | | | | | | | | | | | | | | self-host. Hopefully these results hold up on different platforms. I tried to keep the GNU ObjC runtime happy, but it's hard for me to test. Reimplement how clang generates IR for exceptions. Instead of creating new invoke destinations which sequentially chain to the previous destination, push a more semantic representation of *why* we need the cleanup/catch/filter behavior, then collect that information into a single landing pad upon request. Also reorganizes how normal cleanups (i.e. cleanups triggered by non-exceptional control flow) are generated, since it's actually fairly closely tied in with the former. Remove the need to track which cleanup scope a block is associated with. Document a lot of previously poorly-understood (by me, at least) behavior. The new framework implements the Horrible Hack (tm), which requires every landing pad to have a catch-all so that inlining will work. Clang no longer requires the Horrible Hack just to make exceptions flow correctly within a function, however. The HH is an unfortunate requirement of LLVM's EH IR. llvm-svn: 107631
* in the "coerce" case, the ABI handling code ends up making theChris Lattner2010-07-051-2/+2
| | | | | | | | | alloca for an argument. Make sure the argument gets the proper decl alignment, which may be different than the type alignment. This fixes PR7567 llvm-svn: 107627
* finally get around to doing a significant cleanup to irgen:Chris Lattner2010-06-271-1/+2
| | | | | | | | 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
* Change IR generation for return (in the simple case) to avoid doing sillyChris Lattner2010-06-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Change EmitReferenceBindingToExpr to take a decl instead of a boolean.Anders Carlsson2010-06-261-1/+2
| | | | llvm-svn: 106949
* IRGen for trivial initialization of dynamiccaly allocatedFariborz Jahanian2010-06-251-0/+3
| | | | | | array of other done c++ objects. Fixes PR7490. llvm-svn: 106869
* Patch to correctly mangle block helper functionsFariborz Jahanian2010-06-241-1/+2
| | | | | | | when block literal is declared inside a ctor/dtor. Fixes radr 8096995. llvm-svn: 106700
* implement support for -finstrument-functions, patch by NelsonChris Lattner2010-06-221-0/+9
| | | | | | Elhage! llvm-svn: 106507
* Fix PR7097, a bad interaction between -fno-use-cxa-atexit andChris Lattner2010-06-191-1/+1
| | | | | | -mconstructor-aliases by using a WeakVH instead of a raw pointer. llvm-svn: 106384
* Objective-c++ IRGen. Support for @selector expression asFariborz Jahanian2010-06-171-0/+1
| | | | | | an lvalue. Fixes PR7390. llvm-svn: 106235
* Add some missing shiftsNate Begeman2010-06-141-2/+3
| | | | | | | | Fix multiplies by scalar Add SemaChecking code for all immediates Add SemaChecking-gen support to arm_neon.td llvm-svn: 105930
* Most of remaining builtins, 2 generics, vld, and rounding shfits remain.Nate Begeman2010-06-111-0/+2
| | | | llvm-svn: 105848
* support _lane ops, and multiplies by scalar.Nate Begeman2010-06-101-1/+2
| | | | llvm-svn: 105770
* Rename __tcf_ to __cxx_global_array_dtor. Remove the ↵Anders Carlsson2010-06-081-1/+0
| | | | | | UniqueAggreDestructorCount from CodeGenFunction and let LLVM handle uniquing the internal functions instead. llvm-svn: 105648
* Simplify GenerateCXXAggrDestructorHelper.Anders Carlsson2010-06-081-3/+3
| | | | llvm-svn: 105646
* Fix NEON intrinsic argument passing, support vext. Most now successfully ↵Nate Begeman2010-06-081-0/+4
| | | | | | make it through codegen to the .s file llvm-svn: 105599
* Correctly pass aggregates by reference when emitting thunks.John McCall2010-05-261-0/+5
| | | | llvm-svn: 104778
* Re-land the fix for PR7139.Anders Carlsson2010-05-221-2/+4
| | | | llvm-svn: 104446
* Push a return-value slot throughout ObjC message-send codegen. Will beJohn McCall2010-05-221-3/+6
| | | | | | | critical for ObjC++ correctness; hard to test independently of various required Sema changes, though. llvm-svn: 104422
* Unbreak self-host.Anders Carlsson2010-05-211-4/+2
| | | | llvm-svn: 104390
* Rename CodeGenFunction::EmitMemSetToZero to EmitNullInitialization. Handle ↵Anders Carlsson2010-05-211-2/+4
| | | | | | setting null data member pointers correctly. Fixes PR7139. llvm-svn: 104387
* Allocate space in a block record for implicit references to the Objective CJohn McCall2010-05-211-7/+7
| | | | | | | | | | 'self' variable arising from uses of the 'super' keyword. Also reorganize some code so that BlockInfo (now CGBlockInfo) can be opaque outside of CGBlocks.cpp. Fixes rdar://problem/8010633. llvm-svn: 104312
* When emitting an lvalue for an anonymous struct or union member duringJohn McCall2010-05-211-0/+3
| | | | | | | class initialization, drill down through an arbitrary number of anonymous records. llvm-svn: 104310
* Support implicitly closing on 'this' in a block. Fixed PR7165.John McCall2010-05-201-2/+3
| | | | | | (the codegen works here, too, but that's annoying to test without execution) llvm-svn: 104202
OpenPOWER on IntegriCloud