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
Chris Lattner
5404169327
emit aliases as the definitions fly by, don't bother deferring until
...
the end of the module.
llvm-svn: 67482
2009-03-22 21:47:11 +00:00
Chris Lattner
d480892445
pull "runtime globals" into the same framework as other functions/global variables.
...
No intended functionality change.
llvm-svn: 67478
2009-03-22 21:03:39 +00:00
Chris Lattner
45470943a9
now that all the decl reference and creation stuff is going through two
...
very simple places, reimplement the deferred decl emission logic to not be O(N^2),
fixing PR3810.
llvm-svn: 67447
2009-03-21 09:44:56 +00:00
Chris Lattner
a85d68e5d8
fix a crash that could occur when a variable declaration became a
...
function definition.
llvm-svn: 67446
2009-03-21 09:25:43 +00:00
Chris Lattner
149927c9f8
simplify and cleanup global variable creation stuff to all go through one
...
code path.
llvm-svn: 67445
2009-03-21 09:16:30 +00:00
Chris Lattner
832323ea41
simplify management of llvm::Function creation to all go through
...
GetAddrOfFunction. This is simpler and more efficient.
llvm-svn: 67444
2009-03-21 08:53:37 +00:00
Chris Lattner
5eaee5692c
code cleanups, rename EmitForwardFunctionDefinition ->
...
CreateFunctionPrototypeIR, though my next patch will eliminate
it entirely.
llvm-svn: 67443
2009-03-21 08:38:50 +00:00
Chris Lattner
3bfce1887f
simplify some more code.
...
llvm-svn: 67439
2009-03-21 08:03:33 +00:00
Chris Lattner
0c5e3132aa
simplify and comment some code better. Make BindRuntimeGlobals
...
more optimistic that it will work (optimizing for the common case).
llvm-svn: 67438
2009-03-21 07:48:31 +00:00
Daniel Dunbar
4e004ed124
IRgen support for alias of global variable.
...
- PR3818.
llvm-svn: 67297
2009-03-19 08:27:24 +00:00
Daniel Dunbar
99d2835099
Backout r66408, we don't want handling of globals to rely on the
...
module symbol table. The root problem inspiring this was fixed in
r66316 (and again in r66506).
llvm-svn: 66512
2009-03-09 23:53:08 +00:00
Mike Stump
e3193ff452
Be sure to never create two functions with the same name, instead arrange to
...
reuse the prior one.
llvm-svn: 66408
2009-03-09 06:40:26 +00:00
Sebastian Redl
7dce7723ba
Some struct/class mismatch fixes, to silence MSVC warnings.
...
llvm-svn: 66335
2009-03-07 12:16:37 +00:00
Daniel Dunbar
7aecee998c
(LLVM svn up) Generalize RuntimeFunctions to RuntimeGlobals and add
...
CodeGenModule::CreateRuntimeVariable.
- No real functionality change; although we now assert on silly
things like:
--
int objc_exception_throw;
void f0() { @throw(@"A"); }
--
instead of accepting it.
llvm-svn: 66292
2009-03-06 22:13:30 +00:00
Mike Stump
6c39666a77
Move more of the blocks code up and out.
...
llvm-svn: 66046
2009-03-04 18:47:42 +00:00
Mike Stump
95435674f9
Move more of blocks codegen out of CodeGenModule and into the
...
BlockModule. No functionality change. This should help people that
don't want to know anything about blocks not be confused by the
overloaded use of the term block or nor want to see all the blocks
goop.
llvm-svn: 66042
2009-03-04 18:17:45 +00:00
Mike Stump
edb252aeba
Start the migration of more of the blocks code out of sight for most
...
people. De-duplicates BLOCK_NEEDS_FREE and friends.
llvm-svn: 66034
2009-03-04 15:32:52 +00:00
Mike Stump
97d01d50d9
Improved ABI compliance for __block variables. No testcases yet as we
...
still give an unsupported error for them due to the fact this is a
work in progress.
llvm-svn: 66007
2009-03-04 03:23:46 +00:00
Mike Stump
537abb0dec
Fix PR3612. We ensure that we add builtins to the GlobalDeclMap and
...
we ensure that things added to the module can be found even when they
are not in GlobalDeclMap. The later is for increased flexibility,
should someone want to do something tricky like extern "Ada" in the
same module.
llvm-svn: 65657
2009-02-27 22:42:30 +00:00
Chris Lattner
d7e7b8e411
first wave of fixes for @encode sema support. This is part of PR3648.
...
The big difference here is that (like string literal) @encode has
array type, not pointer type.
llvm-svn: 65391
2009-02-24 22:18:39 +00:00
Anders Carlsson
729a8202d0
Prevent accidental copying of CodeGenFunction and CodeGenModule.
...
llvm-svn: 65372
2009-02-24 04:21:31 +00:00
Daniel Dunbar
f0acf7bd4c
Don't emit K&R unprototyped function definitions as varargs.
...
- <rdar://problem/6584606> clang/x86-64 - too many reg saves
llvm-svn: 65032
2009-02-19 07:15:39 +00:00
Mike Stump
5d2534ada7
More codegen for blocks. The type of block literals should be better.
...
The size calculation is improved.
llvm-svn: 64994
2009-02-19 01:01:04 +00:00
Douglas Gregor
5f361c9f1e
Address Chris's comments regarding C++ name mangling.
...
llvm-svn: 64984
2009-02-18 23:53:56 +00:00
Daniel Dunbar
38ad1e6138
Change EmitConstantExpr to allow failure.
...
IRgen no longer relies on isConstantInitializer, instead we just try
to emit the constant. If that fails then in C we emit an error
unsupported (this occurs when Sema accepted something that it doesn't
know how to fold, and IRgen doesn't know how to emit) and in C++ we
emit a guarded initializer.
This ends up handling a few more cases, because IRgen was actually
able to emit some of the constants Sema accepts but can't Evaluate().
For example, PR3398.
llvm-svn: 64780
2009-02-17 18:43:32 +00:00
Mike Stump
0e7d7b68c8
Use getNameAsCString instead of getNameAsString and reflow the type.
...
Thanks Anders.
llvm-svn: 64571
2009-02-14 22:49:33 +00:00
Mike Stump
2d5a2878d4
Generate the helper function for blocks. Now basic codegen is
...
starting to work for blocks.
llvm-svn: 64570
2009-02-14 22:16:35 +00:00
Daniel Dunbar
128a138a57
IRgen support for attribute used.
...
- PR3566
llvm-svn: 64492
2009-02-13 22:08:43 +00:00
Daniel Dunbar
6b8720e723
Pull MayDeferGeneration out of EmitGlobal.
...
- Fix emission of static functions with constructor attribute while I
was here.
<rdar://problem/6140899> [codegen] "static" and attribute-constructor interact poorly
llvm-svn: 64488
2009-02-13 21:18:01 +00:00