summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Move FunctionType conversion into CGCall.cpp:Daniel Dunbar2008-09-101-7/+8
| | | | | | | | | | | | | - Added CodeGenTypes::GetFunctionType, taking a CGFunctionInfo. - Updated Obj-C runtimes to use this instead of rolling the llvm::FunctionType by hand. - Killed CodeGenTypes::{ConvertReturnType, DecodeArgumentTypes}. Add ABIArgInfo class to encapsulate ABI decision of how to lower types to LLVM. - Will move to target sometime soon. llvm-svn: 56047
* Tweak CGCall functions again:Daniel Dunbar2008-09-101-5/+5
| | | | | | | | - Realized these functions will eventually need access to more data, moved to CodeGenModule. Eventually they should probably live together in some other helper class. llvm-svn: 56039
* Tweak CGCall functions:Daniel Dunbar2008-09-101-1/+4
| | | | | | | | - Move actual param attr list creation to CodeGenFunction::ConstructParamAttrList. - Make ReturnTypeUsesSret static. llvm-svn: 56038
* Fix a number of issues w.r.t. emission of global for functions andDaniel Dunbar2008-09-081-63/+109
| | | | | | | | | | | | | | 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-081-77/+27
| | | | | | | | | - 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
* 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-041-29/+62
| | | | llvm-svn: 55812
* Avoid superfluous errors regarding variable-length arrays (casts).Daniel Dunbar2008-09-041-2/+8
| | | | llvm-svn: 55759
* codegen constant data as such. add QualType::isConstant()Nuno Lopes2008-09-011-0/+1
| | | | llvm-svn: 55603
* Downgrade a number of FIXME asserts to ErrorUnsupported.Daniel Dunbar2008-08-291-3/+7
| | | | | | - Notably VLAs llvm-svn: 55544
* Objective-C @synthesize support.Daniel Dunbar2008-08-261-6/+34
| | | | | | | | | | | - 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
* Use DenseMap on IdentifierInfo instead of StringMap.Daniel Dunbar2008-08-251-5/+5
| | | | llvm-svn: 55303
* NeXT: Clean up constant CFString handling.Daniel Dunbar2008-08-231-17/+26
| | | | | | | | - Use CodeGenModule::GetAddrOfConstantCFString Some tweaks of CodeGenModule::GetAddrOfConstantCFString llvm-svn: 55243
* Add NeXT runtime support for generating methods.Daniel Dunbar2008-08-161-6/+1
| | | | | | | | | | | | | Change CodeGenFunction::EmitParmDecl to take either a ParmVarDecl or an ImplicitParamDecl. Drop hasAggregateLLVMType from CodeGenModule.cpp (use version in CodeGenFunction). Change the Objective-C method generation to use EmitParmDecl for implicit parameters. llvm-svn: 54838
* Change WarnUnsupported to ErrorUnsupported (in name and in practice).Daniel Dunbar2008-08-161-7/+7
| | | | | | | - We are beyond the point where this shows up often and when it does generating miscompiled files is bad. llvm-svn: 54836
* Clean up CodeGenModule interface.Daniel Dunbar2008-08-151-24/+91
| | | | | | | | | | | - Add CodeGenModule::EmitTopLevelDecl which uses switch on kind instead of ugly & slow dyn_cast chains. - Drop some simple forwarding methods into the ObjC runtime. - Privatize appropriate methods. llvm-svn: 54827
* Change CGObjCRuntime methods to take appropriate clang Decls.Daniel Dunbar2008-08-151-118/+5
| | | | | | | | | - This is in prep for implementation class support for the NeXT runtime, for which the existing methods don't provide enough information (and additionally make too many assumptions about how things should be emitted). llvm-svn: 54824
* Infinite loops considered harmful. Daniel Dunbar2008-08-151-1/+1
| | | | | | - Thanks Thomas llvm-svn: 54818
* Add GetAddrOfConstantCString methodDaniel Dunbar2008-08-131-12/+34
| | | | | | | | | | | | | | | | | | - Returns addr of constant for argument + '\0'. - I couldn't think of a better name. - Move appropriate users of GetAddrOfConstantString to this. Rename getStringForStringLiteral to GetStringForStringLiteral. Add GetAddrOfConstantStringFromLiteral - This combines GetAddrOfConstantString and GetStringForStringLiteral. This method can be, but is not yet, more efficient. Change GetAddrOfConstantString to not add terminating '\0' - <rdar://problem/6140956> llvm-svn: 54768
* Change ObjCRuntime GenerateProtocol[Ref] methods to takeDaniel Dunbar2008-08-131-27/+2
| | | | | | | | | | | ObjCProtocolDecl directly. Implement CodeGen support for forward protocol decls (no-ops are so nice to implement). Also moved CGObjCRuntime.h out of CodeGenModule.h llvm-svn: 54709
* Fix compilation warning with help from David Chisnall.Mike Stump2008-08-111-1/+4
| | | | llvm-svn: 54654
* Add LangOptions::NeXTRuntime.Daniel Dunbar2008-08-111-4/+2
| | | | | | | | | - Wired to -fnext-runtime and -fgnu-runtime options. - Defaults to GNU, no autoselection for NeXT. Emit NeXT OBJC_IMAGE_INFO marker. llvm-svn: 54651
* Change CodeGenModule to only create ObjC runtime for ObjC filesDaniel Dunbar2008-08-111-9/+12
| | | | | | | - Changed CodeGenModule::getObjCRuntime to return reference. - Added CodeGenModule::hasObjCRuntime predicate. llvm-svn: 54645
* Add -fexceptions to DriverDaniel Dunbar2008-08-111-0/+6
| | | | | | | | | | | - Maps to LangOptions.Exceptions - Currently always off, should autoselect based on language. Update CodeGen to set unwind attribute on functions definitions based on LangOptions.Exceptions. - Still need to set attributes appropriately on calls. llvm-svn: 54643
* More #include cleaningDaniel Dunbar2008-08-111-5/+0
| | | | | | | | | | | - Kill unnecessary #includes in .cpp files. This is an automatic sweep so some things removed are actually used, but happen to be included by a previous header. I tried to get rid of the obvious examples and this was the easiest way to trim the #includes in one fell swoop. - We now return to regularly scheduled development. llvm-svn: 54632
* More #include cleaningDaniel Dunbar2008-08-111-0/+1
| | | | | | | | - Drop {Decl.h,DeclObjC.h,IdentifierTable.h} from Expr.h - Moved Sema::getCurMethodDecl() out of line (dependent on ObjCMethodDecl via dyn_cast). llvm-svn: 54629
* Add dummy Mac Objective-C runtime interface.Daniel Dunbar2008-08-111-2/+7
| | | | | | - Not currently accessible and completely non-functional. llvm-svn: 54624
* Back out r54608 (inline string literals were getting an extra '\0')Daniel Dunbar2008-08-101-1/+21
| | | | | | | | | | | | | | | temporarily, I assumed GetAddrForConstantString literal was being used consistently but it doesn't look like it is. Factored out a CodeGenModule::getStringForStringLiteral which handles extracting a std::string for the bytes of a StringLiteral, padded to match the type. Update EmitLValue to use getStringForStringLiteral, this was previously not padding strings correctly. Good thing we only emit strings in 4 different places! llvm-svn: 54621
* Bug fix, inline string literals were getting an extra '\0'.Daniel Dunbar2008-08-101-1/+1
| | | | llvm-svn: 54608
* Implement GNU asm-label extension support in CodeGen. This fixesDaniel Dunbar2008-08-061-7/+14
| | | | | | | | | | | | | | scimark2 on Darwin. - Added Sema support for asm-label on variables, which I forgot before. - Update CodeGen to use GlobalDeclMap to determine if static Decls require emission (instead of LLVM module name lookup). Important since the Decl name and the LLVM module name can differ. - <rdar://problem/6116729> llvm-svn: 54388
* Change CodeGen of global decls to key off of the name (instead ofDaniel Dunbar2008-08-051-88/+39
| | | | | | | | | | | | | | | | | having multiple bindings from all the possible decls which conceptually map to the same global). - This eliminates CodeGen depending on the LLVM module for name lookup. - This also eliminates the need for ReplaceMapValuesWith (hurrah). - This handles lookups for FunctionDecls correctly in the presence of aliases, this was previously broken. - WIP: Can still clean up & unify variable and function emission. llvm-svn: 54382
* Refactored driver logic for CodeGen into LLVMCodeGenWriter. This ↵Ted Kremenek2008-08-051-6/+6
| | | | | | ASTConsumer layers on top of LLVMCodeGen (another existing ASTConsumer) to emit bitcode files to disk. This layering takes this logic out of clang.cpp and puts it directly into the ASTConsumer interface. The benefit is that now --emit-llvm works with both serialized ASTs and regular source files. llvm-svn: 54364
* Finally fix PR2189. This makes a fairly invasive but important change toChris Lattner2008-08-041-1/+2
| | | | | | | | | | move getAsArrayType into ASTContext instead of being a method on type. This is required because getAsArrayType(const AT), where AT is a typedef for "int[10]" needs to return ArrayType(const int, 10). Fixing this greatly simplifies getArrayDecayedType, which is a good sign. llvm-svn: 54317
* Support constructor and destructor attributes in CodeGenDaniel Dunbar2008-08-011-43/+43
| | | | | | | | | - There is an miscompilation issue remaining due to a poor interaction between the delayed emission of static functions and the emission of constructors, but that already existed prior to this change. llvm-svn: 54258
* Change CodeGenModule GlobalDeclMap to directly reference globalsDaniel Dunbar2008-07-301-40/+49
| | | | | | | | | | | | | | | instead of mapping the decl to a bitcast of the global to the correct type. - GetAddrOf{Function,GlobalVar} introduce the bitcast on every use now. - This solves a problem where a dangling pointer could be introduced by the RAUW done when replacing a forward or tentative definition. See testcase for more details. - Fixes <rdar://problem/6108358> llvm-svn: 54211
* Rework codegen emission of globalsDaniel Dunbar2008-07-291-163/+181
| | | | | | | | | | | | | | | | | | | | - No (intended) functionality change. - Primary purpose is to clearly separate (lazy) construction of globals that are a forward declaration or tentative definition from those that are the final definition. - Lazy construction is now encapsulated in GetAddrOf{Function,GlobalVar} while final definitions are constructed in EmitGlobal{Function,Var}Definition. - External interface for dealing with globals is now limited to EmitGlobal and GetAddrOf{Function,GlobalVar}. - Also updated helper functions dealing with statics, annotations, and ctors to be private. llvm-svn: 54179
* Fix codegen of chained declarationsDaniel Dunbar2008-07-291-8/+0
| | | | | | | | - Killed useless CodeGenModule::EmitGlobalVarDeclarator, instead just recurse on any ScopedDecl. - Fix for <rdar://problem/6093838> llvm-svn: 54162
* move two more lists of protocols over to use ObjCList<ObjCProtocolDecl>,Chris Lattner2008-07-211-4/+5
| | | | | | simplifying code along the way and fixing a problem and memory leak or two. llvm-svn: 53876
* introduce a new ObjCList templated class and start moving Chris Lattner2008-07-211-5/+9
| | | | | | | various objc lists over to it. First up, the protocol list on ObjCInterfaceDecl. llvm-svn: 53856
* refactor more objc codegen interfaces to pass around selectors soChris Lattner2008-06-261-19/+17
| | | | | | we don't push strings into LLVM IR and then have to read them back out. llvm-svn: 52765
* indenting and other minor things.Chris Lattner2008-06-261-2/+2
| | | | llvm-svn: 52764
* give CreateObjCRuntime a full CGM so it can get whatever state it needs, Chris Lattner2008-06-261-3/+1
| | | | | | | instead of passing in just a couple random things it currently happens to use. llvm-svn: 52756
* implement the alias attirbute (in both Sema and Codegen)Nuno Lopes2008-06-081-17/+39
| | | | llvm-svn: 52092
* Emit debug information for global and static variables when -g is specified.Sanjiv Gupta2008-06-051-0/+8
| | | | llvm-svn: 51993
* For setting attributes, don't assume there are ParamVarDecls available, Eli Friedman2008-06-041-12/+16
| | | | | | | because trying to access non-existent ParamVarDecls can crash. Testcase from the original source for PR2414. llvm-svn: 51960
* First cut at setting attributes for functions and calls; this puts us Eli Friedman2008-06-011-3/+62
| | | | | | | | | | | | | | | much closer to passing the gcc struct layout tests. It might be possible to refactor this a bit, but I'm not sure there's actually enough common code for that to be useful. To get the calling convention completely correct, a bit of platform-specific code is necessary even for x86-Linux. On x86-Linux, the alignment of function parameters is extremely strange; as far as I can tell, it's always 4 except for SSE vectors or structs containing SSE vectors. I'm continuing to investigate this. llvm-svn: 51839
* Support for code generation of Objective-C top-level language constructs.Anton Korobeynikov2008-06-011-1/+151
| | | | | | Implemented by David Chisnall! llvm-svn: 51835
* PR1893: Fix up the type of tentative definitions of incomplete array Eli Friedman2008-05-301-2/+22
| | | | | | types so that they end up the correct size. llvm-svn: 51787
* Allow the type of a global to be different from the type of its Eli Friedman2008-05-301-69/+62
| | | | | | | | | | | | | | | | | associated declaration. This is a prerequisite to handling general union initializations; for example, an array of unions involving pointers has to be turned into a struct because the elements can have incompatible types. I refactored the code a bit to make it more readable; now, the logic for definitions is all in EmitGlobalVarInit. The second parameter for GetAddrOfGlobalVar is now dead; I'll remove it separately. By itself, this patch should not cause any visible changes. llvm-svn: 51783
* Always check that the definition of a function has the correct type. Eli Friedman2008-05-301-1/+1
| | | | | | This fixes a crash on the included testcase (found in NetHack). llvm-svn: 51767
OpenPOWER on IntegriCloud