Граф коммитов

174 Коммитов

Автор SHA1 Сообщение Дата
John McCall c9fe644675 Create a TargetMachine whenever we create a CodeGenAction. The codegen of
some builtins will rely on target knowledge.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97693 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-04 00:23:29 +00:00
John McCall c0bf462cf3 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96842 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-23 00:48:20 +00:00
John McCall d46f98573b Re-introduce the ctor/dtor alias optimization, this time hidden behind a
command-line option which defaults off.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96649 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-19 01:32:20 +00:00
John McCall 8e51a1f5da Revert the ctor/dtor alias optimization for now; the buildbots can detect
some failure here that I can't.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96612 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-18 21:31:48 +00:00
John McCall 92ac9ffecd 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96451 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-17 03:52:49 +00:00
Anders Carlsson b2bcf1c176 Use the correct function info for constructors when applying function attributes. Fixes PR6245.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95474 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-06 02:44:09 +00:00
Anders Carlsson 45147d0098 Move pointer to data member emission to CodeGenModule and use it in CGExprConstant. Fixes PR5674.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95063 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-02 03:37:46 +00:00
Anders Carlsson bb7e17b52f Some class related cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94938 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-31 01:36:53 +00:00
Ken Dyck 687cc4a850 Introduce CodeGenModule::GetTargetTypeStoreSize() to calculate the store size
of LLVM types in character units.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94542 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-26 13:48:07 +00:00
David Chisnall 0d13f6fdbd Created __builtin___NSStringMakeConstantString() builtin, which generates constant Objective-C strings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94274 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-23 02:40:42 +00:00
Anton Korobeynikov 82d0a418c8 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93118 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-10 12:58:08 +00:00
Eli Friedman 6c6bda3b0b 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92976 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-08 00:50:11 +00:00
Douglas Gregor dffb8010a1 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92857 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-06 22:00:56 +00:00
Douglas Gregor 4b0f21c0f8 Fix marking of virtual members for nested classes whose first non-pure virtual function has a body inlined in the class
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92855 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-06 20:27:16 +00:00
Anders Carlsson 21431c551d Move address points to CGVtableInfo, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92420 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-02 18:02:32 +00:00
Eli Friedman e12e77bed1 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91731 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-18 23:47:41 +00:00
Anders Carlsson 1d7088d1d9 Rename GetAddrOfRTTI to GetAddrOfRTTIDescriptor. Remove the overload that takes a CXXRecordDecl since we were just creating a QualType from it anyway.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91590 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-17 07:09:17 +00:00
Anders Carlsson e8e4a1c0bf Use GetAddrOfRTTI everywhere and remove GenerateRTTI and GenerateRTTIRef. With this change, we can now compile and link TableGen.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91520 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-16 07:05:41 +00:00
Anders Carlsson 31b7f52d8c 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).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91098 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-11 02:46:30 +00:00
Eli Friedman 72649ed78a 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90722 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-06 22:01:30 +00:00
Anders Carlsson c3a46ef9f8 Set the correct linkage for VTTs as well.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90689 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-06 01:09:21 +00:00
Anders Carlsson 8c2d36ffc8 Make GenerateVtable a private member function of CGVtableInfo.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90684 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-06 00:01:05 +00:00
Eli Friedman 35c98cc4c0 Minor cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90411 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-03 04:27:05 +00:00
Mike Stump 919d5e51fd Add support for thunking dtors. Oh why does this make my head hurt?
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90409 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-03 03:47:56 +00:00
Anders Carlsson 9fcfc421d3 Add CodeGenModule::ComputeThunkAdjustment, which Eli wrote.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90401 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-03 03:06:55 +00:00
Mike Stump de05057932 Change rtti/Rtti to RTTI, as it is an acronym.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90334 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-02 18:57:08 +00:00
Eli Friedman 15233e5a4d 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89943 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26 07:40:08 +00:00
Anders Carlsson 7622cd3410 Add a CovariantThunkAdjustment struct that represents the adjustments needed for a covariant thunk.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89933 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26 03:09:37 +00:00
Anders Carlsson a94822e893 Add a ThunkAdjustment struct which holds a non-virtual and a virtual adjustment offset. Start using it. General cleanup in Mangle.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89925 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26 02:32:05 +00:00
Mike Stump 7e1365a163 Simplify rtti building code a little. Prep for reuse for throw rtti
generation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89416 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-20 00:31:50 +00:00
Mike Stump ea2c0b5dec Add typeid for the builtin types. WIP.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89028 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-17 02:16:21 +00:00
Mike Stump cbcd4e5d9d Finisgh off rest of class_type_info rtti generation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88823 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-14 23:32:21 +00:00
Anders Carlsson 764d0c2372 Move GlobalDecl to its own file. Also add DenseMapInfo traits.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@87081 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-13 04:25:07 +00:00
Mike Stump acfd1e5ea1 Allow the tracking of address points for construction vtables as well.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@87063 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-13 01:54:23 +00:00
Mike Stump 9840c70c34 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@87021 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 20:47:57 +00:00
Devang Patel 23908b8a43 "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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@87007 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 18:21:39 +00:00
Chandler Carruth 2811ccf48d Move CompileOptions -> CodeGenOptions, and sink it into the CodeGen library.
This resolves the layering violation where CodeGen depended on Frontend.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86998 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 17:24:48 +00:00
Mike Stump 8cfcb52059 Push ctor vtable construction down further. WIP.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86878 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 20:26:26 +00:00
Mike Stump 380dd759b3 Add vtable caching to prevent multiple vtables for the same class from
being generated.

Add the most derived vtable pointer to the VTT.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86671 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 07:44:33 +00:00
Fariborz Jahanian 393c247fe0 Added support for static variables which require
initialization before main. Fixes pr5396.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86145 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-05 18:03:03 +00:00
Devang Patel 55df71abf0 Enable "debug info attached to an instruction" mode.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83928 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-12 23:31:25 +00:00
Anders Carlsson dbd920c775 Move the vtable builder to CGVtable.cpp, general cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83798 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-11 22:13:54 +00:00
Anders Carlsson b540491851 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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83442 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-07 01:06:45 +00:00
Anders Carlsson 2b3583573b Move some functions from CodeGenFunctions to CodeGenModule so they can be used by CGExprConstant.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83263 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-03 14:56:57 +00:00
Daniel Dunbar 34771b594c 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. :)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81756 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-14 04:33:21 +00:00
Chris Lattner ca0017a394 whitespace fix
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81644 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-12 22:45:21 +00:00
Daniel Dunbar ca6408c317 Change CodeGenModule::ConstructTypeAttributes to return the calling convention
to use, and allow the ABI implementation to override the calling convention.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81593 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-12 00:59:20 +00:00
Mike Stump 6e319f6adc Add basic covariant thunk generation support. WIP.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81585 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-11 23:25:56 +00:00
Anders Carlsson 0ff8bafde9 Pass GlobalDecls to GenerateCode and StartFunction.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81485 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-11 00:07:24 +00:00
Anders Carlsson 4a6835e650 Add stricter GlobalDecl constructors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81480 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-10 23:38:47 +00:00