summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenFunction.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Restore r121752 without modification.John McCall2010-12-141-5/+6
| | | | llvm-svn: 121763
* Pull out r121752 in case it's causing the selfhost breakage.John McCall2010-12-141-6/+5
| | | | llvm-svn: 121759
* Factor out most of the extra state in a FunctionProtoType into a separateJohn McCall2010-12-141-5/+6
| | | | | | | class to be passed around. The line between argument and return types and everything else is kindof vague, but I think it's justifiable. llvm-svn: 121752
* Added ParenType type node.Abramo Bagnara2010-12-101-0/+5
| | | | llvm-svn: 121488
* Use CodeGenFunction's getContext(), for consistency.Dan Gohman2010-10-291-1/+1
| | | | llvm-svn: 117734
* Permit constant evaluation of const floating-point variables withJohn McCall2010-10-091-1/+1
| | | | | | constant initializers. llvm-svn: 116138
* Remove unused argument.Devang Patel2010-10-061-1/+1
| | | | llvm-svn: 115789
* Teach PopCleanupBlock to correctly handle the possibility of branching throughJohn McCall2010-10-051-9/+14
| | | | | | | a EH-only cleanup as part of a fallthrough branch-through. That this happens for this test case is actually a separate bug. llvm-svn: 115668
* If we're resolving all outstanding fixups, and there are multiple fixupsJohn McCall2010-10-051-3/+4
| | | | | | | | | for the same destination, then we must potentially rewrite the initial branch of every fixup. Without this patch, a short-circuit check meant to prevent a switch case from being redundantly added was preventing later fixups from being processed. Fixes PR8175 (again). llvm-svn: 115586
* Patch implements passing arrays to functions expectingFariborz Jahanian2010-09-241-0/+3
| | | | | | vla. Implements pr7827. llvm-svn: 114737
* Adjust a fixup's starting branch if it's being resolved becauseJohn McCall2010-09-181-6/+29
| | | | | | | it reached the outermost scope and it hasn't yet been forwarded to a cleanup. Fixed PR8175. llvm-svn: 114259
* When emitting a new-expression inside a conditional expression,John McCall2010-09-171-11/+14
| | | | | | | | | | | | | | | | the cleanup might not be dominated by the allocation code. In this case, we have to store aside all the delete arguments in case we need them later. There's room for optimization here in cases where we end up not actually needing the cleanup in different branches (or being able to pop it after the initialization code). Also make sure we only call this operator delete along the path where we actually allocated something. Fixes rdar://problem/8439196. llvm-svn: 114145
* Implement the EH cleanup to call 'operator delete' if a new-expression throwsJohn McCall2010-09-141-82/+260
| | | | | | (but not if destructors associated with the full-expression throw). llvm-svn: 113836
* Teach IR generation to return 'this' from constructors and destructorsJohn McCall2010-08-311-39/+8
| | | | | | under the ARM ABI. llvm-svn: 112588
* GCC didn't care for my attempt at API compatibility, so brute-force everythingJohn McCall2010-08-251-3/+3
| | | | | | to the new constants. llvm-svn: 112047
* Go back to asking CodeGenTypes whether a type is zero-initializable.John McCall2010-08-221-2/+1
| | | | | | | | | Make CGT defer to the ABI on all member pointer types. This requires giving CGT a handle to the ABI. It's way easier to make that work if we avoid lazily creating the ABI. Make it so. llvm-svn: 111786
* Experiment with using first-class aggregates to represent member functionJohn McCall2010-08-221-1/+1
| | | | | | | | | | pointers. I find the resulting code to be substantially cleaner, and it makes it very easy to use the same APIs for data member pointers (which I have conscientiously avoided here), and it avoids a plethora of potential inefficiencies due to excessive memory copying, but we'll have to see if it actually works. llvm-svn: 111776
* Abstract more member-pointerness out.John McCall2010-08-221-1/+2
| | | | llvm-svn: 111771
* More cleanup enabling.John McCall2010-08-141-12/+20
| | | | llvm-svn: 111070
* Sketch out a framework for delaying the activation of a cleanup.John McCall2010-08-131-0/+67
| | | | | | Not yet complete or used. llvm-svn: 111044
* Revise r110163: don't mark weak functions nounwind, because the optimizerJohn McCall2010-08-111-0/+4
| | | | | | treats that as a contract to be fulfilled by any replacements. llvm-svn: 110864
* IRGen support for functions returning objc objectFariborz Jahanian2010-08-111-1/+1
| | | | | | types. Fixes PR7865. llvm-svn: 110832
* Simplify code and add comments, in code that generate debug info for ↵Devang Patel2010-08-101-11/+4
| | | | | | constant integer globals, based on Chris's feedback. llvm-svn: 110694
* Even if a constant's evaluated value is used, emit debug info for the ↵Devang Patel2010-08-101-0/+14
| | | | | | constant variable. llvm-svn: 110660
* Inline a special case of EmitAggregateCopy into EmitNullInitializationJohn McCall2010-08-071-27/+41
| | | | | | | | | to avoid the awesome-but-wrong-in-this-case assertion in the canon EAC. Fixes PR7834. Also fix a subtle address-space bug in the memset path. llvm-svn: 110511
* Do a very simple pass over every function we emit to infer whether we canJohn McCall2010-08-031-0/+18
| | | | | | | mark it nounwind based on whether it contains any non-nounwind calls. <rdar://problem/8087431> llvm-svn: 110163
* When creating a jump destination, its scope should be the scope of theJohn McCall2010-07-281-0/+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
* Test for the presence of EH branch-throughs instead of normal branch-throughs.John McCall2010-07-261-1/+1
| | | | | | I knew this code duplication would bite me. llvm-svn: 109463
* Remove the vast majority of the Destroy methods from the AST library,Douglas Gregor2010-07-251-8/+0
| | | | | | since we aren't going to be calling them ever. llvm-svn: 109377
* Revise cleanup IR generation to fix a major bug with cleanups (PR7686)John McCall2010-07-231-236/+449
| | | | | | | as well as some significant asymptotic inefficiencies with threading multiple jumps through deep cleanups. llvm-svn: 109274
* Keep track of artificial scopes introduced by line directives. For example,Devang Patel2010-07-221-1/+1
| | | | | | | | | | | | #line 41 "bar.c" dummy (1, i); #line 24 "bar.h" i = f2 (i); #line 44 "bar.c" This is tested by step-line.exp in gdb testsuite. llvm-svn: 109189
* Rename LazyCleanup -> Cleanup. No functionality change for these last threeJohn McCall2010-07-211-47/+42
| | | | | | commits. llvm-svn: 109000
* Rip out EHCleanupScope.John McCall2010-07-211-183/+4
| | | | llvm-svn: 108999
* Remove unused argument.Devang Patel2010-07-201-1/+1
| | | | llvm-svn: 108946
* Follow the implementation approach suggested by PR6687,Chris Lattner2010-07-201-39/+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-1/+39
| | | | | | | | | | | | | | | | | | | | 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
* Teach IR generation how to lazily emit cleanups. This has a lot of advantages,John McCall2010-07-131-0/+177
| | | | | | | | | | | | | | | 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
* Provide a hook for the benefit of clients using clang IR gen as a subroutine:John McCall2010-07-061-0/+3
| | | | | | | | | | | | 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
* When destroying a cleanup, kill any references to instructions in the entryJohn McCall2010-07-061-0/+6
| | | | | | | | block before deleting it. Fixes PR7575. This really just a short-term fix before implementing lazy cleanups. llvm-svn: 107676
* Validated by nightly-test runs on x86 and x86-64 darwin, including afterJohn McCall2010-07-061-191/+360
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Revert "IRgen: Make sure any prolog instructions get debug info.", the lexicalDaniel Dunbar2010-07-011-1/+0
| | | | | | | scope hasn't been set up yet so this isn't valid. It was just a cleanup to the IR, so I'm going to ignore it for now. llvm-svn: 107356
* IRgen: Make sure any prolog instructions get debug info.Daniel Dunbar2010-06-301-0/+1
| | | | llvm-svn: 107320
* misc tidyingChris Lattner2010-06-271-2/+1
| | | | llvm-svn: 106978
* finally get around to doing a significant cleanup to irgen:Chris Lattner2010-06-271-22/+18
| | | | | | | | 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
* polish the -finstrument-functions implementation, patch by Nelson Elhage!Chris Lattner2010-06-231-3/+8
| | | | llvm-svn: 106618
* implement support for -finstrument-functions, patch by NelsonChris Lattner2010-06-221-0/+41
| | | | | | Elhage! llvm-svn: 106507
* Rename __tcf_ to __cxx_global_array_dtor. Remove the ↵Anders Carlsson2010-06-081-2/+1
| | | | | | UniqueAggreDestructorCount from CodeGenFunction and let LLVM handle uniquing the internal functions instead. llvm-svn: 105648
* Improve name mangling for blocks and support mangling of static localDouglas Gregor2010-05-251-0/+1
| | | | | | | | | variables within blocks. We loosely follow GCC's mangling, but since these are always internal symbols the names don't really matter. I intend to revisit block mangling later, because GCC's mangling is rather verbose. <rdar://problem/8015719>. llvm-svn: 104610
* Re-land the fix for PR7139.Anders Carlsson2010-05-221-1/+20
| | | | llvm-svn: 104446
OpenPOWER on IntegriCloud