summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.h
Commit message (Collapse)AuthorAgeFilesLines
* Simplify mem{cpy, move, set} creation with IRBuilder.Benjamin Kramer2010-12-301-11/+0
| | | | llvm-svn: 122634
* Simplify the logic for emitting guard variables for template staticJohn McCall2010-11-061-1/+2
| | | | | | | | | 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. llvm-svn: 118336
* Better solution: calculate the visibility of functions and variablesJohn McCall2010-10-301-2/+3
| | | | | | | | | | 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 llvm-svn: 117781
* Do the guarding of instantiated static data membersFariborz Jahanian2010-10-271-2/+8
| | | | | | | | on if its linkage is weak. Currently this is the case but may change in the future. (part of radar 8562966). llvm-svn: 117452
* Substantially revise how clang computes the visibility of a declaration toJohn McCall2010-10-221-4/+1
| | | | | | | | 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. llvm-svn: 117147
* This patch implements Next's IRGen for -fconstant-string-class=class-name.Fariborz Jahanian2010-10-191-5/+6
| | | | | | PR6056, //rdar: //8564463 llvm-svn: 116819
* Experimental TBAA support.Dan Gohman2010-10-141-0/+7
| | | | | | | This enables metadata generation by default, however the TBAA pass in the optimizer is still disabled for now. llvm-svn: 116536
* Opportunistically use the C++ personality function in ObjC++John McCall2010-09-161-0/+4
| | | | | | translation units that don't catch ObjC types. rdar://problem/8434851 llvm-svn: 114070
* Teach IR generation to return 'this' from constructors and destructorsJohn McCall2010-08-311-4/+1
| | | | | | under the ARM ABI. llvm-svn: 112588
* Abstract out everything having to do with member pointers into the ABIJohn McCall2010-08-231-2/+0
| | | | | | | | | | | class; they should just be completely opaque throughout IR gen now, although I haven't really audited that. Fix a bug apparently inherited from gcc-4.2 where we failed to null-check member data pointers when performing derived-to-base or base-to-derived conversions on them. llvm-svn: 111789
* Go back to asking CodeGenTypes whether a type is zero-initializable.John McCall2010-08-221-14/+4
| | | | | | | | | 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
* Abstract out member-pointer creation. I'm really unhappy about the currentJohn McCall2010-08-221-4/+0
| | | | | | | | duplication between the constant and non-constant paths in all of this. Implement ARM ABI semantics for member pointer constants and conversion. llvm-svn: 111772
* Implement support for member pointers under the Microsoft C++ ABI in theCharles Davis2010-08-161-2/+2
| | | | | | | | AST library. This also adds infrastructure for supporting multiple C++ ABIs in the AST. llvm-svn: 111117
* Store inheritance paths after CastExprs instead of inside them.John McCall2010-08-071-1/+2
| | | | | | | | | | | | | | | This takes some trickery since CastExpr has subclasses (and indeed, is abstract). Also, smoosh the CastKind into the bitfield from Expr. Drops two words of storage from Expr in the common case of expressions which don't need inheritance paths. Avoids a separate allocation and another word of overhead in cases needing inheritance paths. Also has the advantage of not leaking memory, since destructors for AST nodes are never run. llvm-svn: 110507
* Emit standard-library RTTI with external linkage, not weak_odr.John McCall2010-08-041-0/+5
| | | | | | | | | | 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
* Merge PCHWriterDecl.cpp's isRequiredDecl and ↵Argyrios Kyrtzidis2010-07-291-9/+0
| | | | | | | | | | | | | | | 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
* cave in to reality and make ABIInfo depend on CodeGenTypes.Chris Lattner2010-07-291-1/+1
| | | | | | This will simplify a bunch of code, coming up next. llvm-svn: 109722
* IRgen: Support user defined attributes on block runtime functions.Daniel Dunbar2010-07-161-0/+5
| | | | | | | | | | | | | | | | | | - 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-0/+20
| | | | llvm-svn: 108481
* When deferring the emission of declarations with initializers in C++, rememberJohn McCall2010-07-151-0/+6
| | | | | | | 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
* CodeGen/ObjC/NeXT: Fix Obj-C message send to match llvm-gcc when choosingDaniel Dunbar2010-07-141-2/+6
| | | | | | | | whether to use objc_msgSend_fpret; the choice is target dependent, not Obj-C ABI dependent. - <rdar://problem/8139758> arm objc _objc_msgSend_fpret bug llvm-svn: 108379
* Provide a hook for the benefit of clients using clang IR gen as a subroutine:John McCall2010-07-061-0/+2
| | | | | | | | | | | | 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
* tidy up OrderGlobalInitsChris Lattner2010-06-271-13/+11
| | | | llvm-svn: 106976
* Patch to correctly mangle block helper functionsFariborz Jahanian2010-06-241-1/+1
| | | | | | | 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-1/+0
| | | | llvm-svn: 106549
* Add a new variant of getMangledName that caches the mangling for decls.Anders Carlsson2010-06-221-0/+5
| | | | llvm-svn: 106547
* Per Chris's comment, remove another static (this oneFariborz Jahanian2010-06-221-0/+14
| | | | | | is a static comparator operator). llvm-svn: 106511
* In supporting init-priority, globals with the same init_priority must beFariborz Jahanian2010-06-211-1/+9
| | | | | | emitted in the order in which they are seen (still radar 8076356). llvm-svn: 106485
* IRGen for implementation of init-priority attribute.Fariborz Jahanian2010-06-211-0/+5
| | | | | | | Test case will be checked in llvm test suite. (finishes off radar 8076356). llvm-svn: 106441
* Fix PR7097, a bad interaction between -fno-use-cxa-atexit andChris Lattner2010-06-191-2/+4
| | | | | | -mconstructor-aliases by using a WeakVH instead of a raw pointer. llvm-svn: 106384
* Get rid of getMangledCXXCtorName and getMangledCXXDtorName.Anders Carlsson2010-06-091-6/+0
| | | | llvm-svn: 105673
* Get rid of an unnecessary getMangledName overload.Anders Carlsson2010-06-091-1/+0
| | | | llvm-svn: 105671
* Fix for PR7040: Don't try to compute the LLVM type for a function where itEli Friedman2010-05-301-0/+4
| | | | | | | | | | | isn't possible to compute. This patch is mostly refactoring; the key change is the addition of the code starting with the comment, "Check whether the function has a computable LLVM signature." The solution here is essentially the same as the way the vtable code handles such functions. llvm-svn: 105151
* IRgen: Add a stub class for generating ABI-specific C++ code.Charles Davis2010-05-251-2/+18
| | | | | | | | 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
* Improve name mangling for blocks and support mangling of static localDouglas Gregor2010-05-251-0/+1
| | | | | | | | | variables within blocks. We loosely follow GCC's mangling, but since these are always internal symbols the names don't really matter. I intend to revisit block mangling later, because GCC's mangling is rather verbose. <rdar://problem/8015719>. llvm-svn: 104610
* If a function definition has any sort of weak linkage, its static localJohn McCall2010-05-251-0/+4
| | | | | | | | | | | | 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
* Rework when and how vtables are emitted, by tracking where vtables areDouglas Gregor2010-05-131-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "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
* Fix -fno-rtti -fexceptions by forcing the emission of (non-"builtin") RTTIJohn McCall2010-04-301-1/+1
| | | | | | when used by the exceptions routines. Fixes PR 6974. llvm-svn: 102684
* IRGen for initialization/destruction ofFariborz Jahanian2010-04-281-0/+1
| | | | | | | ivar class objects (NeXt runtime). (radar 7900343). llvm-svn: 102533
* Get rid of the old GetNonVirtualBaseClassOffset and change all call sites to ↵Anders Carlsson2010-04-241-4/+1
| | | | | | use the new version. llvm-svn: 102274
* Change CodeGenFunction::GetAddressOfDerivedClass to take a BasePath.Anders Carlsson2010-04-241-1/+4
| | | | llvm-svn: 102273
* More work toward implementingFariborz Jahanian2010-04-231-0/+4
| | | | | | NeXt's -fno-constant-cfstrings - wip. llvm-svn: 102189
* Support for -fno-constant-cfstrings option - wip.Fariborz Jahanian2010-04-221-0/+4
| | | | llvm-svn: 102112
* Some renaming of methods, fixes typoFariborz Jahanian2010-04-191-2/+2
| | | | | | (related to PR6769). llvm-svn: 101794
* Local static variables must be available module-wiseFariborz Jahanian2010-04-181-0/+9
| | | | | | | as they are accessible in static methods in a class local to the same function. Fixes PR6769. llvm-svn: 101756
* Vtable -> VTable renames across the board.Anders Carlsson2010-04-171-3/+3
| | | | llvm-svn: 101666
* Rename CGVtable files to CGVTables.Anders Carlsson2010-04-081-1/+1
| | | | llvm-svn: 100778
* Unbreak the buildDouglas Gregor2010-04-081-1/+2
| | | | llvm-svn: 100775
* Reapply patch for adding support for address spaces and added a isVolatile ↵Mon P Wang2010-04-041-7/+11
| | | | | | field to memcpy, memmove, and memset. llvm-svn: 100305
* Revert r100193 since it causes failures in objc in clangMon P Wang2010-04-021-11/+3
| | | | llvm-svn: 100200
OpenPOWER on IntegriCloud