Commit Graph

542 Commits

Author SHA1 Message Date
zoecarver
20222bb2ad [cxx-interop] Bail if trying to convert call result to void.
Don't try to coerce the result of a call to void. If the "expected"
result type is void, just bail.
2020-10-15 13:10:54 -07:00
Robert Widmann
0d6a16258a Silence a Deprecation Warning with FixedVectorType 2020-10-14 13:31:14 -07:00
zoecarver
5774610eaf [cxx-interop] Fix patch formatting with clang-format.
Fix all formatting of the changes made by this patch.
2020-10-09 10:42:55 -07:00
zoecarver
f04de9f128 [cxx-interop] Skip metatypes when lowering C++ constructor SIL function type.
When lowering a C++ constructor's function type to a SIL function type,
skip over the "self" metatype parameter.
2020-10-09 10:42:54 -07:00
zoecarver
7635443915 [cxx-interop] Update ABIArgInfo::Indirect case in expandExternalSignatureTypes to handle thin metatype parameters.
Add second list of SILParameterInfos that excludes thin metatypes so
that the "Indirect" argument path below will select the correct
parameter info.
2020-10-09 10:42:54 -07:00
Martin Boehme
1ce3753d08 Another response to review comments. 2020-10-09 10:42:51 -07:00
Martin Boehme
beaaa742c3 Don't put an sret attribute on the this argument. 2020-10-09 10:42:49 -07:00
Martin Boehme
b2c5a3eeed Add a constructor thunk if required to add additional constructor
arguments.

Also add more IR tests and make various other changes.
2020-10-09 10:42:48 -07:00
Martin Boehme
a5e953b690 Add support for calling C++ constructors.
Because C++ constructors always take a `this` pointer to the object to
be initialized, we mark the SIL function return type with the `@out`
attribute.

On the IRGen side, we retrofit support for formal indirect return values as
well as thin metatypes.
2020-10-09 10:42:46 -07:00
swift_jenkins
833e4c1eb4 Merge remote-tracking branch 'origin/main' into next 2020-10-07 14:46:15 -07:00
swift_jenkins
63df033221 Merge remote-tracking branch 'origin/main' into next 2020-10-06 20:37:03 -07:00
Nate Chandler
4c298db529 [NFC] Extracted async call emission loading.
Previously the code for loading indirect returns was inline in the
member function where it was performed.  Here it is pulled out into a
private method.
2020-10-06 17:03:38 -07:00
Nate Chandler
6e0d894325 [NFC] Deduped async call emission code.
Previously the same code was used for saving values into the async
context.  Here, that code is extracted into a private method.
2020-10-06 17:03:35 -07:00
Nate Chandler
7d74a8614d [Concurrency] Async CC supports witness methods.
Previously, the AsyncContextLayout did not make space for the trailing
witness fields (self metadata and self witness table) and the
AsyncNativeCCEntryPointArgumentEmission could consequently not vend
these fields.  Here, the fields are added to the layout.
2020-10-06 17:03:03 -07:00
Nate Chandler
eba39cffe6 [Concurrency] Corrected ordering of indirect results.
Previously, the indirect results were claimed from the explosion after
the arguments were claimed.  That failed to match the order in which
arguments actually appear in the explosion.  Here the order is reversed.
2020-10-06 17:03:01 -07:00
Nate Chandler
72051efa03 [Concurrency] Async CC for protocol extension methods.
Use the TypeInfo for the argument lowering type of the self parameter
rather than for the self parameter's type itself.
2020-10-06 11:55:29 -07:00
Nate Chandler
1a106d329f [NFC] Tweaked name of NecessaryBindings factory method. 2020-10-06 11:55:25 -07:00
Nate Chandler
15d90d8f5b [IRGen] Pull async polymorphic params from explosion.
Previously, the polymorphic arguments were being discarded.  Here, that
situation is improved by pulling the polymorphic arguments out of the
explosion when having the polymorphic parameters via the
NecessaryBindings instance.  In order to eanble that, an overload of
NecessaryBindings::save is added which takes an explosion and asserts
that the polymorphic parameter pulled from the explosion matches with
the polymorphic parameter in the NecessaryBindings instance.
2020-10-06 11:55:10 -07:00
Nate Chandler
d2fc2c1e35 [IRGen] Silenced unused variable warning. 2020-10-06 11:54:38 -07:00
swift_jenkins
eeb14d44d3 Merge remote-tracking branch 'origin/main' into next 2020-10-06 08:03:33 -07:00
Nate Chandler
ee88152d6b [Concurrency] First steps towards async CC.
Here, the following is implemented:
- Construction of SwiftContext struct with the fields needed for calling
  functions.
