summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* Miscellaneous codegen cleanups. Mostly, don't create new basic blocksJohn McCall2010-04-214-44/+66
| | | | | | | just to save the current insertion state! This change significantly simplifies the IR CFG in exceptions code. llvm-svn: 101996
* Overhaul the AST representation of Objective-C message sendDouglas Gregor2010-04-211-18/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | expressions, to improve source-location information, clarify the actual receiver of the message, and pave the way for proper C++ support. The ObjCMessageExpr node represents four different kinds of message sends in a single AST node: 1) Send to a object instance described by an expression (e.g., [x method:5]) 2) Send to a class described by the class name (e.g., [NSString method:5]) 3) Send to a superclass class (e.g, [super method:5] in class method) 4) Send to a superclass instance (e.g., [super method:5] in instance method) Previously these four cases where tangled together. Now, they have more distinct representations. Specific changes: 1) Unchanged; the object instance is represented by an Expr*. 2) Previously stored the ObjCInterfaceDecl* referring to the class receiving the message. Now stores a TypeSourceInfo* so that we know how the class was spelled. This both maintains typedef information and opens the door for more complicated C++ types (e.g., dependent types). There was an alternative, unused representation of these sends by naming the class via an IdentifierInfo *. In practice, we either had an ObjCInterfaceDecl *, from which we would get the IdentifierInfo *, or we fell into the case below... 3) Previously represented by a class message whose IdentifierInfo * referred to "super". Sema and CodeGen would use isStr("super") to determine if they had a send to super. Now represented as a "class super" send, where we have both the location of the "super" keyword and the ObjCInterfaceDecl* of the superclass we're targetting (statically). 4) Previously represented by an instance message whose receiver is a an ObjCSuperExpr, which Sema and CodeGen would check for via isa<ObjCSuperExpr>(). Now represented as an "instance super" send, where we have both the location of the "super" keyword and the ObjCInterfaceDecl* of the superclass we're targetting (statically). Note that ObjCSuperExpr only has one remaining use in the AST, which is for "super.prop" references. The new representation of ObjCMessageExpr is 2 pointers smaller than the old one, since it combines more storage. It also eliminates a leak when we loaded message-send expressions from a precompiled header. The representation also feels much cleaner to me; comments welcome! This patch attempts to maintain the same semantics we previously had with Objective-C message sends. In several places, there are massive changes that boil down to simply replacing a nested-if structure such as: if (message has a receiver expression) { // instance message if (isa<ObjCSuperExpr>(...)) { // send to super } else { // send to an object } } else { // class message if (name->isStr("super")) { // class send to super } else { // send to class } } with a switch switch (E->getReceiverKind()) { case ObjCMessageExpr::SuperInstance: ... case ObjCMessageExpr::Instance: ... case ObjCMessageExpr::SuperClass: ... case ObjCMessageExpr::Class:... } There are quite a few places (particularly in the checkers) where send-to-super is effectively ignored. I've placed FIXMEs in most of them, and attempted to address send-to-super in a reasonable way. This could use some review. llvm-svn: 101972
* Fixes a code gen. bug by removing an assert.Fariborz Jahanian2010-04-201-2/+0
| | | | | | | It is ok to have c++-ness inside extern "C" block. Fixes pr6644. llvm-svn: 101948
* Back out r101911 and see if it makes the bots happy.Anders Carlsson2010-04-202-30/+13
| | | | llvm-svn: 101921
* IRgen: Always use i8 arrays to access union bit-fields. This is ugly, butDaniel Dunbar2010-04-201-15/+6
| | | | | | | matches how we currently handle structs, and this correctly handles -fno-bitfield-type-align. llvm-svn: 101918
* Fix a bug which triggered the assertion I added yesterday. Basically, when ↵Anders Carlsson2010-04-202-13/+30
| | | | | | we initialize the vtable pointer for a virtual base, and there was another path from the most derived class to another base with the same class type, we would use the wrong base. llvm-svn: 101911
* Move code to apply a non-virtual and virtual offset out into a separate ↵Anders Carlsson2010-04-201-19/+31
| | | | | | function. llvm-svn: 101909
* don't slap noalias attribute on stret result arguments.Chris Lattner2010-04-201-2/+1
| | | | | | | | | This mirror's Dan's patch for llvm-gcc in r97989, and fixes the miscompilation in PR6525. There is some contention over whether this is the right thing to do, but it is the conservative answer and demonstrably fixes a miscompilation. llvm-svn: 101877
* Pass the nearest virtual base decl to InitializeVTablePointers. No ↵Anders Carlsson2010-04-202-14/+11
| | | | | | functionality change right now. llvm-svn: 101872
* Assert that the path from the derived to the base class in ↵Anders Carlsson2010-04-201-0/+7
| | | | | | CodeGenFunction::GetAddressOfBaseClass is not ambiguous. llvm-svn: 101869
* Keep track of the actual storage specifier written on a variable orDouglas Gregor2010-04-192-8/+15
| | | | | | | | function declaration, since it may end up being changed (e.g., "extern" can become "static" if a prior declaration was static). Patch by Enea Zaffanella and Paolo Bolzoni. llvm-svn: 101826
* AST: Dump ASTRecordLayout objects when they are created with ↵Daniel Dunbar2010-04-191-1/+1
| | | | | | -fdump-record-layouts. llvm-svn: 101815
* IRgen: Kill unused function and move the type match assert to after record ↵Daniel Dunbar2010-04-191-13/+8
| | | | | | dumping. llvm-svn: 101814
* Check for darwin befoer cheking for version.Fariborz Jahanian2010-04-191-1/+2
| | | | | | (related to radar 7866951). llvm-svn: 101799
* Some renaming of methods, fixes typoFariborz Jahanian2010-04-193-5/+7
| | | | | | (related to PR6769). llvm-svn: 101794
* Force clang to produce legacy api for messagingFariborz Jahanian2010-04-191-1/+4
| | | | | | | in for pre-snowleoprd (NeXt runtime). Fixes radar 7866951 llvm-svn: 101791
* Add comment explaning the use of c99 inline in c++.Rafael Espindola2010-04-191-0/+4
| | | | llvm-svn: 101787
* Fix -Wcast-qual warnings.Dan Gohman2010-04-192-2/+3
| | | | llvm-svn: 101786
* Don't just emit ivar metadata - emit CORRECT ivar metadata. (GNU runtime)David Chisnall2010-04-191-2/+8
| | | | llvm-svn: 101759
* Fix emitting ivar metadata for synthesized ivars and some 64-bit fixes. (GNU ↵David Chisnall2010-04-191-12/+15
| | | | | | runtime) llvm-svn: 101758
* If a method is virtual and the class key function is in another file, emit ↵Rafael Espindola2010-04-192-1/+17
| | | | | | | | the method as available_externally. Fixes PR6747 llvm-svn: 101757
* Local static variables must be available module-wiseFariborz Jahanian2010-04-183-0/+12
| | | | | | | as they are accessible in static methods in a class local to the same function. Fixes PR6769. llvm-svn: 101756
* recommit r101568 to fix PR6766Nuno Lopes2010-04-181-8/+6
| | | | | | as a side-effect, remove two FIXMEs now fixed llvm-svn: 101726
* Simplify wide bit-field layout in CGRecordLayoutBuilder, and also fix a bug ↵Anders Carlsson2010-04-171-15/+10
| | | | | | where assigning to a bit-field member would overwrite other parts of the struct. llvm-svn: 101681
* Fix an assert when assigning a boolean value to a bitfield of type _Bool.Anders Carlsson2010-04-171-1/+5
| | | | llvm-svn: 101678
* Unnamed bit-fields in a union should be laid out with a type that doesn't ↵Anders Carlsson2010-04-171-1/+17
| | | | | | affect alignment. llvm-svn: 101673
* Factor union field layout code out into a separate function. No ↵Anders Carlsson2010-04-171-18/+31
| | | | | | functionality change. llvm-svn: 101671
* Vtable -> VTable renames across the board.Anders Carlsson2010-04-1716-102/+102
| | | | llvm-svn: 101666
* fix integrated assembler with i386 objc code.Chris Lattner2010-04-171-4/+4
| | | | llvm-svn: 101660
* Fix a bug where we would sometimes incorrectly mark an vtable function as ↵Anders Carlsson2010-04-171-6/+3
| | | | | | unused. llvm-svn: 101643
* Add raw_ostream operators to NamedDecl for convenience. Switch over all ↵Benjamin Kramer2010-04-172-2/+2
| | | | | | | | users of getNameAsString on a stream. The next step is to print the name directly into the stream, avoiding a temporary std::string copy. llvm-svn: 101632
* revert r101568, which miscompiles this testcase, distilled from ldecod:Chris Lattner2010-04-171-5/+6
| | | | | | | | | | void exit_picture() { char yuv_types[4][6]= {"4:0:0","4:2:0","4:2:2","4:4:4"}; foo(yuv_types); } llvm-svn: 101623
* fix PR6766: codegen of var initialized with wide charNuno Lopes2010-04-161-6/+5
| | | | llvm-svn: 101568
* fix a bogus assertion exposed by a recent change: packing theChris Lattner2010-04-161-1/+1
| | | | | | | | | | | | | | | | | struct may cause it to shrink more than one byte. Before my recent changes we compiled the new test into: %0 = type { [6 x i8] } @x = global %0 { [6 x i8] undef }, align 2 ; <%0*> [#uses=0] which is obviously bogus. Now we compile it into: %0 = type <{ i32, i8, i8 }> @x = global %0 zeroinitializer, align 2 ; <%0*> [#uses=0] Where the last byte only is tail padding. llvm-svn: 101536
* emit padding as undef values, take 2Nuno Lopes2010-04-161-3/+3
| | | | | | merge also a few tests I had here for this feature, and FileCheck'ize one file llvm-svn: 101535
* Make CGRecordLayoutBuilder deal with wide bit-fields. Will land tests ↵Anders Carlsson2010-04-161-1/+20
| | | | | | shortly (Daniel, please review). llvm-svn: 101472
* tidy upChris Lattner2010-04-161-1/+0
| | | | llvm-svn: 101447
* IRgen: Change CGBitFieldInfo to take the AccessInfo as constructor ↵Daniel Dunbar2010-04-153-20/+38
| | | | | | | | arguments, it is now an immutable object. Also, add some checking of various invariants that should hold on the CGBitFieldInfo access. llvm-svn: 101345
* IRgen: Eliminate now unused fields from CGBitFieldInfo.Daniel Dunbar2010-04-153-22/+15
| | | | llvm-svn: 101344
* IRgen: (Reapply 101222, with fixes) Move EmitStoreThroughBitfieldLValue to ↵Daniel Dunbar2010-04-151-88/+84
| | | | | | | | | | | | | | | | use new CGBitfieldInfo::AccessInfo decomposition, instead of computing the access policy itself. - Sadly, this doesn't seem to give any .ll size win so far. It is possible to make this routine significantly smarter & avoid various shifting, masking, and zext/sext, but I'm not really convinced it is worth it. It is tricky, and this is really instcombine's job. - No intended functionality change; the test case is just to increase coverage & serves as a demo file, it worked before this commit. The new fixes from r101222 are: 1. The shift to the target position needs to occur after the value is extended to the correct size. This broke Clang bootstrap, among other things no doubt. 2. Swap the order of arguments to OR, to get a tad more constant folding. llvm-svn: 101339
* Rewrite handling of 64-bit palignr intrinsics to be vector shuffles.Eric Christopher2010-04-151-2/+32
| | | | | | | | | Stop multiplying constant by 8 accordingly in the header and change intrinsic definition for what types we expect. Add to existing palignr test to check that we're emitting the correct things. llvm-svn: 101332
* IRgen/NeXT: Simplify to use AST record layout for getting offsets instead of theDaniel Dunbar2010-04-141-13/+4
| | | | | | IRgen record layout, which this code doesn't need to depend on. llvm-svn: 101257
* Speculatively revert "IRgen: Move EmitStoreThroughBitfieldLValue to use new ↵Daniel Dunbar2010-04-141-82/+88
| | | | | | CGBitfieldInfo::AccessInfo decomposition, instead of computing the access policy itself.", I think it might be breaking bootstrap. llvm-svn: 101235
* IRgen: Move EmitStoreThroughBitfieldLValue to use new ↵Daniel Dunbar2010-04-141-88/+82
| | | | | | | | | | CGBitfieldInfo::AccessInfo decomposition, instead of computing the access policy itself. - Sadly, this doesn't seem to give any .ll size win so far. It is possible to make this routine significantly smarter & avoid various shifting, masking, and zext/sext, but I'm not really convinced it is worth it. It is tricky, and this is really instcombine's job. - No intended functionality change; the test case is just to increase coverage & serves as a demo file, it worked before this commit. llvm-svn: 101222
* IRgen: Tweak CGBitFieldInfo doxyments & add an accessor.Daniel Dunbar2010-04-141-0/+10
| | | | llvm-svn: 101221
* implement altivec.h and a bunch of support code, patch by Anton Yartsev!Chris Lattner2010-04-141-0/+44
| | | | llvm-svn: 101215
* IRgen: Move EmitLoadOfBitfieldLValue to use new CGBitfieldInfo::AccessInfo ↵Daniel Dunbar2010-04-131-51/+61
| | | | | | | | | | | | decomposition, instead of computing the access policy itself. - This lets the method focus slightly more on emitting clean IR to honor the policy which has been selected. On 403.gcc's combine.c, x86_64, -O0, this reduces the number of lines in the .ll file (~= # of instructions) by 2.5%. - No intended functionality change -- at -O3 this should produce equivalent if not identical output. On 403.gcc's combine.c, x86_64, -O3, this isn't quite true and some of the changes are regressions, but I'm not going to worry about that until we move to a new access policy. - There is still some room for improvement in the generated IR, in particular we can usually fold the sign-extension of the bit-field into one of the component access. See the FIXME. llvm-svn: 101192
* IRgen: Enhance CGBitFieldInfo with enough information to fully describe the ↵Daniel Dunbar2010-04-133-6/+159
| | | | | | | | | | "policy" with which a bit-field should be accessed. - For now, these policies are computed to match the current IRgen strategy, although the new information isn't being used yet (except in -fdump-record-layouts). - Design comments appreciated. llvm-svn: 101178
* Removes a FIXME.Fariborz Jahanian2010-04-131-4/+2
| | | | llvm-svn: 101161
* Variation of objc_copyStruct API generation whenFariborz Jahanian2010-04-132-7/+22
| | | | | | | property (atomic/nonatomic) is of aggregate type with gc'able member objects) (NeXT runtime). llvm-svn: 101156
OpenPOWER on IntegriCloud