Commit Graph

26 Commits

Author SHA1 Message Date
John McCall
5da6defa1f Clean up the linkage model and the computation of linkage.
In general, this forces SILGen and IRGen code that's grabbing
a declaration to state whether it's doing so to define it.

Change SIL serialization to serialize the linkage of functions
and global variables, which means also serializing declarations.

Change the deserializer to use this stored linkage, even when
only deserializing a declaration, and to call a callback to
inform the client that it has deserialized a new entity.

Take advantage of that callback in the linking pass to alter
the deserialized linkage as appropriate for the fact that we
imported the declaration.  This computation should really take
advantage of the relationship between modules, but currently
it does not.

Swift SVN r12090
2014-01-09 08:58:07 +00:00
John McCall
e507341c1b SILModule lookup: now with that magic O(1) flavor.
Swift SVN r11978
2014-01-07 01:21:10 +00:00
John McCall
bb63d2312b Hide the constructors of SILFunction/SILGlobalVariable
behind factory methods.

Swift SVN r11967
2014-01-07 00:22:15 +00:00
Joe Groff
8f47dc7383 SIL: Add a SILModule::lookUpWitnessTable method.
Looks up the SILWitnessTable for a ProtocolConformance.

Swift SVN r11576
2013-12-22 22:37:56 +00:00
Joe Groff
fd7b61ac71 SIL: Add a lookup cache StringMap to SILModule.
Because doing linear lookup all the time is dumb. NFC.

Swift SVN r11575
2013-12-22 22:37:55 +00:00
Adrian Prantl
c610ac94ef Add an IsBare attribute to SILFunction for functions that do not have an
AST.

Swift SVN r11236
2013-12-13 04:48:37 +00:00
John McCall
007d3974d6 Use a proper mangling to try to share reabstraction thunks.
Swift SVN r10764
2013-12-03 23:23:52 +00:00
Chris Lattner
ecfba9fb53 Rename getBuiltinValue -> getBuiltinValueDecl since it doesn't
produce a value, it produces a decl.



Swift SVN r10697
2013-12-01 02:13:45 +00:00
Chris Lattner
3b954ed44d strength reduce SILGenModule::getBuiltinInfo/getIntrinsicInfo to
take an identifier instead of a FuncDecl.


Swift SVN r10692
2013-11-30 00:57:46 +00:00
Joe Groff
003709d51f SIL: Add a backreference from SILModule to its originating Swift Module.
Ideally this wouldn't be necessary, but the type substitution APIs required by generic specialization and SIL verification currently require a Module* pointer, and it's obnoxious to have to pass it down separately everywhere it's needed. Longer-term the reliance on Modules for type substitution might be able to go away.

Swift SVN r9866
2013-11-01 00:46:21 +00:00
Sean Callanan
ac43e98dd2 Added SILExternalSource, a class that can be used
to interpose on the SIL linking process.  Under the
following conditions:

- a function is called by the current SILModule;
- that function is transparent and empty in the
  generated SIL;
- the SIL linker doesn't find a serialized
  version of it; and
- the external client (right now, LLDB) has a
  SILExternalSource installed in the SILModule;

the SIL linker will query the SILExternalSource
via lookupSILFunction.

This interface will be used by LLDB to provide
SIL accessors for a program's variables when they
are referred to by Swift expressions.


Swift SVN r9452
2013-10-17 18:04:24 +00:00
Anna Zaks
59175bdc08 [SIL] Remove TranslationUnit pointer from SILModule.
This reverts r8624 and compensates by passing the TU to the SILModule printer when needed.

This addresses concerns that Jordan and Sean had raised.

Swift SVN r8678
2013-09-25 23:52:04 +00:00
Anna Zaks
4c61550b20 [SIL] Use TranslationUnit instead of ASTContext when creating a SILModule.
TU contains Decls that will need to be serialized when we print the SILModule.

Swift SVN r8626
2013-09-25 17:08:40 +00:00
Anna Zaks
21ce68188d [SIL] Add attributes to swift builtins, specifically, the readnone attribute.
Use the attribute when deciding if a call to a builtin can be eliminated as dead.

Swift SVN r7391
2013-08-21 00:02:25 +00:00
Anna Zaks
2f05d5c4df [SIL] Move GenFunc to use getBuiltinInfo and getIntrinsicInfo.
Make the functions support a wider range of builtins and store types to make
it possible.

This is an optimization - the cached ID will be used for builtin identification,
instead of retrieval of the string name and using it as the key.

Swift SVN r7390
2013-08-21 00:02:22 +00:00
Anna Zaks
2870c53a54 [SIL] Cache Builtin Kind and type lookup in SILModule and speed up CCP
Swift SVN r7354
2013-08-20 01:31:48 +00:00
Anna Zaks
3ac84f3878 [SIL] Add getIntrinsicID(FuncDecl*), which lazyly looks up the llvm::IntrinsicID for it.
The cache is stored in the SILModule.
Add getIntrinsicID() as a member of BuiltinFunctionRefInst.
Test by using the new method in the CCP pass.

Swift SVN r7311
2013-08-17 00:41:30 +00:00
Joe Groff
ba774364f1 SIL: Have SILModules track their SILStage.
Modules can be in either 'Raw' or 'Canonical' form, with different invariants on each. We don't actually distinguish those invariants yet, but this patch adds the field to SILModule and adds a "sil_stage" declaration to SIL printer/parser syntax.

Swift SVN r6793
2013-08-01 00:58:31 +00:00
Chris Lattner
b79c5aab94 Move SILFunctionTypeInfo logic into SILType.cpp out of SILModule.cpp,
no functionality change.


Swift SVN r6426
2013-07-21 15:32:58 +00:00
John McCall
69b64a09ce More canonical type preserving.
Swift SVN r6377
2013-07-19 07:08:38 +00:00
John McCall
4b4e7d0833 Eliminate SIL and IR-gen's TypeVisitor specializations in
favor of a new AST-level one, and exploit it.

Swift SVN r6376
2013-07-19 07:08:34 +00:00
Joe Groff
12c5999b44 Strip out -no-nsstring-is-string flag and associated LangOptions bit.
Swift SVN r5383
2013-05-29 19:42:12 +00:00
Joe Groff
8693c5efaa SIL: Emit String-to-NSString conversions.
If -nsstring-is-string is enabled, lower Strings in cc(c) and cc(objc) function types to NSString, and when calling them, insert calls to StringToNSString/NSStringToString to perform the bridging conversion.

This isn't quite ready for prime-time yet, because we still need to emit the inverse bridging for ObjC method thunks, and I haven't tested the IRGen end of things yet.

Swift SVN r5355
2013-05-26 20:29:09 +00:00
Joe Groff
0dc5c66cd2 SIL: Move SILFunctionTypeInfo into a side table.
Generate and cache SILFunctionTypeInfo from Swift types on the fly, and simplify the SILType representation down to a CanType and isAddress bit.

Swift SVN r5298
2013-05-24 16:33:52 +00:00
Chris Lattner
1f971f88dd Remove the IsLoadable flag from SILType, and the isInvalid() state for SILType.
This frees up an extra bit in SILType, which we can expose to LLVM through
PointerLikeTypeTraits.  Use this bit in a PointerUnion, which allows simplifying
ValueBase, which happened to be the last use of the isInvalid() state.



Swift SVN r5218
2013-05-18 00:21:46 +00:00
Chris Lattner
e4ccec4cfc rename SILBAse.h -> SILAllocated.h and SILBase.cpp -> SILModule.cpp to
reflect their contents.


Swift SVN r5198
2013-05-17 04:25:49 +00:00