Commit Graph

576 Commits

Author SHA1 Message Date
Mike Ash
3e4a5a2d79 [Runtime][ABI] Have swift_willThrow take the error value in the return register.
rdar://problem/37578477
2018-08-22 15:04:49 -04:00
David Zarzycki
8c0c55539f [SIL] NFC: Rename misleading getSwiftRValueType() to getASTType()
Reference storage types are not RValues. Also, use more SILType helper
methods to avoid line wrap.
2018-05-04 08:14:38 -04:00
swift-ci
07db40fb71 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-03-08 07:58:21 -08:00
Arnold Schwaighofer
f0bf9af158 IRGen: Fix assert
We only need a contextPtr if the function type requires a context

rdar://38241155
SR-7138
2018-03-08 05:59:00 -08:00
swift-ci
73f148384e Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-03-06 16:38:13 -08:00
Sho Ikeda
26d650292f [gardening] Use empty() over size() == 0 2018-03-05 14:43:13 +09:00
swift-ci
9e94284246 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-02-26 14:00:10 -08:00
Vedant Kumar
f64d88591e [IRGen] Prevent mergeable traps from being created
PR #14729 made more calls to llvm.trap() non-mergeable. This follow-up
adds asserts to IRBuilder which make it harder to accidentally introduce
mergeable calls to llvm.trap() in the future.

The newly-added assertions exposed an issue in GenBuiltin while
compiling parts of the stdlib. This PR fixes the issue.

Suggested by Adrian Prantl!

rdar://32772768
2018-02-26 13:44:52 -08:00
swift-ci
2b9b846f42 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-02-14 05:38:02 -08:00
Arnold Schwaighofer
882059674f IRGen: Support for trivial @noescape function types
- make @noescape function types trivial
- think_to_thick_function with @noescape result type
- Fix for getSwiftFunctionPointerCallee

Part of:
SR-5441
rdar://36116691
2018-02-13 04:19:59 -08:00
Bob Wilson
1b55b85e2b Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-01-09 16:12:10 -08:00
John McCall
3c54c0edfc IRGen and basic optimizer support for coroutines. 2018-01-09 11:35:09 -05:00
swift-ci
bda69c3eec Merge remote-tracking branch 'origin/master' into master-next 2017-12-20 15:09:46 -08:00
Arnold Schwaighofer
fb9696f427 IRGen: Fix mismatching sret attribute for indirect return values
We incorrectly lowered callsites when we had sil function return types
that involved both direct return types that we decide to lower
indirectly,  and indirect return types.

@convention(thin) () -> (@owned String, @owned String, @owned String, @out Any, @out Any)

