aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CodeGenModule.cpp
AgeCommit message (Collapse)Author
2011-02-01Revert 124633. The linker has been told how to merge available_externally.Rafael Espindola
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124651 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-01Set visibility for available_externally globals. This is important for two ↵Rafael Espindola
reasons: * llvm-link would complains about mismatched visibility * If we produce a relocation with an available_externally, it is good to know that it is hidden. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124633 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-30When building with optimizations, emit vtables where the key is not in the Anders Carlsson
current translation unit as available_externally. This helps devirtualize the second example in PR3100, comment 18: struct S { S() {}; virtual void xyzzy(); }; inline void foo(S *s) { s->xyzzy(); } void bar() { S s; foo(&s); } This involved four major changes: 1. In DefineUsedVTables, always mark virtual member functions as referenced for non-template classes and class template specializations. 2. In CodeGenVTables::ShouldEmitVTableInThisTU return true if optimizations are enabled, even if the key function is not implemented in this translation unit. We don't ever do this for code compiled with -fapple-kext, because we don't ever want to devirtualize virtual member function calls in that case. 3. Give the correct linkage for vtables where the key function is not defined. 4. Update the linkage for RTTI structures when necessary. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124565 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-29Move GetLLVMVisibility to CodeGenModule.Anders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124550 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-29Add RTTIBuilder::GetAddrOfTypeName which uses the newly added ↵Anders Carlsson
CreateOrReplaceCXXRuntimeVariable. Set the visibility for typeinfo names. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124548 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-29Change CodeGenModule::setTypeVisibility to take a TypeVisibilityKind enum ↵Anders Carlsson
instead of an "IsForRTTI" flag. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124546 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-29Replace an isa/cast with a dyn_cast.Anders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124542 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-29Get rid of an unneeded parameter from setGlobalVisibility.Anders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124541 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-29Use CGM.CreateOrReplaceCXXRuntimeVariable in CGVTables.cppAnders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124538 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-29Add a new function, to be used by CGRTTI, CGVTables and CGVTT (which each ↵Anders Carlsson
has their own copy of this code). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124537 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-29Replace a literal '8' with getCharWidth().Ken Dyck
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124536 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-29Remove IsDefinition from CodeGenModule::setTypeVisibility; it is always true.Anders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124529 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-24Mark VTables and RTTI data linkonce_odr instead of weak_odr, with the ↵Anders Carlsson
exception of explicit template instantiations, which have to be weak_odr. This fixes PR6996. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124089 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-22Use a FunctionType::get overload that doesn't require an empty vector.Benjamin Kramer
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124029 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-18Add unnamed_addr in CreateRuntimeVariable.Rafael Espindola
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123773 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-18Replace calls to CharUnits::fromQuantity() with ones to Ken Dyck
ASTContext::toCharUnitsFromBits() when converting from bit sizes to char units. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123720 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-17More unnamed_addr.Rafael Espindola
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123681 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-17merge strings created byRafael Espindola
const NSConstantString *appKey = @"MyApp"; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123680 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-17Add unnamed_addr to the special strings created byRafael Espindola
__builtin___CFStringMakeConstantString This fixes PR8993. A darwin expert might want to check that this is safe. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123658 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-13Move name mangling support from CodeGen to AST. In thePeter Collingbourne
process, perform a number of refactorings: - Move MiscNameMangler member functions to MangleContext - Remove GlobalDecl dependency from MangleContext - Make MangleContext abstract and move Itanium/Microsoft functionality to their own classes/files - Implement ASTContext::createMangleContext and have CodeGen use it No (intended) functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123386 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-11Set unnamed_addr for type infos that we are confortable marking as hidden. IRafael Espindola
think it is safe to mark all type infos with unnamed_addr, but I am not sure. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123275 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-11Add unnamed_addr to constructors and destructors.Rafael Espindola
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123197 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-10Add unnamed_addr when creating artificial string globals. For example, inRafael Espindola
static const char foo[] = "foo"; static const char *bar = "bar"; the global created to hold "bar" will have it, but foo will not. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123192 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-30Simplify mem{cpy, move, set} creation with IRBuilder.Benjamin Kramer
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122634 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-15Set the "implicitly inline" bit on a method as soon as we see a definitionJohn McCall
within the class. Teach IR gen to look for function definitions in record lexical contexts when deciding whether to emit a function whose address was taken. Fixes PR8789. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121833 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-02Add support for the common and nocommon attributes.Eric Christopher
rdar://8560647 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120650 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-06Simplify the logic for emitting guard variables for template staticJohn McCall
data members by delaying the emission of the initializer until after linkage and visibility have been set on the global. Also, don't emit a guard unless the variable actually ends up with vague linkage, and don't use thread-safe statics in any case. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118336 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-02Ensure that static local variables in function templates inherit theJohn McCall
visibility of their function. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118065 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-30Better solution: calculate the visibility of functions and variablesJohn McCall
independently of whether they're definitions, then teach IR generation to ignore non-explicit visibility when emitting declarations. Use this to make sure that RTTI, vtables, and VTTs get the right visibility. More of rdar://problem/8613093 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117781 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-29Restore r117644, this time properly ignoring -fvisibility and type visibilityJohn McCall
for namespace-scope variable declarations. Apply visibility in IR gen to variables that are merely declared and never defined. We were previously emitting these with default visibility unless they were declared with private_extern. Ignore global visibility settings when computing visibility for a declaration's context, and key several conditions on whether a visibility attribute exists anywhere in the hierarchy as opposed to whether it exists at the current level. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117729 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-29Revert r117644, "Apply visibility in IR gen to variables that are merelyDaniel Dunbar
declared", it breaks things. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117653 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-29Apply visibility in IR gen to variables that are merely declaredJohn McCall
and never defined. We were previously emitting these with default visibility unless they were declared with private_extern. Ignore global visibility settings when computing visibility for a declaration's context, and key several conditions on whether a visibility attribute exists anywhere in the hierarchy as opposed to whether it exists at the current level. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117644 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-27Do the guarding of instantiated static data membersFariborz Jahanian
on if its linkage is weak. Currently this is the case but may change in the future. (part of radar 8562966). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117452 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-22Substantially revise how clang computes the visibility of a declaration toJohn McCall
more closely parallel the computation of linkage. This gets us to a state much closer to what gcc emits, modulo bugs, which will undoubtedly arise in abundance. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117147 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19This patch implements Next's IRGen for -fconstant-string-class=class-name.Fariborz Jahanian
PR6056, //rdar: //8564463 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116819 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-15Experimental TBAA support for enum types.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116613 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-15Don't leak the TBAA object.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116595 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-14Experimental TBAA support.Dan Gohman
This enables metadata generation by default, however the TBAA pass in the optimizer is still disabled for now. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116536 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-11lib/CodeGen/CodeGenModule.cpp: DLLImportLinkage should be processed also on ↵NAKAMURA Takumi
declaration. It enables clang to compile Mingw's headers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116184 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-29Add support for attribute((naked)), patch by Zoxc on cfe-commits!Daniel Dunbar
- Minor style tweaks by me. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115056 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-27Kill FunctionDecl's IsCopyAssignment bit; it duplicated what couldDouglas Gregor
already be determined by isCopyAssignmentOperator(), and was set too late in the process for all clients to see the appropriate value. Cleanup only; no functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114916 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-16Opportunistically use the C++ personality function in ObjC++John McCall
translation units that don't catch ObjC types. rdar://problem/8434851 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114070 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-07get rid of a warning.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113256 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-07Have Sema check for validity of CGString literalFariborz Jahanian
instead of asserting in IRGen. Fixes radar 8390459. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113253 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-31Teach IR generation to return 'this' from constructors and destructorsJohn McCall
under the ARM ABI. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112588 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-26De-memberify the VarDecl and FunctionDecl StorageClass enums.John McCall
This lets us remove Sema.h's dependency on Expr.h and Decl.h. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112156 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-23Support for IRGen of synthesize bitfield ivars inFariborz Jahanian
objc-nonfragile-abi2 (radar 7824380). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111823 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-22Go back to asking CodeGenTypes whether a type is zero-initializable.John McCall
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111786 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-21The ARM C++ ABI is sufficiently different from the Itanium C++ ABI thatJohn McCall
it deserves its own enumerator. Obviously the implementations should closely follow the Itanium ABI except in cases of divergence. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111749 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-19Add some enum goodness as requested by Chris. Now instead of storing theCharles Davis
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. :) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111507 91177308-0d34-0410-b5e6-96231b3b80d8