Commit Graph

542 Commits

Author SHA1 Message Date
Alex Langford
0a74d1cdde Adjust for svn rL372558
The return type of DataLayout::getAlignment was modified to return an
llvm::Align instead of an unsigned. Adjust accordingly.
2019-09-23 13:48:04 -07:00
Alex Langford
986a036685 [ClangImporter][IRGen] Handle SVE builtin types
Clang r368413 introduced the SVE builtin types; update various switch
statements to handle them. This assumes that the types should not be
mapped into Swift, similar to the OpenCL types.

(cherry picked from commit 096e7ae96c)
2019-08-19 16:53:03 -07:00
Alex Langford
096e7ae96c [ClangImporter][IRGen] Handle SVE builtin types
Clang r368413 introduced the SVE builtin types; update various switch
statements to handle them. This assumes that the types should not be
mapped into Swift, similar to the OpenCL types.
2019-08-12 12:46:07 -07:00
Brent Royal-Gordon
fb20b503ba Merge branch 'master' into master-rebranch
# Conflicts:
#	lib/ClangImporter/ClangImporter.cpp
#	test/IRGen/builtins.swift
#	test/IRGen/enum.sil
#	tools/driver/autolink_extract_main.cpp
#	utils/build-presets.ini
2019-08-08 17:07:59 -07:00
Joe Groff
c0a9fef3cf Merge remote-tracking branch 'origin/master' into master-next 2019-08-05 10:38:17 -07:00
Joe Groff
f0e5e1911d IRGen: Access concrete type metadata by mangled name.
When we generate code that asks for complete metadata for a fully concrete specific type that
doesn't have trivial metadata access, like `(Int, String)` or `[String: [Any]]`,
generate a cache variable that points to a mangled name, and use a common accessor function
that turns that cache variable into a pointer to the instantiated metadata. This saves a bunch
of code size, and should have minimal runtime impact, since the demangling of any string only
has to happen once.

This mostly just works, though it exposed a couple of issues:

- Mangling a type ref including objc protocols didn't cause the objc protocol record to get
  instantiated. Fixed as part of this patch.
- The runtime type demangler doesn't correctly handle retroactive conformances. If there are
  multiple retroactive conformances in a process at runtime, then even though the mangled string
  refers to a specific conformance, the runtime still just picks one without listening to the
  mangler. This is left to fix later, rdar://problem/53828345.

There is some more follow-up work that we can do to further improve the gains:

- We could improve the runtime-provided entry points, adding versions that don't require size
  to be cached, and which can handle arbitrary metadata requests. This would allow for mangled
  names to also be used for incomplete metadata accesses and improve code size of some generic
  type accessors. However, we'd only be able to take advantage of the new entry points in
  OSes that ship a new runtime.
- We could choose to always symbolic reference all type references, which would generally reduce
  the size of mangled strings, as well as make runtime demangling more efficient, since it wouldn't
  need to hit the runtime caches. This would however require that we be able to handle symbolic
  references across files in the MetadataReader in order to avoid regressing remote mirror
  functionality.
2019-08-02 14:28:53 -07:00
swift-ci
cf177cc3eb Merge remote-tracking branch 'origin/master' into master-next 2019-03-06 07:49:31 -08:00
Arnold Schwaighofer
135e73ddab IRGen: Teach IRGen about calling noreturn C functions
rdar://46264442
SR-9313
2019-03-05 13:49:02 -08:00
Max Desiatov
37f8268ae7 Fix compatibility with upstream clang changes 2019-02-08 14:22:56 -08:00
Saleem Abdulrasool
e3da61b85f IRGen: adjust for SVN r352914 2019-02-04 10:14:31 -08:00
swift-ci
accd8ac8f3 Merge remote-tracking branch 'origin/master' into master-next 2018-11-30 00:30:45 -08:00
Slava Pestov
f8d28811bc IRGen: Relax an assertion
The result type mismatch comes up when we're calling a covariant
override of a class method resiliently as well.
2018-11-29 23:20:42 -05:00
Max Desiatov
de43c909c4 Fix compatibility with upstream clang changes 2018-11-10 11:13:41 +00:00
John McCall
3ea61ef4a0 Fix some IRGen bugs with coroutine lowering:
- The large-loadable-types pass was not rewriting function signatures
  correctly if only a yield type was rewritten.

- GenCall was not rewriting multiple yield types correctly.
2018-11-06 13:31:00 -05:00
Robert Widmann
57a5df1c49 Drop an unused variable from parameter explosion mapping 2018-10-06 17:52:58 -04:00
Jordan Rose
d412f4b4ba [IRGen] Adopt std::unique_ptr for IRGenDebugInfo (#19369) 2018-09-18 11:10:10 -07:00
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