Douglas Gregor
b14d123774
Give explicit template instantiations weak ODR linkage. Former
...
iterations of this patch gave explicit template instantiation
link-once ODR linkage, which permitted the back end to eliminate
unused symbols. Weak ODR linkage still requires the symbols to be
generated.
llvm-svn: 98441
2010-03-13 18:23:07 +00:00
Douglas Gregor
17b76185f1
Re-revert the explicit template instantiation linkage patch. I am beginning to look incompetent
...
llvm-svn: 98425
2010-03-13 03:49:57 +00:00
Douglas Gregor
89cae0f224
Reinstate patch to turn explicit template instantiations into weak symbols
...
llvm-svn: 98424
2010-03-13 03:14:19 +00:00
Douglas Gregor
539bc40906
Revert the linkage change for explicit template instantiations; something is amiss
...
llvm-svn: 98332
2010-03-12 05:13:59 +00:00
Douglas Gregor
ee3f72299c
Give explicit template instantiations weak linkage (but don't defer
...
them). Fixes PR6578.
llvm-svn: 98328
2010-03-12 04:49:06 +00:00
Rafael Espindola
e7113ca907
Delay codegen of vtables when handling implicit instantiations.
...
This fixes PR6474.
llvm-svn: 98123
2010-03-10 02:19:29 +00:00
John McCall
beec5a080f
Implement __builtin_dwarf_sp_column for i386 (Darwin and not), x86-64 (all),
...
and ARM. Implement __builtin_init_dwarf_reg_size_table for i386 (both) and
x86-64 (all).
llvm-svn: 97859
2010-03-06 00:35:14 +00:00
Rafael Espindola
2e42fec3a0
Fix PR6473.
...
Clang's support for weakref is now better than llvm-gcc's :-)
We don't introduce a new symbol and we correctly mark undefined references weak only if there is no
definition or regular undefined references in the same file.
llvm-svn: 97733
2010-03-04 18:17:24 +00:00
John McCall
731be6620c
Revert changes r97693, r97700, and r97718.
...
Our testing framework can't deal with disabled targets yet.
llvm-svn: 97719
2010-03-04 04:29:44 +00:00
John McCall
6abe39c61e
Create a TargetMachine whenever we create a CodeGenAction. The codegen of
...
some builtins will rely on target knowledge.
llvm-svn: 97693
2010-03-04 00:23:29 +00:00
John McCall
f8ff7b9fd1
Perform two more constructor/destructor code-size optimizations:
...
1) emit base destructors as aliases to their unique base class destructors
under some careful conditions. This is enabled for the same targets that can
support complete-to-base aliases, i.e. not darwin.
2) Emit non-variadic complete constructors for classes with no virtual bases
as calls to the base constructor. This is enabled on all targets and in
theory can trigger in situations that the alias optimization can't (mostly
involving virtual bases, mostly not yet supported).
These are bundled together because I didn't think it worthwhile to split them,
not because they really need to be.
llvm-svn: 96842
2010-02-23 00:48:20 +00:00
John McCall
d4324148d7
Re-introduce the ctor/dtor alias optimization, this time hidden behind a
...
command-line option which defaults off.
llvm-svn: 96649
2010-02-19 01:32:20 +00:00
John McCall
334ce7c1c4
Revert the ctor/dtor alias optimization for now; the buildbots can detect
...
some failure here that I can't.
llvm-svn: 96612
2010-02-18 21:31:48 +00:00
John McCall
67cea74745
Emit complete constructors and destructors as aliases to base constructors
...
and destructors when the two entities are semantically identical, i.e. when
the class has no virtual base classes. We only do this for linkage types
for which aliases are supported, i.e. internal and external, i.e. not linkonce.
llvm-svn: 96451
2010-02-17 03:52:49 +00:00
Anders Carlsson
6710c5351e
Use the correct function info for constructors when applying function attributes. Fixes PR6245.
...
llvm-svn: 95474
2010-02-06 02:44:09 +00:00
Anders Carlsson
259688ce29
Move pointer to data member emission to CodeGenModule and use it in CGExprConstant. Fixes PR5674.
...
llvm-svn: 95063
2010-02-02 03:37:46 +00:00
Anders Carlsson
84673e200f
Some class related cleanup.
...
llvm-svn: 94938
2010-01-31 01:36:53 +00:00
Ken Dyck
98ca79435a
Introduce CodeGenModule::GetTargetTypeStoreSize() to calculate the store size
...
of LLVM types in character units.
llvm-svn: 94542
2010-01-26 13:48:07 +00:00
David Chisnall
481e3a87fe
Created __builtin___NSStringMakeConstantString() builtin, which generates constant Objective-C strings.
...
llvm-svn: 94274
2010-01-23 02:40:42 +00:00
Anton Korobeynikov
55bcea1e65
Generalize target weirdness handling having proper layering in mind:
...
1. Add helper class for sema checks for target attributes
2. Add helper class for codegen of target attributes
As a proof-of-concept - implement msp430's 'interrupt' attribute.
llvm-svn: 93118
2010-01-10 12:58:08 +00:00
Eli Friedman
5866fe306d
Fix for PR5967: Make const-marking for LLVM globals correct for cases requiring
...
run-time initialization, and emit run-time initializers aggresively to avoid
ordering issues with deferred globals.
llvm-svn: 92976
2010-01-08 00:50:11 +00:00
Douglas Gregor
2a34df3264
Fix linkage for RTTI names by re-using the logic for computing the
...
linkage of vtables. Before this, we were emitting RTTI names for
template instantiations with strong external linkage rather than with
weak ODR linkage.
llvm-svn: 92857
2010-01-06 22:00:56 +00:00
Douglas Gregor
ccecc1bb43
Fix marking of virtual members for nested classes whose first non-pure virtual function has a body inlined in the class
...
llvm-svn: 92855
2010-01-06 20:27:16 +00:00
Anders Carlsson
93a1884fde
Move address points to CGVtableInfo, no functionality change.
...
llvm-svn: 92420
2010-01-02 18:02:32 +00:00
Eli Friedman
70724ad2ff
Work in progress for setting the vtable pointers for all bases correctly in
...
the constructor. This doesn't handle cases requiring the VTT at the moment,
and generates unnecessary stores, but I think it's essentially correct.
llvm-svn: 91731
2009-12-18 23:47:41 +00:00
Anders Carlsson
3f4336cb1f
Rename GetAddrOfRTTI to GetAddrOfRTTIDescriptor. Remove the overload that takes a CXXRecordDecl since we were just creating a QualType from it anyway.
...
llvm-svn: 91590
2009-12-17 07:09:17 +00:00
Anders Carlsson
07863b8b6e
Use GetAddrOfRTTI everywhere and remove GenerateRTTI and GenerateRTTIRef. With this change, we can now compile and link TableGen.
...
llvm-svn: 91520
2009-12-16 07:05:41 +00:00
Anders Carlsson
fd7dfeb779
Improve linkage of RTTI data structures. Introduce CodeGenModule::GetAddrOfRTTI which figures out the right linkage of the RTTI information for the given type and whether it should be defined or not. I will migrate clients over to GetAddrOfRTTI in subsequent commits (with tests).
...
llvm-svn: 91098
2009-12-11 02:46:30 +00:00
Eli Friedman
8174f2c23c
Work-in-progess rewrite of thunks: move thunk generation outside of vtable
...
generation, and make sure we generate thunks when the function is defined
rather than when the vtable is defined.
llvm-svn: 90722
2009-12-06 22:01:30 +00:00
Anders Carlsson
fe5f7d916f
Set the correct linkage for VTTs as well.
...
llvm-svn: 90689
2009-12-06 01:09:21 +00:00
Anders Carlsson
7e28c5f2e2
Make GenerateVtable a private member function of CGVtableInfo.
...
llvm-svn: 90684
2009-12-06 00:01:05 +00:00
Eli Friedman
551fe84d0e
Minor cleanup.
...
llvm-svn: 90411
2009-12-03 04:27:05 +00:00
Mike Stump
e2d4a2c3a8
Add support for thunking dtors. Oh why does this make my head hurt?
...
llvm-svn: 90409
2009-12-03 03:47:56 +00:00
Anders Carlsson
5f91fd64b6
Add CodeGenModule::ComputeThunkAdjustment, which Eli wrote.
...
llvm-svn: 90401
2009-12-03 03:06:55 +00:00
Mike Stump
c01c2b87e8
Change rtti/Rtti to RTTI, as it is an acronym.
...
llvm-svn: 90334
2009-12-02 18:57:08 +00:00
Eli Friedman
84a7e347bf
Simplify and fix up the handling of implicit constructors, copy assignment
...
operators, and destructors. Avoids generating declarations/definitions of
trivial constructors/destructors, and makes sure the trivial copy assignment
operator is generated when necessary.
llvm-svn: 89943
2009-11-26 07:40:08 +00:00
Anders Carlsson
2f87c4f1a5
Add a CovariantThunkAdjustment struct that represents the adjustments needed for a covariant thunk.
...
llvm-svn: 89933
2009-11-26 03:09:37 +00:00
Anders Carlsson
c778540f9a
Add a ThunkAdjustment struct which holds a non-virtual and a virtual adjustment offset. Start using it. General cleanup in Mangle.cpp.
...
llvm-svn: 89925
2009-11-26 02:32:05 +00:00
Mike Stump
101f052faf
Simplify rtti building code a little. Prep for reuse for throw rtti
...
generation.
llvm-svn: 89416
2009-11-20 00:31:50 +00:00
Mike Stump
3f75d552a3
Add typeid for the builtin types. WIP.
...
llvm-svn: 89028
2009-11-17 02:16:21 +00:00
Mike Stump
f5b2869b75
Finisgh off rest of class_type_info rtti generation.
...
llvm-svn: 88823
2009-11-14 23:32:21 +00:00
Anders Carlsson
87f84c1e72
Move GlobalDecl to its own file. Also add DenseMapInfo traits.
...
llvm-svn: 87081
2009-11-13 04:25:07 +00:00
Mike Stump
83066c8dee
Allow the tracking of address points for construction vtables as well.
...
llvm-svn: 87063
2009-11-13 01:54:23 +00:00
Mike Stump
2cefe38365
Fix the offset calculations for non-virtual bases with overrides.
...
Refine the VTT entries for virtual bases to refer to the complete
object's vtable instead of constructor vtables.
Refine the AddressPoint calculations for VTT entries for virtual bases.
llvm-svn: 87021
2009-11-12 20:47:57 +00:00
Devang Patel
94f798c079
"Attach debug info with llvm instructions" mode was enabled a month ago. Now make it permanent and remove old way of inserting intrinsics to encode debug info for locations and types.
...
llvm-svn: 87007
2009-11-12 18:21:39 +00:00
Chandler Carruth
bc55fe26c6
Move CompileOptions -> CodeGenOptions, and sink it into the CodeGen library.
...
This resolves the layering violation where CodeGen depended on Frontend.
llvm-svn: 86998
2009-11-12 17:24:48 +00:00
Mike Stump
eac4559790
Push ctor vtable construction down further. WIP.
...
llvm-svn: 86878
2009-11-11 20:26:26 +00:00
Mike Stump
d846d0825b
Add vtable caching to prevent multiple vtables for the same class from
...
being generated.
Add the most derived vtable pointer to the VTT.
llvm-svn: 86671
2009-11-10 07:44:33 +00:00
Fariborz Jahanian
4127b8ef97
Added support for static variables which require
...
initialization before main. Fixes pr5396.
llvm-svn: 86145
2009-11-05 18:03:03 +00:00
Devang Patel
5b294f4330
Enable "debug info attached to an instruction" mode.
...
llvm-svn: 83928
2009-10-12 23:31:25 +00:00
Anders Carlsson
2bb27f53e0
Move the vtable builder to CGVtable.cpp, general cleanup.
...
llvm-svn: 83798
2009-10-11 22:13:54 +00:00
Anders Carlsson
ff971e8bf4
Add a MangleContext and pass it to all mangle functions. It will be used for keeping state, such as identifiers assigned to anonymous structs as well as scope encoding.
...
llvm-svn: 83442
2009-10-07 01:06:45 +00:00
Anders Carlsson
32bfb1ce8f
Move some functions from CodeGenFunctions to CodeGenModule so they can be used by CGExprConstant.
...
llvm-svn: 83263
2009-10-03 14:56:57 +00:00
Daniel Dunbar
ff0553ec61
Fix subtle bug in generating LLVM function declarations for builtin functions.
...
The decl wasn't being passed down, which meant that function attributes were not
being set correctly. This is particularly important for ARM, since it wants to
override the calling convention. Instead we would emit the builtin with the
wrong calling convention, and instcombine would come along and merrily shred all
the calls to it. :)
llvm-svn: 81756
2009-09-14 04:33:21 +00:00
Chris Lattner
ee7bd3b204
whitespace fix
...
llvm-svn: 81644
2009-09-12 22:45:21 +00:00
Daniel Dunbar
0ef3479cb7
Change CodeGenModule::ConstructTypeAttributes to return the calling convention
...
to use, and allow the ABI implementation to override the calling convention.
llvm-svn: 81593
2009-09-12 00:59:20 +00:00
Mike Stump
80f6ac5a4f
Add basic covariant thunk generation support. WIP.
...
llvm-svn: 81585
2009-09-11 23:25:56 +00:00
Anders Carlsson
73fcc95f0f
Pass GlobalDecls to GenerateCode and StartFunction.
...
llvm-svn: 81485
2009-09-11 00:07:24 +00:00
Anders Carlsson
38988d7ee0
Add stricter GlobalDecl constructors.
...
llvm-svn: 81480
2009-09-10 23:38:47 +00:00
Mike Stump
11289f4280
Remove tabs, and whitespace cleanups.
...
llvm-svn: 81346
2009-09-09 15:08:12 +00:00
Mike Stump
453fe4285d
Install thunks later to fixup overrides. Track space taken by vbase
...
offsets better for thunk refinements. Cleanups. WIP.
llvm-svn: 81067
2009-09-05 07:20:32 +00:00
Mike Stump
5a522353c3
Add overidding for methods for vtable building for the secondary
...
vtables. Add thunk generation. WIP.
llvm-svn: 81014
2009-09-04 18:27:16 +00:00
Mike Stump
07347353a0
Cleanups. Move GenerateRtti to CodeGenModule.
...
llvm-svn: 79372
2009-08-18 21:49:00 +00:00
Fariborz Jahanian
d262eda6fc
Patch toward synthesizing non-trivial destructors. WIP
...
llvm-svn: 79199
2009-08-16 19:36:17 +00:00
Fariborz Jahanian
4985b33fd7
Patch to force synthesis of copy assignment operator
...
function in the order according to c++03. ir-gen
for copy assignment in the trivial case and the first
test case.
llvm-svn: 78938
2009-08-13 21:09:41 +00:00
Benjamin Kramer
9cd050ab07
LLVMContext is a class now.
...
llvm-svn: 78691
2009-08-11 17:46:57 +00:00
Anders Carlsson
b8be93fc92
Add support for global initializers.
...
llvm-svn: 78515
2009-08-08 23:24:23 +00:00
Fariborz Jahanian
40134e71be
More synthesis of copy constructors. Work in progress.
...
llvm-svn: 78402
2009-08-07 20:22:40 +00:00
Owen Anderson
758428f4e3
Update for LLVM API change.
...
llvm-svn: 78259
2009-08-05 23:18:46 +00:00
Mike Stump
bc78a728ee
Add code to setup the vtable pointer in the constructor. Work in progress.
...
llvm-svn: 77699
2009-07-31 18:25:34 +00:00
Owen Anderson
170229f68d
Update for LLVM API change, and contextify a bunch of related stuff.
...
llvm-svn: 75705
2009-07-14 23:10:40 +00:00
Owen Anderson
ae86c19e68
Update for LLVM API change.
...
llvm-svn: 75446
2009-07-13 04:10:07 +00:00
Douglas Gregor
e8925dbc1d
Improve code generation for function template specializations:
...
- Track implicit instantiations vs. the not-yet-supported explicit
specializations
- Give implicit instantiations of function templates (and member
functions of class templates) linkonce_odr linkage.
- Improve name mangling for function template specializations,
including the template arguments of the instantiation and the return
type of the function.
Note that our name-mangling is improved, but not correct: we still
don't mangle substitutions, although the manglings we produce can be
demangled.
llvm-svn: 74466
2009-06-29 22:39:32 +00:00
Eli Friedman
895771aa4b
Handle the edge case of a weak function with incomplete type correctly.
...
Found by code inspection; I haven't seen this in real-world code.
llvm-svn: 72408
2009-05-26 01:22:57 +00:00
Chris Lattner
e0be0dfced
push GlobalDecl through enough of the CodeGenModule interfaces
...
to allow us to support generation of deferred ctors/dtors.
It looks like codegen isn't emitting a call to the dtor in
member-functions.cpp:test2, but when it does, its body should
get emitted.
llvm-svn: 71594
2009-05-12 21:21:08 +00:00
Anders Carlsson
dae1abc7ac
Refactor global decls to hold either a regular Decl or a CXXConstructorDecl + ctor type or a CXXDestructorDecl + dtor type.
...
llvm-svn: 70962
2009-05-05 04:44:02 +00:00
Douglas Gregor
beecd58e21
Explictly track tentative definitions within Sema, then hand those
...
tentative definitions off to the ASTConsumer at the end of the
translation unit.
Eliminate CodeGen's internal tracking of tentative definitions, and
instead hook into ASTConsumer::CompleteTentativeDefinition. Also,
tweak the definition-deferal logic for C++, where there are no
tentative definitions.
Fixes <rdar://problem/6808352>, and will make it much easier for
precompiled headers to cope with tentative definitions in the future.
llvm-svn: 69681
2009-04-21 17:11:58 +00:00
Anders Carlsson
eaa28f7e18
Add support for generating (very basic) C++ destructors. These aren't called by anything yet.
...
llvm-svn: 69343
2009-04-17 01:58:57 +00:00
Daniel Dunbar
c3e7cff6d3
Attributes on block functions were not being set.
...
- <rdar://problem/6800351> clang not producing correct large struct
return code for Blocks
llvm-svn: 69337
2009-04-17 00:48:04 +00:00
Anders Carlsson
e8eeffdf16
Add GetAddrOfCXXConstructor and use it.
...
llvm-svn: 69328
2009-04-16 23:57:24 +00:00
Daniel Dunbar
7dd749e6fd
Defer generation of tentative definitions.
...
- PR3980.
- <rdar://problem/6762287> [irgen] crash when generating tentative
definition of incomplete structure
- This also avoids creating common definitions for things which are
later overwritten.
- XFAIL'ed external-defs.c, it isn't completing types properly yet.
llvm-svn: 69231
2009-04-15 22:08:45 +00:00
Anders Carlsson
f747524819
Start attempting to generate code for C++ ctors.
...
llvm-svn: 69168
2009-04-15 15:55:24 +00:00
Chris Lattner
28549de12c
remove dead enum
...
llvm-svn: 69070
2009-04-14 20:30:29 +00:00
Chris Lattner
bae0e68930
Fix PR3988: extern inline functions get strong symbol definitions in
...
C99 mode. This is a regression from an earlier patch of mine.
This also simplifies the linkage enums a bit.
llvm-svn: 69069
2009-04-14 20:25:53 +00:00
Chris Lattner
02e987f3e8
implement codegen support for __attribute((__gnuc_inline__)),
...
pulling some attribute munging stuff into GetLinkageForFunction.
This should fix PR3986
llvm-svn: 69045
2009-04-14 16:44:36 +00:00
Daniel Dunbar
389325715b
Refactor how attributes are set on values.
...
- Pull out SetCommonAttributes, which handles the things common to
aliases, methods, functions, and variables.
- Pull out SetLLVMFunctionAttributesForDefinition, which handles the
LLVM attributes which we only want to apply to a definition (like
noinline and alwaysinline).
- Kill SetGVDeclarationAttributes (inlined into SetFunctionAttributes
and specialized).
- Kill SetFunctionAttributesForDefinition (inlined into sole caller).
- Inline SetGVDefinitionAttributes into SetMethodAttributes and
specialize.
- Rename SetGVDefinitionAttributes to SetFunctionDefinitionAttributes.
This is supposed to be a no functionality change commit, but I may
have made a mistake.
llvm-svn: 69036
2009-04-14 08:05:55 +00:00
Daniel Dunbar
81a3f1bdf3
Split SetGlobalValueAttributes into definition/declaration halves.
...
- No functionality change.
llvm-svn: 69035
2009-04-14 07:19:20 +00:00
Daniel Dunbar
aeddffc99d
Rename (one) SetFunctionAttributes to SetLLVMFunctionAttributes to
...
disambiguate it.
- No functionality change.
llvm-svn: 69034
2009-04-14 07:08:30 +00:00
Chris Lattner
3e031f4121
add a new enum type for linkage, no functionality change.
...
llvm-svn: 69028
2009-04-14 06:04:17 +00:00
Daniel Dunbar
f5f359fb73
Clean up handling of visibility.
...
llvm-svn: 69027
2009-04-14 06:00:08 +00:00
Eli Friedman
20bb5e02a5
Minor work related to removing the assumption that value initialization
...
implies an all-zero bit pattern.
llvm-svn: 68994
2009-04-13 21:47:26 +00:00
Anders Carlsson
80f97ab08f
Add a destination type argument to EmitConstantExpr. This will be used for when the destination has a reference type. (No functionality change yet)
...
llvm-svn: 68593
2009-04-08 04:48:15 +00:00
Anders Carlsson
cbaeb9e633
Emit code for linkage specifications.
...
llvm-svn: 68300
2009-04-02 05:55:18 +00:00
Steve Naroff
e14b368fa9
More "prep" work for handling UTF16 CFString.
...
Patch by Jean-Daniel Dupas. Thanks!
llvm-svn: 68203
2009-04-01 13:55:36 +00:00
Chris Lattner
6483908957
move trivial forwarding function inline.
...
llvm-svn: 68176
2009-04-01 02:08:13 +00:00
Anders Carlsson
237f349073
Implement code generation of namespaces and add mangling tests.
...
llvm-svn: 68170
2009-04-01 00:58:25 +00:00
Chris Lattner
f41e87f4cd
Change UsedArray to be a vector of WeakVH to fix a dangling pointer problem that occurs when
...
attribute(used) and asm renaming are used together.
llvm-svn: 68155
2009-03-31 22:37:52 +00:00
Devang Patel
afc1c1d405
Do not emit debug information for variables while generating optimized code. The llvm optimizer and code generator are not yet ready to support optimized code debugging.
...
llvm-svn: 67876
2009-03-27 23:16:32 +00:00
Chris Lattner
984fac5f5f
most of this is plumbing to get CompileOptions down into
...
CodeGenModule. Once there, add a new NoCommon option to
it and implement -fno-common.
llvm-svn: 67735
2009-03-26 05:00:52 +00:00
Chris Lattner
e64911a4ae
switch getBuiltinLibFunction to use the new GetOrCreateLLVMFunction
...
functionality, fixing a crash on the attached testcase. Eliminate the
BuiltinFunctions cache, as it can contain dangling pointers. This fixes
a bunch of valgrind errors on test/CodeGen/builtins.c
llvm-svn: 67484
2009-03-22 21:56:56 +00:00