summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.h
Commit message (Collapse)AuthorAgeFilesLines
* Revert "CodeGen: Use a binary format for instrumentation based profiling"Justin Bogner2014-03-121-4/+4
| | | | | | | | | I've clearly done something wrong with how to get this to link correctly. Reverting for now. This reverts commit r203711. llvm-svn: 203712
* CodeGen: Use a binary format for instrumentation based profilingJustin Bogner2014-03-121-4/+4
| | | | | | | | This updates CodeGenPGO to use the ProfileDataReader introduced to llvm in r203703 and the new API for writing out the profile introduced to compiler-rt in r203710. llvm-svn: 203711
* Replace OwningPtr with std::unique_ptr.Ahmed Charles2014-03-071-2/+2
| | | | | | This compiles cleanly with lldb/lld/clang-tools-extra/llvm. llvm-svn: 203279
* Use llvm.compiler.used instead of llvm.used for objc symbols.Rafael Espindola2014-03-061-7/+8
| | | | | | | | | | | | | LLVM currently has a hack (shouldEmitUsedDirectiveFor) that causes it to not print no_dead_strip for symbols starting with 'l' or 'L'. These are exactly the ones that the clang's objc codegen is producing. The net result, is that it is equivalent to llvm.compiler.used. The need for putting the private symbol in llvm.compiler.used should be clear (the objc runtime uses them). The reason for also putting the weak symbols in it is for LTO: ld64 will not ask us to preserve the it. llvm-svn: 203172
* [Modules] Update to reflect ValueHandle moving to the IR library in LLVMChandler Carruth2014-03-041-1/+1
| | | | | | r202821. llvm-svn: 202822
* [C++11] Simplify compare operators with std::tie.Benjamin Kramer2014-03-031-4/+2
| | | | | | No functionality change. llvm-svn: 202755
* Remove the -fhidden-weak-vtables -cc1 option. It was dead,John McCall2014-02-081-15/+0
| | | | | | gross, and increasingly replaced through other mechanisms. llvm-svn: 201011
* CodeGen: Initial instrumentation based PGO implementationJustin Bogner2014-01-061-1/+7
| | | | llvm-svn: 198640
* Tidy up CGCXXABI creationAlp Toker2013-12-281-2/+2
| | | | | | | | | | 'create' functions conventionally return a pointer, not a reference. Also use an OwningPtr to get replace the delete of a reference member. No functional change. llvm-svn: 198126
* Save another call to GetAddrOfFunction.Rafael Espindola2013-12-091-2/+2
| | | | | | | Thread an optional GV down to EmitGlobalFunctionDefinition so that it can avoid the lookup when we already know the corresponding llvm global value. llvm-svn: 196789
* When we decide to output a deferred decl, remember the llvm GlobalValue.Rafael Espindola2013-12-091-1/+11
| | | | | | | | | We can reuse it to avoid a DenseMap+StringMap lookup to find if it was already emitted or not. This fixes a 2010 TODO. llvm-svn: 196785
* Avoid adding some decls to DeferredDeclsToEmit.Rafael Espindola2013-12-091-11/+12
| | | | | | | | Before this patch GetOrCreateLLVMFunction would add a decl to DeferredDeclsToEmit even when it was being called by the function trying to emit that decl. llvm-svn: 196753
* ubsan: Only emit constants for filenames and type descriptors once.Will Dietz2013-11-081-0/+10
| | | | | | | | Produces neater IR in significantly less time. (~18% faster -O0 compile time for sqlite3 with -fsanitize=undefined) llvm-svn: 194231
* Produce direct calls instead of alias to linkonce_odr functions.Rafael Espindola2013-11-051-0/+6
| | | | | | | This is a small optimization on linux, but should help more on windows where msvc only outputs one destructor if there would be two identical ones. llvm-svn: 194095
* Fix vbtable indices when a class shares the vbptr with a non-virtual baseTimur Iskhodzhanov2013-11-051-4/+4
| | | | llvm-svn: 194082
* Use aliases for more constructors and destructors.Rafael Espindola2013-11-041-1/+2
| | | | | | | | | | | | | | | | With this patch we produce alias for cases like template<typename T> struct foobar { foobar() { } }; template struct foobar<void>; We just have to be careful to produce the same aliases in every TU because of comdats. llvm-svn: 194000
* New fix for pr17535.Rafael Espindola2013-10-221-0/+6
| | | | | | | | | | | | | | | | | | | This is a fixed version of r193161. In order to handle void foo() __attribute__((alias("bar"))); void bar() {} void zed() __attribute__((alias("foo"))); it is not enough to delay aliases to the end of the TU, we have to do two passes over them to find if they are defined or not. This can be implemented by producing alias as we go and just doing the second pass at the end. This has the advantage that other parts of clang that were expecting alias to be processed in order don't have to be changed. This patch also handles cyclic aliases. llvm-svn: 193188
* Revert "This patch causes clang to reject alias attributes that point to ↵Rafael Espindola2013-10-221-1/+0
| | | | | | | | | | | | | | | | undefined names. For example, with this patch we now reject" This reverts commit r193161. It broke void foo() __attribute__((alias("bar"))); void bar() {} void zed() __attribute__((alias("foo"))); Looks like we have to fix pr17639 first :-( llvm-svn: 193162
* This patch causes clang to reject alias attributes that point to undefinedRafael Espindola2013-10-221-0/+1
| | | | | | | | | | | | names. For example, with this patch we now reject void f1(void) __attribute__((alias("g1"))); This patch is implemented in CodeGen. It is quiet a bit simpler and more compatible with gcc than implementing it in Sema. The downside is that the errors only fire during -emit-llvm. llvm-svn: 193161
* Emit a .ident saying that clang produced this file.Rafael Espindola2013-10-161-0/+3
| | | | | | Patch by Katya Romanova. llvm-svn: 192832
* Code cleanup: rename VTableContext to ItaniumVTableContext, VTableBuilder to ↵Timur Iskhodzhanov2013-10-091-1/+3
| | | | | | ItaniumVTableBuilder and clang-format code around llvm-svn: 192288
* Abstract out the emission of vtables, add basic support for vtable emission ↵Timur Iskhodzhanov2013-09-271-5/+4
| | | | | | | | when using -cxx-abi microsoft Reviewed at http://llvm-reviews.chandlerc.com/D1532 llvm-svn: 191523
* Abstract out virtual calls and virtual function prologue code generation; ↵Timur Iskhodzhanov2013-08-211-0/+5
| | | | | | implement them for -cxx-abi microsoft llvm-svn: 188870
* PR16933: Don't try to codegen things after we've seen errors.David Blaikie2013-08-191-8/+2
| | | | | | | | Refactor the underlying code a bit to remove unnecessary calls to "hasErrorOccurred" & make them consistently at all the entry points to the IRGen ASTConsumer. llvm-svn: 188707
* Use new llvm::SpecialCaseList API in CodeGenModuleAlexey Samsonov2013-08-121-2/+2
| | | | llvm-svn: 188170
* Emit the constructor for abstract classes when using -cxx-abi microsoft, ↵Timur Iskhodzhanov2013-08-041-4/+0
| | | | | | fixes PR16735 llvm-svn: 187709
* [ms-cxxabi] Emit linkonce complete dtors in TUs that need themReid Kleckner2013-07-221-9/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on Peter Collingbourne's destructor patches. Prior to this change, clang was considering ?1 to be the complete destructor and the base destructor, which was wrong. This lead to crashes when clang tried to emit two LLVM functions with the same name. In this ABI, TUs with non-inline dtors might not emit a complete destructor. They are emitted as inline thunks in TUs that need them, and they always delegate to the base dtors of the complete class and its virtual bases. This change uses the DeferredDecls machinery to emit complete dtors as needed. Currently in clang try body destructors can catch exceptions thrown by virtual base destructors. In the Microsoft C++ ABI, clang may not have the destructor definition, in which case clang won't wrap the virtual virtual base destructor calls in a try-catch. Diagnosing this in user code is TODO. Finally, for classes that don't use virtual inheritance, MSVC always calls the base destructor (?1) directly. This is a useful code size optimization that avoids emitting lots of extra thunks or aliases. Implementing it also means our existing tests continue to pass, and is consistent with MSVC's output. We can do the same for Itanium by tweaking GetAddrOfCXXDestructor, but it will require further testing. Reviewers: rjmccall CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1066 llvm-svn: 186828
* Apply BlackList -> SpecialCaseList rename in Clang.Peter Collingbourne2013-07-091-3/+3
| | | | | | Differential Revision: http://llvm-reviews.chandlerc.com/D1095 llvm-svn: 185979
* Simplify linkage code for static local vars.Eli Friedman2013-07-011-1/+0
| | | | | | | | | The key insight here is that weak linkage for a static local variable should always mean linkonce_odr, because every file that needs it will generate a definition. We don't actually care about the precise linkage of the parent context. I feel a bit silly that I didn't realize this before. llvm-svn: 185381
* Fix mangling for block literals.Eli Friedman2013-07-011-2/+1
| | | | | | | | | | | | | | | Blocks, like lambdas, can be written in contexts which are required to be treated as the same under ODR. Unlike lambdas, it isn't possible to actually take the address of a block, so the mangling of the block itself doesn't matter. However, objects like static variables inside a block do need to be mangled in a consistent way. There are basically three components here. One, block literals need a consistent numbering. Two, objects/types inside a block literal need to be mangled using it. Three, objects/types inside a block literal need to have their linkage computed correctly. llvm-svn: 185372
* Fix the linkage of static locals inside a CapturedStmt. (Found in theEli Friedman2013-06-131-0/+1
| | | | | | process of trying to fix the related issue for block literals.) llvm-svn: 183951
* PR12086, PR15117Richard Smith2013-06-121-2/+0
| | | | | | | | | | | | | | | | | | | Introduce CXXStdInitializerListExpr node, representing the implicit construction of a std::initializer_list<T> object from its underlying array. The AST representation of such an expression goes from an InitListExpr with a flag set, to a CXXStdInitializerListExpr containing a MaterializeTemporaryExpr containing an InitListExpr (possibly wrapped in a CXXBindTemporaryExpr). This more detailed representation has several advantages, the most important of which is that the new MaterializeTemporaryExpr allows us to directly model lifetime extension of the underlying temporary array. Using that, this patch *drastically* simplifies the IR generation of this construct, provides IR generation support for nested global initializer_list objects, fixes several bugs where the destructors for the underlying array would accidentally not get invoked, and provides constant expression evaluation support for std::initializer_list objects. llvm-svn: 183872
* [ms-cxxabi] Thread GlobalDecls through to CodeGenModule::getFunctionLinkage.Peter Collingbourne2013-06-051-5/+4
| | | | | | | | This is so that we can give destructor variants different linkage later. Differential Revision: http://llvm-reviews.chandlerc.com/D819 llvm-svn: 183324
* Model temporary lifetime-extension explicitly in the AST. Use this model toRichard Smith2013-06-051-2/+8
| | | | | | | | | handle temporaries which have been lifetime-extended to static storage duration within constant expressions. This correctly handles nested lifetime extension (through reference members of aggregates in aggregate initializers) but non-constant-expression emission hasn't yet been updated to do the same. llvm-svn: 183283
* Fix typo in comment. Found by -Wdocumentation.Benjamin Kramer2013-06-041-1/+1
| | | | llvm-svn: 183217
* Adding support for MSVC #pragma detect_mismatch functionality by emitting a ↵Aaron Ballman2013-06-041-0/+3
| | | | | | FAILIFMISMATCH linker command into the object file. llvm-svn: 183178
* Debug Info: Fix a problem that resulted in missing DW_AT_specificationsAdrian Prantl2013-05-091-0/+1
| | | | | | | | | | | | | | for C++ constructors. If the DIType for a class was generated by CGDebugInfo::createContextChain(), the cache contains only a limited DIType wihtout any declarations. Since EmitFunctionStart() needs to find the canonical declaration for each method, we construct the complete type before emitting any method. rdar://problem/13116508 llvm-svn: 181561
* Forward #pragma comment(lib/linker) through as flags metadataReid Kleckner2013-05-081-0/+9
| | | | | | | | | | | | | | | | | | | | | | Summary: Most of this change is wiring the pragma all the way through from the lexer, parser, and sema to codegen. I considered adding a Decl AST node for this, but it seemed too heavyweight. Mach-O already uses a metadata flag called "Linker Options" to do this kind of auto-linking. This change follows that pattern. LLVM knows how to forward the "Linker Options" metadata into the COFF .drectve section where these flags belong. ELF support is not implemented, but possible. This is related to auto-linking, which is http://llvm.org/PR13016. CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D723 llvm-svn: 181426
* Allow targets to define minimum alignment for global variablesUlrich Weigand2013-05-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds a new common code feature that allows platform code to request minimum alignment of global symbols. The background for this is that on SystemZ, the most efficient way to load addresses of global symbol is the LOAD ADDRESS RELATIVE LONG (LARL) instruction. This instruction provides PC-relative addressing, but only to *even* addresses. For this reason, existing compilers will guarantee that global symbols are always aligned to at least 2. [ Since symbols would otherwise already use a default alignment based on their type, this will usually only affect global objects of character type or character arrays. ] GCC also allows creating symbols without that extra alignment by using explicit "aligned" attributes (which then need to be used on both definition and each use of the symbol). To enable support for this with Clang, this patch adds a TargetInfo::MinGlobalAlign variable that provides a global minimum for the alignment of every global object (unless overridden via explicit alignment attribute), and adds code to respect this setting. Within this patch, no platform actually sets the value to anything but the default 1, resulting in no change in behaviour on any existing target. This version of the patch incorporates feedback from reviews by Eric Christopher and John McCall. Thanks to all reviewers! Patch by Richard Sandiford. llvm-svn: 181210
* Replace ArrayRef<T>() with None, now that we have an implicit ArrayRef ↵Dmitri Gribenko2013-05-051-2/+1
| | | | | | | | constructor from None Patch by Robert Wilhelm. llvm-svn: 181139
* Revert r180739 and r180748: they broke C++11 thread_local on non-Darwin ↵Richard Smith2013-04-301-11/+0
| | | | | | | | | | | | | | | | systems and did not do the right thing on Darwin. Original commit message: Emit the TLS intialization functions into a list. Add the TLS initialization functions to a list of initialization functions. The back-end takes this list and places the function pointers into the correct section. This way they're called before `main().' <rdar://problem/13733006> llvm-svn: 180809
* Emit the TLS intialization functions into a list.Bill Wendling2013-04-291-0/+11
| | | | | | | | | | Add the TLS initialization functions to a list of initialization functions. The back-end takes this list and places the function pointers into the correct section. This way they're called before `main().' <rdar://problem/13733006> llvm-svn: 180739
* Implement CodeGen for C++11 thread_local, following the Itanium ABI ↵Richard Smith2013-04-191-0/+11
| | | | | | specification as discussed on cxx-abi-dev. llvm-svn: 179858
* Don't propagate around TargetOptions in IR-gen; we don't use it.John McCall2013-04-161-3/+2
| | | | | | Patch by Stephen Lin! llvm-svn: 179639
* Standardize accesses to the TargetInfo in IR-gen.John McCall2013-04-161-21/+27
| | | | | | Patch by Stephen Lin! llvm-svn: 179638
* Objective-C IRGen. Use llvm::WeakVHFariborz Jahanian2013-04-161-2/+2
| | | | | | | | | | for caching couple of global symbols used for generation of CF/NS string meta-data so they are not released prematuely in certain corner cases. // rdar:// 13598026. Reviewed by John M. llvm-svn: 179599
* Use MapVector rather than simulating it.Richard Smith2013-04-131-3/+2
| | | | llvm-svn: 179438
* Struct-path aware TBAA: uniformize scalar tag and path tag.Manman Ren2013-04-111-2/+7
| | | | | | | | | | | | For struct-path aware TBAA, we used to use scalar type node as the scalar tag, which has an incompatible format with the struct path tag. We now use the same format: base type, access type and offset. We also uniformize the scalar type node and the struct type node: name, a list of pairs (offset + pointer to MDNode). For scalar type, we have a single pair. These are to make implementaiton of aliasing rules easier. llvm-svn: 179335
* Remove nondeterminism introduced in r178950.Richard Smith2013-04-061-0/+1
| | | | llvm-svn: 178952
* When an internal-linkage function or variable is declared within an extern "C"Richard Smith2013-04-061-0/+16
| | | | | | | | | | linkage specification, and is marked as __attribute__((used)), try to also give it the unmangled name (by emitting an internal linkage alias) if nothing else within the translation unit would use that name. This allows inline asm in that translation unit to use the entity via its unmangled name, which people apparently rely on. llvm-svn: 178950
OpenPOWER on IntegriCloud