summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* Add CodeGenFunction::ReturnTypeUsesSretDaniel Dunbar2008-09-093-9/+17
| | | | | | - Hook so NeXT runtime doesn't depend on ABI. llvm-svn: 56034
* Move ABI specific code for functions / calls to CGCall.cpp:Daniel Dunbar2008-09-094-93/+117
| | | | | | - Factor out EmitFunction{Pro,Epi}log llvm-svn: 56031
* Factor CodeGenFunction::StartFunction out of GenerateCode andDaniel Dunbar2008-09-094-68/+62
| | | | | | StartObjCMethod. llvm-svn: 56030
* Use a unified return block.Daniel Dunbar2008-09-094-32/+53
| | | | | | | - For the time being this means our emitted code is somewhat worse, especially for aggregates. This will be fixed. llvm-svn: 56013
* Move EmitAggregate{Copy,Clear} into CodeGenFunction.Daniel Dunbar2008-09-092-44/+43
| | | | | | - No functionality change. llvm-svn: 56010
* Check in half-assed implementation of @try/@catch.Anders Carlsson2008-09-091-2/+164
| | | | llvm-svn: 55994
* Simple @throw support.Anders Carlsson2008-09-091-1/+12
| | | | llvm-svn: 55991
* Add types and functions related to exceptions.Anders Carlsson2008-09-091-0/+93
| | | | llvm-svn: 55984
* Move handling of @try and @throw to the runtime class.Anders Carlsson2008-09-096-5/+59
| | | | llvm-svn: 55983
* Change CodeGen to emit calls using (RValue,Type) list:Daniel Dunbar2008-09-099-68/+60
| | | | | | | | | | | | | | - Add CodeGenFunction::EmitAnyExprToTemp o Like EmitAnyExpr, but emits aggregates to a temporary location if none is available. Seems like this should be simpler (even aside from using first class aggregates). - Killed CodeGenFunction::EmitCallArg (just append the pair) - Conversion of RValues to actual call arguments is now isolated in CodeGenFunction::EmitCall. llvm-svn: 55970
* Fix a number of issues w.r.t. emission of global for functions andDaniel Dunbar2008-09-082-70/+123
| | | | | | | | | | | | | | aliases. - Attributes specific to a definition are only set when the definition is seen. - Alias generation is delayed until the end of the module; necessary since the alias may reference forward. - Fixes: PR2743, <rdr://6140807&6094512> - Improves: <rdr://6095112> (added XFAIL) Also, print module on verification failures. llvm-svn: 55966
* Refactor parameter attribute handling:Daniel Dunbar2008-09-086-114/+230
| | | | | | | | | - Add CGCall.h for dealing with ABI issues related to calls. - Add CGFunctionInfo and CGCallInfo for capturing ABI relevant information about functions and calls. - Isolate LLVM parameter attribute handling inside CGCall.cpp llvm-svn: 55963
* Key LLVM types for TagDecl's off of the clang Type, since there is nowDaniel Dunbar2008-09-062-15/+27
| | | | | | a many-to-one relationship between TagDecl's and types. llvm-svn: 55870
* Change struct forward declarations and definitions to use unique ↵Ted Kremenek2008-09-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | RecordDecls, as opposed to creating a single RecordDecl and reusing it. This change effects both RecordDecls and CXXRecordDecls, but does not effect EnumDecls (yet). The motivation of this patch is as follows: - Capture more source information, necessary for refactoring/rewriting clients. - Pave the way to resolve ownership issues with RecordDecls with the forthcoming addition of DeclGroups. Current caveats: - Until DeclGroups are in place, we will leak RecordDecls not explicitly referenced by the AST. For example: typedef struct { ... } x; The RecordDecl for the struct will be leaked because the TypedefDecl doesn't refer to it. This will be solved with DeclGroups. - This patch also (temporarily) breaks CodeGen. More below. High-level changes: - As before, TagType still refers to a TagDecl, but it doesn't own it. When a struct/union/class is first referenced, a RecordType and RecordDecl are created for it, and the RecordType refers to that RecordDecl. Later, if a new RecordDecl is created, the pointer to a RecordDecl in RecordType is updated to point to the RecordDecl that defines the struct/union/class. - TagDecl and RecordDecl now how a method 'getDefinition()' to return the TagDecl*/RecordDecl* that refers to the TagDecl* that defines a particular enum/struct/class/union. This is useful from going from a RecordDecl* that defines a forward declaration to the RecordDecl* that provides the actual definition. Note that this also works for EnumDecls, except that in this case there is no distinction between forward declarations and definitions (yet). - Clients should no longer assume that 'isDefinition()' returns true from a RecordDecl if the corresponding struct/union/class has been defined. isDefinition() only returns true if a particular RecordDecl is the defining Decl. Use 'getDefinition()' instead to determine if a struct has been defined. - The main changes to Sema happen in ActOnTag. To make the changes more incremental, I split off the processing of enums and structs et al into two code paths. Enums use the original code path (which is in ActOnTag) and structs use the ActOnTagStruct. Eventually the two code paths will be merged, but the idea was to preserve the original logic both for comparison and not to change the logic for both enums and structs all at once. - There is NO CHAINING of RecordDecls for the same RecordType. All RecordDecls that correspond to the same type simply have a pointer to that type. If we need to figure out what are all the RecordDecls for a given type we can build a backmap. - The diff in CXXRecordDecl.[cpp,h] is actually very small; it just mimics the changes to RecordDecl. For some reason 'svn' marks the entire file as changed. Why is CodeGen broken: - Codegen assumes that there is an equivalence between RecordDecl* and RecordType*. This was true before because we only created one RecordDecl* for a given RecordType*, but it is no longer true. I believe this shouldn't be too hard to change, but the patch was big enough as it is. I have tested this patch on both the clang test suite, and by running the static analyzer over Postgresql and a large Apple-internal project (mix of Objective-C and C). llvm-svn: 55839
* Remove "NextDecl" from RecordDecl. This change touches many files that ↵Ted Kremenek2008-09-051-1/+1
| | | | | | | | where RecordDecl or CXXRecordDecl was constructed, always with an argument of 'NULL' for the previous declaration. The motivation behind this change is that chaining the RecordDecls is simply unnecessary. Once we create multiple RecordDecls for the same struct/union/class, clients that care about all the declarations of the same struct can build a back map by seeing which Decls refer to the same RecordType. llvm-svn: 55821
* Set sext/zext on function result.Daniel Dunbar2008-09-051-5/+12
| | | | | | - <rdar://problem/6156739> llvm-svn: 55815
* Set function attributes (sext, zext, etc.) on Objective-C methods.Daniel Dunbar2008-09-043-31/+73
| | | | llvm-svn: 55812
* Fix infinite loop in for ... in code generation.Daniel Dunbar2008-09-041-1/+1
| | | | | | - Patch via Thomas Clement, thanks! llvm-svn: 55804
* NeXT: Emit lazy reference to Protocol class for forward protocolDaniel Dunbar2008-09-041-0/+5
| | | | | | references (to match gcc). llvm-svn: 55760
* Avoid superfluous errors regarding variable-length arrays (casts).Daniel Dunbar2008-09-045-9/+23
| | | | llvm-svn: 55759
* Implement codegen of aggregates as lvalues in binary expressions,Daniel Dunbar2008-09-042-1/+17
| | | | | | e.g. "(a = b).somefield". llvm-svn: 55758
* Add __builtin_object_size support.Daniel Dunbar2008-09-031-0/+10
| | | | | | | - Currently CodeGen always returns a conservative value for this (-1 or 0 depending on the context). llvm-svn: 55735
* Fix ObjCPropertRefExpr to be able to encode all the information forDaniel Dunbar2008-09-032-11/+20
| | | | | | | uses which refer to methods not properties. - Not yet wired in Sema. llvm-svn: 55681
* codegen constant data as such. add QualType::isConstant()Nuno Lopes2008-09-011-0/+1
| | | | llvm-svn: 55603
* Handle mutation while enumerating correctly. Fix some bugs.Anders Carlsson2008-08-314-7/+79
| | | | llvm-svn: 55583
* Initial support for CodeGen of for ... in statements.Anders Carlsson2008-08-311-1/+151
| | | | llvm-svn: 55580
* Stub out CodeGenFunction::EmitObjCForCollectionStmt.Anders Carlsson2008-08-305-20/+34
| | | | | | Add CodeGenFunction::EmitMemSetToZero and make AggExprEmitter::EmitAggregateClear use it. llvm-svn: 55573
* Simplify some calls to Builder.CreateCallAnders Carlsson2008-08-302-22/+17
| | | | llvm-svn: 55567
* Add Objective-C property setter support.Daniel Dunbar2008-08-308-45/+120
| | | | | | | | | | | | | | | | | | | | | | - Change Obj-C runtime message API, drop the ObjCMessageExpr arg in favor of just result type and selector. Necessary so it can be reused in situations where we don't want to cons up an ObjCMessageExpr. - Update aggregate binary assignment to know about special property ref lvalues. - Add CodeGenFunction::EmitCallArg overload which takes an already emitted rvalue. Add CodeGenFunction::StoreComplexIntoAddr. Disabled logic in Sema for parsing Objective-C dot-syntax that accesses methods. This code does not search in the correct order and the AST node has no way of properly representing its results. Updated StmtDumper to print a bit more information about ObjCPropertyRefExprs. llvm-svn: 55561
* Refactor handling of calls:Daniel Dunbar2008-08-306-93/+158
| | | | | | | | | | | | | | | | - Added CodeGenFunction::EmitCall which just takes the callee, return type, and a list of (Value*,QualType) pairs. - Added CodeGenFunction::EmitCallArg which handles emitting code for a call argument and turning it into an appropriate (Value*,QualType) pair. - Changed Objective-C runtime interface so that the actual emission of arguments for message sends is (once again) done in the code to emit a message send. No intended functionality change, this is prep work for better ABI support and for Objective-C property setter support. llvm-svn: 55560
* Downgrade a number of FIXME asserts to ErrorUnsupported.Daniel Dunbar2008-08-296-25/+33
| | | | | | - Notably VLAs llvm-svn: 55544
* Add special "property reference" CodeGen::LValue type for emittingDaniel Dunbar2008-08-295-9/+67
| | | | | | | | Objective-C property references. - This handles property references "more correctly" but setters still don't work. llvm-svn: 55534
* Fix double-free error with sizeof applied to VLA types.Daniel Dunbar2008-08-281-0/+4
| | | | | | | | - PR2727. Also, fix warning in CodeGenTypes for new BlockPointer type. llvm-svn: 55479
* NeXT: Emit mostly-correct property type encoding.Daniel Dunbar2008-08-281-7/+15
| | | | | | - Added ASTContext::getObjCEncodingForPropertyDecl. llvm-svn: 55461
* Initial support for Obj-C dot-syntax for getters.Daniel Dunbar2008-08-274-23/+47
| | | | llvm-svn: 55410
* NeXT: Refactor protocol method metadata emission.Daniel Dunbar2008-08-271-81/+91
| | | | | | Also, fix category protocol list metadata. llvm-svn: 55405
* NeXT: Emit correct properties for category.Daniel Dunbar2008-08-261-3/+16
| | | | | | | - Was emitting duplicates of class properties instead of the category properties. llvm-svn: 55395
* NeXT: Emit metadata for synthetsized properties.Daniel Dunbar2008-08-261-38/+82
| | | | | | Also, fix method lookup to not use LLVM module symbol table. llvm-svn: 55390
* Objective-C @synthesize support.Daniel Dunbar2008-08-266-22/+147
| | | | | | | | | | | - Only supports simple assignment and atomic semantics are ignored. - Not quite usable yet because the methods do not actually get added to the class metadata. - Added ObjCPropertyDecl::getSetterKind (one of Assign, Copy, Retain). - Rearrange CodeGenFunction so synthesis can reuse function prolog / epilog code. llvm-svn: 55365
* Do typechecking and codegen for K&R-style function declarations Eli Friedman2008-08-251-4/+17
| | | | | | | correctly. Not a regression, but made more obvious by my recent fix which made function type compatibility checking a bit more strict. llvm-svn: 55339
* Support __PRETTY_FUNCTION__ and friends in Obj-C methods.Daniel Dunbar2008-08-252-22/+29
| | | | | | | | | | | | Add CodeGenFunction::EmitUnsupportedLValue - Gives error and returns undef value. Swap some asserts() over to using EmitUnsupportedLValue - Rumor has it users (and even some developers) prefer carat diagnostics to backtraces. - Works better in Release-Asserts to boot. llvm-svn: 55328
* Change another is-a-pointer check to check in terms of LLVM type.Daniel Dunbar2008-08-251-1/+1
| | | | llvm-svn: 55312
* Do is-a-pointer checks in terms of LLVM types inDaniel Dunbar2008-08-251-4/+6
| | | | | | | | | EmitScalarConversion(). - Important for allowing Obj-C void * to id<X> casts and so on. - Not sure about this fix however, perhaps Type should understand that id is effectively a pointer type. llvm-svn: 55311
* Fix Obj-C super sends inside class methods.Daniel Dunbar2008-08-254-36/+99
| | | | | | | - NeXT loads the super class at runtime; this required changing the runtime interface to pass more information down. llvm-svn: 55307
* Name struct types generated for Obj-C classes.Daniel Dunbar2008-08-251-1/+3
| | | | llvm-svn: 55304
* Use DenseMap on IdentifierInfo instead of StringMap.Daniel Dunbar2008-08-252-6/+7
| | | | llvm-svn: 55303
* NeXT: Emit symbols used to manage linking of Obj-C classes.Daniel Dunbar2008-08-251-1/+44
| | | | | | | | | | | - This ensures that references to undefined classes cause link errors. - NOTE: This relies on platform specific asm directives currently, this should be factored out. Also, don't emit a SYMBOLS metadata entry if there are no symbols. llvm-svn: 55302
* Handle emitting __builtin_huge_valf as a constant expr.Anders Carlsson2008-08-251-0/+28
| | | | llvm-svn: 55299
* Make code generation of ivar ref exprs more like member exprs.Anders Carlsson2008-08-251-19/+25
| | | | llvm-svn: 55298
* Handle static variables inside obj-c methods.Anders Carlsson2008-08-251-2/+6
| | | | llvm-svn: 55297
OpenPOWER on IntegriCloud