summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
* Call objc_terminate() instead of abort() when a cleanup throws anJohn McCall2011-07-061-2/+11
| | | | | | | exception in Objective-C; in Objective-C++ we still use std::terminate(). This is only available in very recent runtimes. llvm-svn: 134456
* Change the driver's logic about Objective-C runtimes: abstract out aJohn McCall2011-07-061-8/+2
| | | | | | | | | | | | structure to hold inferred information, then propagate each invididual bit down to -cc1. Separate the bits of "supports weak" and "has a native ARC runtime"; make the latter a CodeGenOption. The tool chain is still driving this decision, because it's the place that has the required deployment target information on Darwin, but at least it's better-factored now. llvm-svn: 134453
* Add the ObjC ARC optimization passes manually, now that they're notDan Gohman2011-07-052-6/+42
| | | | | | hardwired into the default pass list. llvm-svn: 134445
* Don't use x86_mmx where it isn't necessary.Eli Friedman2011-07-021-6/+1
| | | | | | The start of some work on getting -mno-mmx working the way we want it to. llvm-svn: 134300
* Update for llvm commit r134291.Eric Christopher2011-07-021-2/+2
| | | | | | Fixes rdar://9714064 llvm-svn: 134292
* Emit guard variables for any weak global that has a run-timeDouglas Gregor2011-07-011-6/+5
| | | | | | | initializer. Previously, we only used guard variables for weak static data members. Fixes <rdar://problem/9692249>. llvm-svn: 134266
* Don't zero-initialize default-initialized local variables that haveDouglas Gregor2011-07-011-1/+18
| | | | | | | | trivial default constructors. This generated-code regression was caused by r131796, which had simplified the handling of default initialization in Sema. Fixes <rdar://problem/9694300>. llvm-svn: 134260
* Add support for weakly imported classes (GNU runtime).David Chisnall2011-06-301-5/+8
| | | | llvm-svn: 134140
* createTargetMachine now takes a CPU string.Evan Cheng2011-06-301-3/+3
| | | | llvm-svn: 134128
* objc-arc: fix a IRGen crash when checking forFariborz Jahanian2011-06-291-1/+2
| | | | | | | accessibility of an initializer which is a compound statement. // rdar://9694706 llvm-svn: 134091
* Use existing -fcatch-undefined-behavior option,Fariborz Jahanian2011-06-291-1/+1
| | | | | | replacing -freset-local-blocks. // rdar://9227352 llvm-svn: 134082
* Add ARC support for the GNUstep runtime.David Chisnall2011-06-291-6/+20
| | | | llvm-svn: 134065
* We don't pass classes with a copy-constructor or destructor byval, so the ↵Eli Friedman2011-06-291-0/+2
| | | | | | | | | | address takes up an integer register (if one is available). Make sure the x86-64 ABI implementation takes that into account properly. The fixed implementation is compatible with the implementation both gcc and llvm-gcc use. rdar://9686430 . (This is the issue that was reported in the thread "[LLVMdev] Segfault calling LLVM libs from a clang-compiled executable".) llvm-svn: 134059
* SubtargetFeature.h has been moved to MC.Evan Cheng2011-06-291-1/+1
| | | | llvm-svn: 134050
* Under a compiler flag, -freset-local-blocks,Fariborz Jahanian2011-06-281-0/+19
| | | | | | | wipe out stack blocks when they go out of scope. // rdar://9227352 llvm-svn: 134045
* Split out logic for valid clobbers and valid inline asm registers.Eric Christopher2011-06-281-0/+1
| | | | | | Fixes rdar://9281377 llvm-svn: 134016
* Eliminate most uses of ShallowCollectObjCIvars which requiresFariborz Jahanian2011-06-282-25/+24
| | | | | | | a vector for collection. Use iterators where needed instead. // rdar://6817577 llvm-svn: 134015
* Fix PR10204 in a better way.John McCall2011-06-271-3/+1
| | | | llvm-svn: 133943
* Revert parts of r133860 to fix a crash. Add a test.Nico Weber2011-06-271-1/+3
| | | | llvm-svn: 133931
* Cleanup cast IRGen a bit; no intended functionality change.Eli Friedman2011-06-252-34/+65
| | | | llvm-svn: 133864
* Do not apply the ARC move optimization to 'const'-qualified xvalues.John McCall2011-06-251-1/+1
| | | | llvm-svn: 133861
* LValue carries a type now, so simplify the main EmitLoad/Store APIsJohn McCall2011-06-259-104/+93
| | | | | | by removing the redundant type parameter. llvm-svn: 133860
* Mark the multiply which occurs as part of performing pointerJohn McCall2011-06-252-167/+164
| | | | | | | | arithmetic on a VLA as 'nsw', per discussion with djg, and implement pointer arithmetic (other than array accesses) and pointer subtraction for VLA types. llvm-svn: 133855
* Honor objc_precise_lifetime in GC mode by feeding the valueJohn McCall2011-06-243-0/+42
| | | | | | | in the variable to an inline asm which gets run when the variable goes out of scope. llvm-svn: 133840
* Revert "Shorten some ARM builtin names by removing unnecessary "neon" prefix."Bob Wilson2011-06-241-197/+197
| | | | | | | | Sorry, this was a bad idea. Within clang these builtins are in a separate "ARM" namespace, but the actual builtin names should clearly distinguish tha they are target specific. llvm-svn: 133833
* Fix struct member's scope. Patch by Xi Wang.Devang Patel2011-06-242-24/+29
| | | | llvm-svn: 133829
* Change the IR-generation of VLAs so that we capture bounds,John McCall2011-06-248-106/+187
| | | | | | | not sizes; so that we use well-typed allocas; and so that we properly recurse through the full set of variably-modified types. llvm-svn: 133827
* Shorten some ARM builtin names by removing unnecessary "neon" prefix.Bob Wilson2011-06-241-197/+197
| | | | llvm-svn: 133826
* Support for catching objc pointer objects in c++ catch-statementFariborz Jahanian2011-06-234-10/+17
| | | | | | in fragile abi mode and some other cleanups. // rdar://8940528 llvm-svn: 133747
* Alloa catching Objective-C id's being thrown with C++ throwFariborz Jahanian2011-06-224-12/+19
| | | | | | in Darwin's fragile abi mode. // rdar://8940528 llvm-svn: 133639
* Try to silence GCC warningDouglas Gregor2011-06-221-0/+2
| | | | llvm-svn: 133623
* Implement the C++0x move optimization for Automatic Reference CountingDouglas Gregor2011-06-221-0/+25
| | | | | | | | objects, so that we steal the retain count of a temporary __strong pointer (zeroing out that temporary), eliding a retain/release pair. Addresses <rdar://problem/9364932>. llvm-svn: 133621
* When binding a reference to an Automatic Reference Counting temporary,Douglas Gregor2011-06-223-38/+162
| | | | | | | | | retain/release the temporary object appropriately. Previously, we would only perform the retain/release operations when the reference would extend the lifetime of the temporary, but this does the wrong thing across calls. llvm-svn: 133620
* Replace the existing forms of ConstantArray::get() with a single formJay Foad2011-06-223-4/+3
| | | | | | that takes an ArrayRef. llvm-svn: 133615
* Emit @finally blocks completely lazily instead of forcing theirJohn McCall2011-06-223-71/+79
| | | | | | | | | | | | | existence by always threading an edge from the catchall. Not doing this was previously causing a crash in the very extreme case where neither the normal cleanup nor the EH catchall was actually reachable: we would delete the catchall entry block, which would cause us to delete the entry block of the finally cleanup as well because the cleanup logic would merge the blocks, which in turn triggered an assert because later blocks in the finally would still be using values from the entry. Laziness turns out to be the most elegant solution to the problem. llvm-svn: 133601
* IRgen: Add a -fuse-register-sized-bitfield-access option, for testing.Daniel Dunbar2011-06-211-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Changes bit-field access policy to try to use (aligned) register sized accesses. The idea here is that by using larger accesses we expose more coalescing potential to the backend when we have situations like adjacent bit-fields in the same structure (which is common), and that the backend should be smart enough to narrow the accesses down when no coalescing is done or when it is shown not to be profitable. -- $ clang -m32 -O3 -S -o - t.c _f0: ## @f0 pushl %ebp movl %esp, %ebp movl 8(%ebp), %eax movb (%eax), %cl andb $-128, %cl orb $1, %cl movb %cl, (%eax) movb 1(%eax), %cl andb $-128, %cl orb $1, %cl movb %cl, 1(%eax) movb 2(%eax), %cl andb $-128, %cl orb $1, %cl movb %cl, 2(%eax) movb 3(%eax), %cl andb $-128, %cl orb $1, %cl movb %cl, 3(%eax) popl %ebp ret $ clang -m32 -O3 -S -o - t.c -Xclang -fuse-register-sized-bitfield-access _f0: ## @f0 pushl %ebp movl %esp, %ebp movl 8(%ebp), %eax movl $-2139062144, %ecx ## imm = 0xFFFFFFFF80808080 andl (%eax), %ecx orl $16843009, %ecx ## imm = 0x1010101 movl %ecx, (%eax) popl %ebp ret -- llvm-svn: 133532
* IRgen: Add CGOptions to CGTypes.Daniel Dunbar2011-06-213-4/+8
| | | | llvm-svn: 133530
* A few tweaks to MaterializeTemporaryExpr suggested by John.Douglas Gregor2011-06-211-3/+1
| | | | llvm-svn: 133528
* Introduce a new AST node describing reference binding to temporaries.Douglas Gregor2011-06-214-2/+27
| | | | | | | | | | | | | | | | | | | | | | | | | MaterializeTemporaryExpr captures a reference binding to a temporary value, making explicit that the temporary value (a prvalue) needs to be materialized into memory so that its address can be used. The intended AST invariant here is that a reference will always bind to a glvalue, and MaterializeTemporaryExpr will be used to convert prvalues into glvalues for that binding to happen. For example, given const int& r = 1.0; The initializer of "r" will be a MaterializeTemporaryExpr whose subexpression is an implicit conversion from the double literal "1.0" to an integer value. IR generation benefits most from this new node, since it was previously guessing (badly) when to materialize temporaries for the purposes of reference binding. There are likely more refactoring and cleanups we could perform there, but the introduction of MaterializeTemporaryExpr fixes PR9565, a case where IR generation would effectively bind a const reference directly to a bitfield in a struct. Addresses <rdar://problem/9552231>. llvm-svn: 133521
* De-Unicode-ify in comments.NAKAMURA Takumi2011-06-211-1/+1
| | | | llvm-svn: 133501
* Add support for -Wa,--noexecstack when building from a non-assembly file. ForNick Lewycky2011-06-211-0/+2
| | | | | | | an assembly file it worked correctly, while for a .c file it would given an error about how --noexecstack is not a supported argument to -Wa. llvm-svn: 133489
* Canonicalize register names properly.Eric Christopher2011-06-211-0/+2
| | | | | | Fixes rdar://9425559 llvm-svn: 133486
* llvm-gcc treats a tentative definition with a previousFariborz Jahanian2011-06-201-1/+2
| | | | | | | | | (or follow up) extern declaration with weak_import as an actual definition. make clang follows this behavior. // rdar://9538608 llvm-gcc treats an extern declaration with weak_import llvm-svn: 133450
* Change how PHINodes store their operands.Jay Foad2011-06-201-3/+3
| | | | | | | | | | | | | | | | | | | Change PHINodes to store simple pointers to their incoming basic blocks, instead of full-blown Uses. Note that this loses an optimization in SplitCriticalEdge(), because we can no longer walk the use list of a BasicBlock to find phi nodes. See the comment I removed starting "However, the foreach loop is slow for blocks with lots of predecessors". Extend replaceAllUsesWith() on a BasicBlock to also update any phi nodes in the block's successors. This mimics what would have happened when PHINodes were proper Users of their incoming blocks. (Note that this only works if OldBB->replaceAllUsesWith(NewBB) is called when OldBB still has a terminator instruction, so it still has some successors.) llvm-svn: 133435
* Remove more unnecessary #include <llvm/ADT/SmallVector.h>Francois Pichet2011-06-201-1/+0
| | | | llvm-svn: 133418
* Update to match mainline ConstantStruct::get API change. Also, use Chris Lattner2011-06-207-59/+60
| | | | | | | | | | | ConvertType on InitListExprs as they are being converted. This is needed for a forthcoming patch, and improves the IR generated anyway (see additional type names in testcases). This patch also converts a bunch of std::vector's in CGObjCMac to use C arrays. There are a ton more that should be converted as well. llvm-svn: 133413
* update for api change.Chris Lattner2011-06-189-116/+66
| | | | llvm-svn: 133365
* Remove dead variables.Benjamin Kramer2011-06-183-6/+0
| | | | llvm-svn: 133346
* 80 cols.Benjamin Kramer2011-06-181-5/+5
| | | | llvm-svn: 133345
* When emitting a compound literal of POD type, continue to emit aDouglas Gregor2011-06-171-0/+10
| | | | | | | | | | | | | | | | | separate aggregate temporary and then memcpy it over to the destination. This fixes a regression I introduced with r133235, where the compound literal on the RHS of an assignment makes use of the structure on the LHS of the assignment. I'm deeply suspicious of AggExprEmitter::VisitBinAssign()'s optimization where it emits the RHS of an aggregate assignment directly into the LHS lvalue without checking whether there is any aliasing between the LHS/RHS. However, I'm not in a position to revisit this now. Big thanks to Eli for finding the regression! llvm-svn: 133261
OpenPOWER on IntegriCloud