summaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
AgeCommit message (Collapse)Author
2010-07-12Do not generate LLVM IR for available_externally function bodies atDouglas Gregor
-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
2010-07-07Introduce Decl::hasBody() and FunctionDecl::hasBody() and use them instead ↵Argyrios Kyrtzidis
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
2010-07-06Provide a hook for the benefit of clients using clang IR gen as a subroutine:John McCall
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
2010-06-30Reapply:Chris Lattner
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
2010-06-30reduce nesting.Chris Lattner
llvm-svn: 107292
2010-06-24Patch to correctly mangle block helper functionsFariborz Jahanian
when block literal is declared inside a ctor/dtor. Fixes radr 8096995. llvm-svn: 106700
2010-06-22Switch over to the new caching version of getMangledName.Anders Carlsson
llvm-svn: 106549
2010-06-22Add a new variant of getMangledName that caches the mangling for decls.Anders Carlsson
llvm-svn: 106547
2010-06-21Instantiations subject to an explicit template instantiationDouglas Gregor
declaration have default visibility even under -fvisibility=hidden. Fixes <rdar://problem/8109763>. llvm-svn: 106440
2010-06-19Fix for PR7415: refactor CodeGenModule::MayDeferGeneration and make it lessEli Friedman
conservative for static variables in templated classes. llvm-svn: 106385
2010-06-15Move CodeGenOptions.h *back* into Frontend. This should have been done when theChandler Carruth
dependency edge was reversed such that CodeGen depends on Frontend. llvm-svn: 106065
2010-06-15Implement -fvisibility-inlines-hidden. <rdar://problem/7819834>Douglas Gregor
llvm-svn: 106003
2010-06-11Add an option to specify the target C++ ABI to the frontend. Use it toCharles Davis
select either the default Itanium ABI or the new, experimental Microsoft ABI. llvm-svn: 105804
2010-06-09Get rid of getMangledCXXCtorName and getMangledCXXDtorName.Anders Carlsson
llvm-svn: 105673
2010-06-09Get rid of an unnecessary getMangledName overload.Anders Carlsson
llvm-svn: 105671
2010-05-27When deciding whether a deferred declaration has already been emitted,John McCall
aliases count as definitions regardless of whether their target has been emitted yet. Fixes PR 7142. llvm-svn: 104796
2010-05-25IRgen: Add a stub class for generating ABI-specific C++ code.Charles Davis
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
2010-05-25If a function definition has any sort of weak linkage, its static localJohn McCall
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
2010-05-13Disable the available_externally optimization for inline virtualDouglas Gregor
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
2010-05-13Rework when and how vtables are emitted, by tracking where vtables areDouglas Gregor
"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
2010-05-06Do not give implicitly-defined virtual members functionsDouglas Gregor
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
2010-05-05When we emit a non-constant initializer for a global variable ofDouglas Gregor
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
2010-04-28IRGen for initialization/destruction ofFariborz Jahanian
ivar class objects (NeXt runtime). (radar 7900343). llvm-svn: 102533
2010-04-28Properly pass the address of a lazily-generated function declaration withJohn McCall
incomplete type. Fixes PR6911. llvm-svn: 102473
2010-04-23More -fno-constant-cfstrings API work.Fariborz Jahanian
llvm-svn: 102219
2010-04-23More work toward implementingFariborz Jahanian
NeXt's -fno-constant-cfstrings - wip. llvm-svn: 102189
2010-04-22Support for -fno-constant-cfstrings option - wip.Fariborz Jahanian
llvm-svn: 102112
2010-04-19Add comment explaning the use of c99 inline in c++.Rafael Espindola
llvm-svn: 101787
2010-04-19Fix -Wcast-qual warnings.Dan Gohman
llvm-svn: 101786
2010-04-19If a method is virtual and the class key function is in another file, emit ↵Rafael Espindola
the method as available_externally. Fixes PR6747 llvm-svn: 101757
2010-04-17Vtable -> VTable renames across the board.Anders Carlsson
llvm-svn: 101666
2010-04-13unbreak tests.Chris Lattner
llvm-svn: 101153
2010-04-13minor cleanupsChris Lattner
llvm-svn: 101151
2010-04-10Fix use after free. Incrementing an use_iterator after its user is erased is ↵Benjamin Kramer
unsafe. llvm-svn: 100926
2010-04-10rely even less on CallInst internalsGabor Greif
llvm-svn: 100919
2010-04-10do not rely on CallInst interna, use CallSite to access argumentsGabor Greif
llvm-svn: 100918
2010-04-09Provide an extremely unsatisfactory diagnostic (instead of crashing) whenJohn McCall
mangling an unknown expression kind. Also conveniently tells the user what kind of expression they should add to the mangler! llvm-svn: 100907
2010-04-08Eliminate excessive PCH deserialization caused by the search forDouglas Gregor
__cxxabiv1::__fundamental_type_info in every translation unit. Previously, we would perform name lookup for __cxxabiv1::__fundamental_type_info at the end of IRGen for a each translation unit, to determine whether it was present. If so, we we produce type information for all of the fundamental types. However, this name lookup causes PCH deserialization of a significant part of the translation unit, which has a woeful impact on performance. With this change, we now look at each record type after we've generated its vtable to see if it is __cxxabiv1::__fundamental_type_info. If so, we generate type info for all of the fundamental types. This works because __cxxabiv1::__fundamental_type_info should always have a key function (typically the virtual destructor), that will be defined once in the support library. The fundamental type information will end up there. Fixes <rdar://problem/7840011>. llvm-svn: 100772
2010-04-04Reapply patch for adding support for address spaces and added a isVolatile ↵Mon P Wang
field to memcpy, memmove, and memset. llvm-svn: 100305
2010-04-02Revert r100193 since it causes failures in objc in clangMon P Wang
llvm-svn: 100200
2010-04-02Reapply patch for adding support for address spaces and added a isVolatile ↵Mon P Wang
field to memcpy, memmove, and memset. llvm-svn: 100193
2010-04-01adjust to IRBuilder change and use faster DebugLoc apis.Chris Lattner
llvm-svn: 100093
2010-03-31use the new optimized debug info metadata accessors. InChris Lattner
addition to the inherent win, this eliminates the pointless cost of going through the name -> mdkind stringmap that we were paying. llvm-svn: 99983
2010-03-30Revert Mon Ping's 99930 due to broken llvm-gcc buildbots.Bob Wilson
llvm-svn: 99949
2010-03-30Added support for address spaces and added a isVolatile field to memcpy, ↵Mon P Wang
memmove, and memset llvm-svn: 99930
2010-03-27When given the magic class __cxxabiv1::__fundamental_type_info, produceRafael Espindola
the typeinfo for the fundamental types. Fixes PR6685. llvm-svn: 99701
2010-03-23revert 99311. Looks like it broke darwin bootstrap.Rafael Espindola
llvm-svn: 99317
2010-03-23Avoid producing implicit methods when we have a explicit template instantiationRafael Espindola
declaration. llvm-svn: 99311
2010-03-23Always emit associated thunks when emitting the function itself. Remove ↵Anders Carlsson
getVtableAddressPoint, it's not used. llvm-svn: 99252
2010-03-23Rename MaybeEmitVtable to EmitVTableRelatedData in preparation for making it ↵Anders Carlsson
emit thunks as well. llvm-svn: 99251