- Allocating and deallocating these swift context via runtime calls
  before calling async functions and after returning from them.
- Storing arguments (including bindings and the self parameter but not
  including protocol fields for witness methods) and returns (both
  direct and indirect).
- Calling async functions.

Additional things that still need to be done:
- protocol extension methods
- protocol witness methods
- storing yields
- partial applies
2020-10-05 20:43:51 -07:00
Michael Forster
d222447142 Remove calls to deprecated default-false VectorType::get.
This function was removed in https://reviews.llvm.org/D84212,
which makes the master-next build fail.
2020-08-13 12:05:16 +02:00
Arnold Schwaighofer
0dd2e0da81 Adjust to addition of ABIArgInfo::IndirectAliased
rdar://66694325
2020-08-07 13:55:19 -07:00
David Zarzycki
79df342146 Do not hardcode SVE type list 2020-06-15 06:00:20 -04:00
Karoy Lorentey
57ea964f2c Merge commit '3eb82c183662945687f48e11c09828f551b34858' into master-next
# Conflicts:
#	include/swift/Frontend/FrontendInputsAndOutputs.h
2020-06-08 16:58:37 -07:00
David Zarzycki
7525b63412 Unbreak after clang added BFloat16 builtin
In apple/llvm-project 9e7b7cbbbdb59d53136c0480f17cfe6ecef94163
(llvm/llvm-project ecd682bbf5e69e8690b7e3634258f05ae0a70448), BFloat16
was added to the clang builtins.
2020-06-06 07:27:51 -04:00
Anthony Latsis
9fd1aa5d59 [NFC] Pre- increment and decrement where possible 2020-06-01 15:39:29 +03:00
swift_jenkins
ee07f00381 Merge remote-tracking branch 'origin/master' into master-next 2020-05-27 02:39:04 -07:00
David Zarzycki
eab7cb7d38 [IRGen] NFC: Clean up Alignment type
1) Shrink from 4 bytes to 1 byte.
2) Assert that alignments are power-of-two at run time.
3) Assert that alignments are power-of-two at compile time when possible.
4) Eliminate "isZero"/"no alignment" from the type. Use llvm::Optional.
2020-05-26 10:36:33 -04:00
Arnold Schwaighofer
2b2f7dcd2f Adjust to AllocaInst MaybeAlign -> Align api change 2020-05-20 07:45:43 -07:00
Arnold Schwaighofer
eab0fe2ff7 IRGen: Adjust to added Matrix type ignore for now 2020-05-12 08:22:31 -07:00
swift_jenkins
c60a485196 Merge remote-tracking branch 'origin/master' into master-next 2020-05-06 12:35:16 -07:00
Arnold Schwaighofer
147144baa6 SIL: Thread type expansion context through to function convention apis
This became necessary after recent function type changes that keep
substituted generic function types abstract even after substitution to
correctly handle automatic opaque result type substitution.

Instead of performing the opaque result type substitution as part of
substituting the generic args the underlying type will now be reified as
part of looking at the parameter/return types which happens as part of
the function convention apis.