(This should have been handled by the address lowering pass but isn't)

rdar://35874410
2017-12-19 18:58:53 -08:00
swift-ci
07902f91aa Merge remote-tracking branch 'origin/master' into master-next 2017-12-18 23:09:18 -08:00
John McCall
1f3f33e67d Clean up the internal APIs around dynamic allocas to structurally
discourage accidental use of them.  Relatedly, fix several bugs
where we were accidentally using dynamic allocas.
2017-12-19 00:29:43 -05:00
swift-ci
6d1f3c7eca Merge remote-tracking branch 'origin/master' into master-next 2017-12-12 17:29:39 -08:00
Thomas Roughton
f10ef1ab9a [runtime] Always use SwiftCC (#13311) 2017-12-12 17:11:38 -08:00
swift-ci
5540e26ee7 Merge remote-tracking branch 'origin/master' into master-next 2017-11-17 10:49:02 -08:00
Joe Shajrawi
62d823c56d Code size: Do not use a global state for isOutlined 2017-11-15 15:28:27 -08:00
swift-ci
09bc1805b7 Merge remote-tracking branch 'origin/master' into master-next 2017-10-27 11:49:41 -07:00
Saleem Abdulrasool
2e6e83b045 IRGen: avoid unnecessary coercion memory traffic
Attempt to avoid unnecessary traffic for the type coercion unless it is
really needed.
2017-10-26 18:40:05 -07:00
Saleem Abdulrasool
b53a422c59 IRGen: follow target specific ABI for FFI
When lowering the arguments for the FFI call on certain targets, LLVM
expects that the parameter be passed as a structure rather than the
extracted values.  Enhance the argument lowering for the call and the
function construction to ensure that the type can be flattened according
to the ABI for the target before attempting to explode it for the SIL
IRGen lowering.  This allows building for targets such as Linux ARM HF
and Linux ARM SF target with the HF floating point ABI.

Addresses SR-6142!
2017-10-26 09:42:21 -07:00
Saleem Abdulrasool
61a51e9870 IRGen: minor clean up to explosion handling (NFC)
Indicate that the type is const for the cast.  Use `Range` and a
for-loop rather than the explicit counters.  NFC.
2017-10-23 18:16:07 -07:00
swift-ci
bd13b59626 Merge remote-tracking branch 'origin/master' into master-next 2017-10-10 19:09:43 -07:00
Arnold Schwaighofer
0da5cf9ce5 IRGen: An @objc protocol method call's self argument behaves like a class method's
rdar://34847037
SR-6088
2017-10-10 15:11:13 -07:00
Michael Gottesman
5c7685da57 [upstream-update] Update Swift for addition of clang::BuiltinType::Float16. 2017-09-08 17:15:53 -07:00
John McCall
d4d2145ad8 Merge branch 'master' into master-next 2017-07-29 15:48:00 -04:00
John McCall
a0f20f673d Switch all of the indirect-call code in IRGen to FunctionPointer.
To make this stick, I've disallowed direct use of that overload of
CreateCall.  I've left the Constant overloads available, but eventually
we might want to consider fixing those, too, just to get all of this
code out of the business of manually remembering to pass around
attributes and calling conventions.

The test changes reflect the fact that we weren't really setting
attributes consistently at all, in this case on value witnesses.
2017-07-28 23:26:35 -04:00
Bob Wilson
5f02db4d3e Merge remote-tracking branch 'origin/master' into master-next 2017-07-20 21:59:23 -07:00
John McCall
750d397909 Substantially rework how IRGen handles function pointers.
The goals here are four-fold:
  - provide cleaner internal abstractions
  - avoid IR bloat from extra bitcasts
  - avoid recomputing function-type lowering information
  - allow more information to be propagated from the function
    access site (e.g. class_method) to the call site

Use this framework immediately for class and protocol methods.
2017-07-20 14:33:18 -04:00
swift-ci
f8f2320487 Merge remote-tracking branch 'origin/master' into master-next 2017-07-13 08:25:22 -07:00
Arnold Schwaighofer
2570bdcbfa Use the max of abi alignment and swift's type alignment 2017-07-12 14:43:02 -07:00
Arnold Schwaighofer
11f61fe32a IRGen: Make sure to use the C function type's alignment for indirect byval arguments
rdar://33242303
2017-07-12 13:08:01 -07:00
Greg Parker
7b009eccde Merge remote-tracking branch 'origin/master' into master-next 2017-06-28 15:25:17 -07:00
Arnold Schwaighofer
b38cacb3e9 IRGen: Use LLVM's alloc size to compute padding between types (#10464)
* IRGen: Use LLVM's alloc size to compute padding between types

We need to subtract alignment padding when doing type layout in terms of llvm types

rdar://32618125
SR-5137
2017-06-22 10:28:35 -07:00
Bob Wilson
4051d57d12 Adjust for LLVM r302060: avoid ArgNo+1 attribute indexing 2017-05-06 22:01:34 -07:00
Bob Wilson
e24a6f1d30 Adjust addAttributes calls for LLVM r301981
These now take an AttrBuilder argument instead of an AttributeList.
2017-05-06 21:37:22 -07:00
swift-ci
502bda365b Merge remote-tracking branch 'origin/master' into master-next 2017-05-05 13:48:34 -07:00
practicalswift
492f5cd35a [gardening] Remove redundant repetition of type names (DRY): RepeatedTypeName foo = dyn_cast<RepeatedTypeName>(bar)
Replace `NameOfType foo = dyn_cast<NameOfType>(bar)` with DRY version `auto foo = dyn_cast<NameOfType>(bar)`.

The DRY auto version is by far the dominant form already used in the repo, so this PR merely brings the exceptional cases (redundant repetition form) in line with the dominant form (auto form).

See the [C++ Core Guidelines](https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#es11-use-auto-to-avoid-redundant-repetition-of-type-names) for a general discussion on why to use `auto` to avoid redundant repetition of type names.
2017-05-05 09:45:53 +02:00
swift-ci
1378be1c6d Merge remote-tracking branch 'origin/master' into master-next 2017-05-01 15:55:31 -07:00
Joe Shajrawi
d17258cac7 @in_constant calling convention - part of passing large loadable types by address 2017-04-30 10:13:02 -07:00
Saleem Abdulrasool
15565c116a Adjust for SVN r298393 2017-03-22 07:44:03 -07:00
swift-ci
344aa312ec Merge remote-tracking branch 'origin/master' into master-next 2017-02-24 00:28:41 -08:00
practicalswift
33a5601ad1 [gardening] Fix typos 2017-02-23 22:46:40 +01:00
Michael Gottesman
5f8a8944f2 [upsteam-update] Remove upstream removed clang::BuiltinType::OCLNDRange.
This is an opencl type that we did not use in the compiler anyways. Our only use
was to make sure that we had covered switches on clang builtin types (and
asserted if we ever hit that case in a switch).
2017-02-21 12:33:21 -08:00
Michael Gottesman
c60f6b2600 [upstream-update] Handle two CXX entities that have been added upstream in clang.
Since we do not support importing CXX this change just makes sure an unreachable
triggers in various covered switches.
2017-02-21 12:32:28 -08:00
Arnold Schwaighofer
6c35202565 Conditionalize usage of llvm::CallingConv::Swift on SWIFT_USE_SWIFTCALL macro 2017-02-14 12:17:57 -08:00
Arnold Schwaighofer
39fa2f0228 Use the swift calling convention for swift functions
Use the generic type lowering algorithm described in
"docs/CallingConvention.rst#physical-lowering" to map from IRGen's explosion
type to the type expected by the ABI.

Change IRGen to use the swift calling convention (swiftcc) for native swift
functions.

Use the 'swiftself' attribute on self parameters and for closures contexts.

Use the 'swifterror' parameter for swift error parameters.

Change functions in the runtime that are called as native swift functions to use
the swift calling convention.

rdar://19978563
2017-02-14 12:17:57 -08:00
Hugh Bellamy
f001b7562b Use relatively new LLVM_FALLLTHROUGH instead of our own SWIFT_FALLTHROUGH 2017-02-12 10:47:03 +07:00