[SILGen] Bootstrapping opaque values (#7113)

[NFC] Add -enable-sil-opaque-values frontend option.

This will be used to change the SIL-level calling convention for opaque values,
such as generics and resilient structs, to pass-by-value.  Under this flag,
opaque values have SSA lifetimes, managed by copy_value and destroy_value.

This will make it easier to optimize copies and verify ownership.

* [SILGen] type lowering support for opaque values.

Add OpaqueValueTypeLowering.
Under EnableSILOpaqueValues, lower address-only types as opaque values.

* [SIL] Fix ValueOwnershipKind to support opaque SIL values.

* Test case: SILGen opaque value support for Parameter/ResultConvention.

* [SILGen] opaque value support for function arguments.

* Future Test case: SILGen opaque value specialDest arguments.

* Future Test case: SILGen opaque values: emitOpenExistential.

* Test case: SIL parsing support for EnableSILOpaqueValues.

* SILGen opaque values: prepareArchetypeCallee.

* [SIL Verify] allow copy_value for EnableSILOpaqueValues.

* Test cast: SIL serializer support for opaque values.

* Add a static_assert for ParameterConvention layout.

* Test case: Mandatory SILOpt support for EnableSILOpaqueValues.

* Test case: SILOpt support for EnableSILOpaqueValues.

* SILGen opaque values: TypeLowering emitCopyValue.

* SILBuilder createLoad. Allow loading opaque values.

* SIL Verifier. Allow loading and storing opaque values.

* SILGen emitSemanticStore support for opaque values.

* Test case for SILGen emitSemanticStore.

* Test case for SIL mandatory support for inout assignment.

* Fix SILGen opaque values test case after rebasing.
This commit is contained in:
Andrew Trick
2017-01-27 18:56:53 -08:00
committed by GitHub
parent 51bdd6f09b
commit e9c559b718
22 changed files with 429 additions and 56 deletions

View File

@@ -79,6 +79,10 @@ static llvm::cl::opt<bool>
EnableSILOwnershipOpt("enable-sil-ownership",
llvm::cl::desc("Compile the module with sil-ownership initially enabled for all functions"));
static llvm::cl::opt<bool>
EnableSILOpaqueValues("enable-sil-opaque-values",
llvm::cl::desc("Compile the module with sil-opaque-values enabled."));
static llvm::cl::opt<std::string>
ResourceDir("resource-dir",
llvm::cl::desc("The directory that holds the compiler resource files"));
@@ -238,6 +242,7 @@ int main(int argc, char **argv) {
ASTVerifierProcessCount;
Invocation.getLangOptions().ASTVerifierProcessId =
ASTVerifierProcessId;
Invocation.getLangOptions().EnableSILOpaqueValues = EnableSILOpaqueValues;
// Setup the SIL Options.
SILOptions &SILOpts = Invocation.getSILOptions();