summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* De-memberify the VarDecl and FunctionDecl StorageClass enums.John McCall2010-08-261-2/+2
| | | | | | This lets us remove Sema.h's dependency on Expr.h and Decl.h. llvm-svn: 112156
* Support for IRGen of synthesize bitfield ivars inFariborz Jahanian2010-08-231-1/+10
| | | | | | objc-nonfragile-abi2 (radar 7824380). llvm-svn: 111823
* Go back to asking CodeGenTypes whether a type is zero-initializable.John McCall2010-08-221-21/+15
| | | | | | | | | Make CGT defer to the ABI on all member pointer types. This requires giving CGT a handle to the ABI. It's way easier to make that work if we avoid lazily creating the ABI. Make it so. llvm-svn: 111786
* The ARM C++ ABI is sufficiently different from the Itanium C++ ABI thatJohn McCall2010-08-211-1/+5
| | | | | | | it deserves its own enumerator. Obviously the implementations should closely follow the Itanium ABI except in cases of divergence. llvm-svn: 111749
* Add some enum goodness as requested by Chris. Now instead of storing theCharles Davis2010-08-191-3/+6
| | | | | | | | | | active C++ ABI as a raw string, we store it as an enum. This should improve performance somewhat. And yes, this time, I started from a clean build directory, and all the tests passed. :) llvm-svn: 111507
* Generate Attr subclasses with TableGen.Alexis Hunt2010-08-181-9/+7
| | | | | | | | | | | | | | | | | | | | | | | | Now all classes derived from Attr are generated from TableGen. Additionally, Attr* is no longer its own linked list; SmallVectors or Attr* are used. The accompanying LLVM commit contains the updates to TableGen necessary for this. Some other notes about newly-generated attribute classes: - The constructor arguments are a SourceLocation and a Context&, followed by the attributes arguments in the order that they were defined in Attr.td - Every argument in Attr.td has an appropriate accessor named getFoo, and there are sometimes a few extra ones (such as to get the length of a variadic argument). Additionally, specific_attr_iterator has been introduced, which will iterate over an AttrVec, but only over attributes of a certain type. It can be accessed through either Decl::specific_attr_begin/end or the global functions of the same name. llvm-svn: 111455
* Convert all uses of StringLiteral::getStrData() to StringLiteral::getString()Benjamin Kramer2010-08-171-10/+6
| | | | | | and remove getStrData(). Patch by Peter Davies (with some tweaks). llvm-svn: 111229
* Just disable the hidden-visibility optimization for now by hiding it behindJohn McCall2010-08-121-1/+4
| | | | | | | | a -cc1 option. The Darwin linker complains about mixed visibility when linking gcc-built objects with clang-built objects, and the optimization isn't really that valuable. Platforms with less ornery linkers can feel free to enable this. llvm-svn: 110979
* Thread local variables aren't considered common linkage.Eric Christopher2010-08-081-1/+2
| | | | llvm-svn: 110530
* It turns out that linkers (at least, the Darwin linker) don't necessarilyJohn McCall2010-08-051-6/+13
| | | | | | | | | | | do the right thing with mixed-visibility symbols, so disable the visibility optimization where that's possible, i.e. with template classes (since it's possible that an arbitrary template might be subject to an explicit instantiation elsewhere). 447.dealII actually does this. I've put the code under an option that's currently not hooked up to anything. llvm-svn: 110374
* Implement #pragma GCC visibility.Eli Friedman2010-08-051-2/+4
| | | | llvm-svn: 110315
* Emit standard-library RTTI with external linkage, not weak_odr.John McCall2010-08-041-0/+51
| | | | | | | | | | Apply hidden visibility to most RTTI; libstdc++ does not rely on exact pointer equality for the type info (just the type info names). Apply the same optimization to RTTI that we do to vtables. Fixes PR5962. llvm-svn: 110192
* Change the name to something less terrible; suggestion by Doug. No ↵Argyrios Kyrtzidis2010-07-291-1/+1
| | | | | | functionality change. llvm-svn: 109797
* Merge PCHWriterDecl.cpp's isRequiredDecl and ↵Argyrios Kyrtzidis2010-07-291-154/+5
| | | | | | | | | | | | | | | CodeGenModule::MayDeferGeneration into a new function, DeclIsRequiredFunctionOrFileScopedVar. This is essentially a CodeGen predicate that is also needed by the PCH mechanism to determine whether a decl needs to be deserialized during PCH loading for codegen purposes. Since this logic is shared by CodeGen and the PCH mechanism, move it to the ASTContext, thus CodeGenModule's GetLinkageForFunction/GetLinkageForVariable and the GVALinkage enum is moved out of CodeGen. This fixes current (and avoids future) codegen-from-PCH bugs. llvm-svn: 109784
* we are not supposed to create an improper callsite using a CallInstr; leave ↵Gabor Greif2010-07-281-0/+1
| | | | | | a fixme mentioning the simplification when CallSite can clone itself llvm-svn: 109575
* Revert r109546, it broke linux build.Argyrios Kyrtzidis2010-07-271-60/+38
| | | | llvm-svn: 109550
* Merge PCHWriterDecl.cpp's isRequiredDecl and ↵Argyrios Kyrtzidis2010-07-271-38/+60
| | | | | | | | | | | | CodeGenModule::MayDeferGeneration into a new function, DeclIsRequiredFunctionOrFileScopedVar. This function is part of the public CodeGen interface since it's essentially a CodeGen predicate that is also needed by the PCH mechanism to determine whether a decl needs to be deserialized during PCH loading for codegen purposes. This fixes current (and avoids future) codegen-from-PCH bugs. llvm-svn: 109546
* atch for implementation of objective-c's -WselectorFariborz Jahanian2010-07-221-2/+2
| | | | | | | warning flag in clang. Little more to do for a PCH issue. Radar 6507158. llvm-svn: 109129
* IRgen: Support user defined attributes on block runtime functions.Daniel Dunbar2010-07-161-0/+55
| | | | | | | | | | | | | | | | | | - This issue here is that /usr/include/Blocks.h wants to define some of the block runtime globals as weak, depending on the target. This doesn't work in Clang because we aren't using the AST decl for these globals. - The fix is a pretty gross hack which just watches all the decls for the specific blocks globals we need to know about; if we see one we use it, otherwise we use the hand coded type. In time, I would like to clean this up by changing IRgen to ask Sema/AST for the decl, which would then be lazily loaded from the builtin table if necessary. This could be used in a whole host of places in IRgen and would get rid of a lot of grotty hand coding of LLVM IR; however, we need some extra Sema support for this as well as support for builtin global variables. llvm-svn: 108482
* IRgen: Move blocks runtime interfaces to CodeGenModule.Daniel Dunbar2010-07-161-3/+55
| | | | llvm-svn: 108481
* When deferring the emission of declarations with initializers in C++, rememberJohn McCall2010-07-151-0/+13
| | | | | | | the order they appeared in the translation unit. If they get emitted, put them in their proper order. Fixes rdar://problem/7458115 llvm-svn: 108477
* Don't suppress the emission of available_externally functions markedDouglas Gregor2010-07-151-1/+2
| | | | | | with always_inline attribute. Thanks to Howard for the tip. llvm-svn: 108469
* Reinstate the optimization suppressing available_externally functionsDouglas Gregor2010-07-131-8/+17
| | | | | | | | at -O0. The only change from the previous patch is that we don't try to generate virtual method thunks for an available_externally function. llvm-svn: 108230
* Speculatively revert r108156; it appears to be breaking self-host.Douglas Gregor2010-07-121-13/+5
| | | | llvm-svn: 108194
* Do not generate LLVM IR for available_externally function bodies atDouglas Gregor2010-07-121-5/+13
| | | | | | | | | | -O0, since we won't be using the definitions for anything anyway. For lib/System/Path.o when built in Debug+Asserts mode, this leads to a 4% improvement in compile time (and suppresses 440 function bodies). <rdar://problem/7987644> llvm-svn: 108156
* Introduce Decl::hasBody() and FunctionDecl::hasBody() and use them instead ↵Argyrios Kyrtzidis2010-07-071-2/+2
| | | | | | | | of getBody() when we are just checking the existence of a body, to avoid de-serialization of the body from PCH. Makes de-serialization of the function body even more "lazier". llvm-svn: 107768
* Provide a hook for the benefit of clients using clang IR gen as a subroutine:John McCall2010-07-061-0/+73
| | | | | | | | | | | | emit metadata associating allocas and global values with a Decl*. This feature is controlled by an option that (intentionally) cannot be enabled on the command line. To use this feature, simply set CodeGenOptions.EmitDeclMetadata = true; and then interpret the completely underspecified metadata. :) llvm-svn: 107739
* Reapply:Chris Lattner2010-06-301-0/+2
| | | | | | | | | | r107173, "fix PR7519: after thrashing around and remembering how all this stuff" r107216, "fix PR7523, which was caused by the ABI code calling ConvertType instead" This includes a fix to make ConvertTypeForMem handle the "recursive" case, and call it as such when lowering function types which have an indirect result. llvm-svn: 107310
* reduce nesting.Chris Lattner2010-06-301-23/+27
| | | | llvm-svn: 107292
* Patch to correctly mangle block helper functionsFariborz Jahanian2010-06-241-3/+4
| | | | | | | when block literal is declared inside a ctor/dtor. Fixes radr 8096995. llvm-svn: 106700
* Switch over to the new caching version of getMangledName.Anders Carlsson2010-06-221-32/+7
| | | | llvm-svn: 106549
* Add a new variant of getMangledName that caches the mangling for decls.Anders Carlsson2010-06-221-0/+35
| | | | llvm-svn: 106547
* 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
* 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
* Move CodeGenOptions.h *back* into Frontend. This should have been done when theChandler Carruth2010-06-151-1/+1
| | | | | | dependency edge was reversed such that CodeGen depends on Frontend. llvm-svn: 106065
* Implement -fvisibility-inlines-hidden. <rdar://problem/7819834>Douglas Gregor2010-06-151-0/+7
| | | | llvm-svn: 106003
* Add an option to specify the target C++ ABI to the frontend. Use it toCharles Davis2010-06-111-2/+4
| | | | | | select either the default Itanium ABI or the new, experimental Microsoft ABI. llvm-svn: 105804
* Get rid of getMangledCXXCtorName and getMangledCXXDtorName.Anders Carlsson2010-06-091-2/+8
| | | | llvm-svn: 105673
* Get rid of an unnecessary getMangledName overload.Anders Carlsson2010-06-091-12/+1
| | | | llvm-svn: 105671
* When deciding whether a deferred declaration has already been emitted,John McCall2010-05-271-3/+13
| | | | | | | aliases count as definitions regardless of whether their target has been emitted yet. Fixes PR 7142. llvm-svn: 104796
* IRgen: Add a stub class for generating ABI-specific C++ code.Charles Davis2010-05-251-1/+11
| | | | | | | | This class only supports name mangling (which is apparently used during C/ObjC codegen). For now only the Itanium C++ ABI is supported. Patches to add a second C++ ABI are forthcoming. llvm-svn: 104630
* If a function definition has any sort of weak linkage, its static localJohn McCall2010-05-251-1/+1
| | | | | | | | | | | | variables should have that linkage. Otherwise, its static local variables should have internal linkage. To avoid computing this excessively, set a function's linkage before we emit code for it. Previously we were assigning weak linkage to the static variables of static inline functions in C++, with predictably terrible results. This fixes that and also gives better linkage than 'weak' when merging is required. llvm-svn: 104581
* Disable the available_externally optimization for inline virtualDouglas Gregor2010-05-131-11/+0
| | | | | | | | | | | | methods for which the key function is guaranteed to be in another translation unit. Unfortunately, this guarantee isn't the case when dealing with shared libraries that fail to export these virtual method definitions. I'm reopening PR6747 so we can consider this again at a later point in time. llvm-svn: 103741
* Rework when and how vtables are emitted, by tracking where vtables areDouglas Gregor2010-05-131-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "used" (e.g., we will refer to the vtable in the generated code) and when they are defined (i.e., because we've seen the key function definition). Previously, we were effectively tracking "potential definitions" rather than uses, so we were a bit too eager about emitting vtables for classes without key functions. The new scheme: - For every use of a vtable, Sema calls MarkVTableUsed() to indicate the use. For example, this occurs when calling a virtual member function of the class, defining a constructor of that class type, dynamic_cast'ing from that type to a derived class, casting to/through a virtual base class, etc. - For every definition of a vtable, Sema calls MarkVTableUsed() to indicate the definition. This happens at the end of the translation unit for classes whose key function has been defined (so we can delay computation of the key function; see PR6564), and will also occur with explicit template instantiation definitions. - For every vtable defined/used, we mark all of the virtual member functions of that vtable as defined/used, unless we know that the key function is in another translation unit. This instantiates virtual member functions when needed. - At the end of the translation unit, Sema tells CodeGen (via the ASTConsumer) which vtables must be defined (CodeGen will define them) and which may be used (for which CodeGen will define the vtables lazily). From a language perspective, both the old and the new schemes are permissible: we're allowed to instantiate virtual member functions whenever we want per the standard. However, all other C++ compilers were more lazy than we were, and our eagerness was both a performance issue (we instantiated too much) and a portability problem (we broke Boost test cases, which now pass). Notes: (1) There's a ton of churn in the tests, because the order in which vtables get emitted to IR has changed. I've tried to isolate some of the larger tests from these issues. (2) Some diagnostics related to implicitly-instantiated/implicitly-defined virtual member functions have moved to the point of first use/definition. It's better this way. (3) I could use a review of the places where we MarkVTableUsed, to see if I missed any place where the language effectively requires a vtable. Fixes PR7114 and PR6564. llvm-svn: 103718
* Do not give implicitly-defined virtual members functionsDouglas Gregor2010-05-061-2/+2
| | | | | | | | | | | | | available_externally linkage, since they may not have been given a strong definition in another translation unit. Without this patch, the following test case fails to link with a GCC-compiled libstdc++: #include <sstream> int main() { std::basic_stringbuf<char> bs; } Fixes the last problem with the Boost.IO library. llvm-svn: 103208
* When we emit a non-constant initializer for a global variable ofDouglas Gregor2010-05-051-2/+4
| | | | | | | | reference type, make sure that the initializer we build is the of the appropriate type for the *reference*, not for the thing that it refers to. Fixes PR7050. llvm-svn: 103115
* IRGen for initialization/destruction ofFariborz Jahanian2010-04-281-0/+34
| | | | | | | ivar class objects (NeXt runtime). (radar 7900343). llvm-svn: 102533
* Properly pass the address of a lazily-generated function declaration withJohn McCall2010-04-281-5/+16
| | | | | | incomplete type. Fixes PR6911. llvm-svn: 102473
* More -fno-constant-cfstrings API work.Fariborz Jahanian2010-04-231-4/+9
| | | | llvm-svn: 102219
* More work toward implementingFariborz Jahanian2010-04-231-2/+76
| | | | | | NeXt's -fno-constant-cfstrings - wip. llvm-svn: 102189
OpenPOWER on IntegriCloud