summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* Change IR generation for return (in the simple case) to avoid doing sillyChris Lattner2010-06-273-20/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* reduce indentationChris Lattner2010-06-261-34/+35
| | | | llvm-svn: 106967
* Implement rdar://7530813 - collapse multiple GEP instructions in IRgenChris Lattner2010-06-261-5/+40
| | | | | | | | | | | | | | | | | | | | This avoids generating two gep's for common array operations. Before we would generate something like: %tmp = load i32* %X.addr ; <i32> [#uses=1] %arraydecay = getelementptr inbounds [100 x i32]* %A, i32 0, i32 0 ; <i32*> [#uses=1] %arrayidx = getelementptr inbounds i32* %arraydecay, i32 %tmp ; <i32*> [#uses=1] %tmp1 = load i32* %arrayidx ; <i32> [#uses=1] Now we generate: %tmp = load i32* %X.addr ; <i32> [#uses=1] %arrayidx = getelementptr inbounds [100 x i32]* %A, i32 0, i32 %tmp ; <i32*> [#uses=1] %tmp1 = load i32* %arrayidx ; <i32> [#uses=1] Less IR is better at -O0. llvm-svn: 106966
* minor cleanup: don't emit the base of an array subscript until after Chris Lattner2010-06-261-8/+7
| | | | | | | we're done diddling around with the index stuff. Use a cheaper type comparison. llvm-svn: 106963
* fix inc/dec to honor -fwrapv and -ftrapv, implementing PR7426.Chris Lattner2010-06-261-4/+20
| | | | llvm-svn: 106962
* move scalar inc/dec codegen into ScalarExprEmitter instead Chris Lattner2010-06-262-97/+111
| | | | | | of being in CGF. No functionality change. llvm-svn: 106961
* use more efficient type comparison predicates.Chris Lattner2010-06-264-6/+6
| | | | llvm-svn: 106958
* Fix unary minus to trap on overflow with -ftrapv, refactoring binopChris Lattner2010-06-261-31/+34
| | | | | | code so we can use it from VisitUnaryMinus. llvm-svn: 106957
* Implement support for -fwrapv, rdar://7221421Chris Lattner2010-06-261-22/+44
| | | | | | | | | | | | As part of this, pull together trapv handling into the same enum. This also add support for NSW multiplies. This also makes PCH disagreement on overflow behavior silent, since it really doesn't matter except for warnings and codegen (no macros get defined etc). llvm-svn: 106956
* implement rdar://7432000 - signed negate should codegen as NSW.Chris Lattner2010-06-261-4/+9
| | | | | | While I'm in there, adjust pointer to member adjustments as well. llvm-svn: 106955
* Change EmitReferenceBindingToExpr to take a decl instead of a boolean.Anders Carlsson2010-06-268-11/+15
| | | | llvm-svn: 106949
* Add function for mangling reference temporaries.Anders Carlsson2010-06-262-0/+11
| | | | llvm-svn: 106948
* Mangle pointer and (lvalue) reference types in the Microsoft C++ Mangler.Charles Davis2010-06-261-45/+88
| | | | | | | Also, fix mangling of throw specs. Turns out MSVC totally ignores throw specs when mangling names. llvm-svn: 106937
* Minor change to my last patch to fix PR7490.Fariborz Jahanian2010-06-251-4/+8
| | | | llvm-svn: 106875
* IRGen for trivial initialization of dynamiccaly allocatedFariborz Jahanian2010-06-252-19/+80
| | | | | | array of other done c++ objects. Fixes PR7490. llvm-svn: 106869
* Patch to correctly mangle block helper functionsFariborz Jahanian2010-06-247-16/+30
| | | | | | | when block literal is declared inside a ctor/dtor. Fixes radr 8096995. llvm-svn: 106700
* improve altivec vector bool/pixel support, patch by Anton YartsevChris Lattner2010-06-231-4/+12
| | | | | | with several tweaks by me. llvm-svn: 106619
* polish the -finstrument-functions implementation, patch by Nelson Elhage!Chris Lattner2010-06-231-3/+8
| | | | llvm-svn: 106618
* Type Type::isRealFloatingType() that vectors are not floating-pointDouglas Gregor2010-06-221-2/+2
| | | | | | | | | types, updating callers of both isFloatingType() and isRealFloatingType() accordingly. Caught at least one issue where we allowed one to declare a vector of vectors (!), along with cleaning up the standard-conversion logic for C++. llvm-svn: 106595
* Fixes a problem in generation of meta-data forFariborz Jahanian2010-06-221-2/+10
| | | | | | | category implementation whereby property list was missing. NeXt ObjC runtime (radar 8093297). llvm-svn: 106550
* Switch over to the new caching version of getMangledName.Anders Carlsson2010-06-225-51/+20
| | | | llvm-svn: 106549
* Add a new variant of getMangledName that caches the mangling for decls.Anders Carlsson2010-06-222-0/+40
| | | | llvm-svn: 106547
* Add GlobalDecl::getCanonicalDecl.Anders Carlsson2010-06-221-1/+9
| | | | llvm-svn: 106546
* Per Chris's comment, remove another static (this oneFariborz Jahanian2010-06-222-18/+15
| | | | | | is a static comparator operator). llvm-svn: 106511
* implement support for -finstrument-functions, patch by NelsonChris Lattner2010-06-222-0/+50
| | | | | | Elhage! llvm-svn: 106507
* Avoid using a local static for providing lexicalFariborz Jahanian2010-06-211-3/+1
| | | | | | order of priorotized global object initializations. llvm-svn: 106503
* In fragile-abi (32bit mode abi) generate global symbolFariborz Jahanian2010-06-211-1/+11
| | | | | | | objc_category_name_xxx for each category implementation. (fixes PR7431) patch by Nico Weber. llvm-svn: 106492
* In supporting init-priority, globals with the same init_priority must beFariborz Jahanian2010-06-212-3/+31
| | | | | | emitted in the order in which they are seen (still radar 8076356). llvm-svn: 106485
* Fix an Obj-C++ miscompile when calling an Obj-C method that returns a C++ ↵Anders Carlsson2010-06-213-5/+20
| | | | | | reference. llvm-svn: 106477
* Use more efficient API of SmallVector/array_pod_sortFariborz Jahanian2010-06-211-3/+3
| | | | | | for sorting (radar 8076356). llvm-svn: 106453
* IRGen for implementation of init-priority attribute.Fariborz Jahanian2010-06-212-5/+30
| | | | | | | Test case will be checked in llvm test suite. (finishes off radar 8076356). llvm-svn: 106441
* Instantiations subject to an explicit template instantiationDouglas Gregor2010-06-211-7/+32
| | | | | | | declaration have default visibility even under -fvisibility=hidden. Fixes <rdar://problem/8109763>. llvm-svn: 106440
* Implement remaining codegen for NEON, all operations should now work.Nate Begeman2010-06-201-41/+173
| | | | llvm-svn: 106407
* More AltiVec support.Anton Korobeynikov2010-06-191-3/+44
| | | | | | Patch by Anton Yartsev! llvm-svn: 106387
* Fix for PR7415: refactor CodeGenModule::MayDeferGeneration and make it lessEli Friedman2010-06-191-59/+45
| | | | | | conservative for static variables in templated classes. llvm-svn: 106385
* Fix PR7097, a bad interaction between -fno-use-cxa-atexit andChris Lattner2010-06-193-10/+7
| | | | | | -mconstructor-aliases by using a WeakVH instead of a raw pointer. llvm-svn: 106384
* Mangle tag types (unions, structs, classes, enums) in the Microsoft C++ Mangler.Charles Davis2010-06-181-0/+63
| | | | | | | Also, test that static members with default visibility in a struct have the right mangling. llvm-svn: 106276
* objective-C++ IRGen: property reference as an Fariborz Jahanian2010-06-171-1/+9
| | | | | | | | lvalue when performing a derived-to-base conversion. Fixes radar 7501812. Added an executable test to llvm-test suite. llvm-svn: 106247
* Objective-c++ IRGen. Support for @selector expression asFariborz Jahanian2010-06-175-13/+35
| | | | | | an lvalue. Fixes PR7390. llvm-svn: 106235
* Mangle operator names in the Microsoft C++ Mangler.Charles Davis2010-06-171-1/+131
| | | | llvm-svn: 106211
* Remove last of the bool shifts for MS VC++, patch by dimitry andricNate Begeman2010-06-171-5/+5
| | | | llvm-svn: 106206
* Update CMake build for new attribute changes.Alexis Hunt2010-06-171-1/+2
| | | | llvm-svn: 106188
* Change the test for which ABI/CC to use on ARM to be base on the environmentRafael Espindola2010-06-161-3/+4
| | | | | | (the last argument of the triple). llvm-svn: 106131
* Fixed conflict between objc_memmove_collectable builtin Fariborz Jahanian2010-06-161-1/+1
| | | | | | decl. and one ddefined in darwin header file. llvm-svn: 106107
* Don't set the calling convention for ARM if it is already the default.Rafael Espindola2010-06-161-3/+11
| | | | llvm-svn: 106106
* Start mangling function types in the Microsoft C++ Mangler.Charles Davis2010-06-161-4/+201
| | | | llvm-svn: 106081
* Give Type::isIntegralType() an ASTContext parameter, so that itDouglas Gregor2010-06-162-3/+3
| | | | | | | | | | | | provides C "integer type" semantics in C and C++ "integral type" semantics in C++. Note that I still need to update isIntegerType (and possibly other predicates) using the same approach I've taken for isIntegralType(). The two should have the same meaning, but currently don't (!). llvm-svn: 106074
* Introduce Type::isIntegralOrEnumerationType(), to cover those placesDouglas Gregor2010-06-161-1/+1
| | | | | | | | | | in C++ that involve both integral and enumeration types. Convert all of the callers to Type::isIntegralType() that are meant to work with both integral and enumeration types over to Type::isIntegralOrEnumerationType(), to prepare to eliminate enumeration types as integral types. llvm-svn: 106071
* Move CodeGenOptions.h *back* into Frontend. This should have been done when theChandler Carruth2010-06-1510-10/+10
| | | | | | dependency edge was reversed such that CodeGen depends on Frontend. llvm-svn: 106065
* Patch adds support for copying of thoseFariborz Jahanian2010-06-156-32/+61
| | | | | | | | objective-c++ class objects which have GC'able objc object pointers and need to use ObjC's objc_memmove_collectable API (radar 8070772). llvm-svn: 106061
OpenPOWER on IntegriCloud