rdar://62560867
2020-05-04 13:53:30 -07:00
swift_jenkins
27826c53e3 Merge remote-tracking branch 'origin/master' into master-next 2020-04-29 12:47:24 -07:00
Michael Forster
1e1aa4635a Inline deprecated CallBase::getCalledValue
This function has already been removed on upstream LLVM. Inlining it
here fixes a compile issue on `master-next`.
2020-04-29 18:04:42 +02:00
swift_jenkins
d079c2ba99 Merge remote-tracking branch 'origin/master' into master-next 2020-04-28 05:19:09 -07:00
Erik Eckstein
e196932f67 Remove includes to llvm's CallSite.h
Fixes a master-next compile problem
2020-04-28 11:58:38 +02:00
Michael Forster
bcf0afd57a Ignore ExtInt for C interop and IRGen
This feature was introduced here:
61ba1481e2
2020-04-20 11:53:06 +02:00
Robert Widmann
85fdc7a555 Merge pull request #31080 from CodaFi/why-I-R-ta
Give IRGenModule Ownership of its LLVMContext
2020-04-17 10:32:46 -07:00
Michael Forster
8d1d9f1eb5 Remove calls to deprecated IRBuilder APIs
These APIs have been removed in upstream LLVM, breaking master-next.
2020-04-17 09:32:03 +02:00
Robert Widmann
40d9cd8d3f [NFC] Give IRGenModule Exclusive Ownership of an LLVMContext Object 2020-04-16 11:57:44 -07:00
Kuba Mracek
84c4864911 [arm64e] Add Swift compiler support for arm64e pointer authentication 2020-02-27 16:10:31 -08:00
Jonas Devlieghere
4db7f40686 Update for upstream intrinsics change (NFC)
The Intrinsic ID is now an opaque typedef to facilitate splitting up
the enum into target-specific enums.
2020-01-03 10:53:22 -08:00
swift-ci
aa57f0c92b Merge remote-tracking branch 'origin/master' into master-next 2019-11-12 12:09:57 -08:00
Arnold Schwaighofer
4cba76309f IRGen: Add TypeExpansionContext to IRGen 2019-11-11 14:21:52 -08:00
Xi Ge
64c0680686 Merge remote-tracking branch 'apple/master' into master-next 2019-10-28 10:19:36 -07:00
Joe Groff
03c7919b4a SIL: Add fields to SILFunctionType for substituted function types.
https://forums.swift.org/t/improving-the-representation-of-polymorphic-interfaces-in-sil-with-substituted-function-types/29711

This prepares SIL to be able to more accurately preserve the calling convention of
polymorphic generic interfaces by letting the type system represent "substituted function types".
We add a couple of fields to SILFunctionType to support this:

- A substitution map, accessed by `getSubstitutions()`, which maps the generic signature
  of the function to its concrete implementation. This will allow, for instance, a protocol
  witness for a requirement of type `<Self: P> (Self, ...) -> ...` for a concrete conforming
  type `Foo` to express its type as `<Self: P> (Self, ...) -> ... for <Foo>`, preserving the relation
  to the protocol interface without relying on the pile of hacks that is the `witness_method`
  protocol.

- A bool for whether the generic signature of the function is "implied" by the substitutions.
  If true, the generic signature isn't really part of the calling convention of the function.
  This will allow closure types to distinguish a closure being passed to a generic function, like
  `<T, U> in (*T, *U) -> T for <Int, String>`, from the concrete type `(*Int, *String) -> Int`,
  which will make it easier for us to differentiate the representation of those as types, for
  instance by giving them different pointer authentication discriminators to harden arm64e
  code.

This patch is currently NFC, it just introduces the new APIs and takes a first pass at updating
code to use them. Much more work will need to be done once we start exercising these new
fields.

This does bifurcate some existing APIs:

- SILFunctionType now has two accessors to get its generic signature.
  `getSubstGenericSignature` gets the generic signature that is used to apply its
  substitution map, if any. `getInvocationGenericSignature` gets the generic signature
  used to invoke the function at apply sites. These differ if the generic signature is
  implied.
- SILParameterInfo and SILResultInfo values carry the unsubstituted types of the parameters
  and results of the function. They now have two APIs to get that type. `getInterfaceType`
  returns the unsubstituted type of the generic interface, and
  `getArgumentType`/`getReturnValueType` produce the substituted type that is used at
  apply sites.
2019-10-25 13:38:51 -07:00
Adrian Prantl
468b74bd70 Update Swift master-next for upstream llvm.org changes. 2019-10-21 13:31:31 -07:00
Shoaib Meenai
85b648b707 [swift] Adjust for LLVM r373425
Change TypeNodes.def to TypeNodes.inc.
2019-10-04 12:47:43 -07:00
Shoaib Meenai
a007f646fb [IRGen] Adjust for LLVM r373054
setAlignment now takes a MaybeAlign, so construct one where needed.
2019-09-30 12:04:32 -07:00