Commit Graph

9 Commits

Author SHA1 Message Date
Mishal Shah
3594f8ecaf Merge remote-tracking branch 'origin/main' into rebranch
Conflicts:
	test/IRGen/opaque-pointer-llvm.swift
2023-10-15 23:49:40 -07:00
Yuta Saito
a0bb0d8ec8 [wasm] Use __main_argc_argv as entry point name
Wasm C ABI now uses `int __main_argc_argv(int argc, char *argv[])` as
entry point signature[^1], and wasi-libc has removed backward compatibility
with legacy "main"[^2], so we need to support the new name in compiler side.

[^1]: https://github.com/WebAssembly/tool-conventions/blob/main/BasicCABI.md
[^2]: d8d00bcd5a
2023-10-12 21:05:06 +00:00
swift-ci
1b6470ca9c Merge remote-tracking branch 'origin/main' into rebranch 2023-09-20 15:07:15 -07:00
Yuta Saito
c5314bd3af Centralize KeyPath accessor calling convention logic to IRGen
KeyPath's getter/setter/hash/equals functions have their own calling
convention, which receives generic arguments and embedded indices from a
given KeyPath argument buffer.
The convention was previously implemented by:
1. Accepting an argument buffer as an UnsafeRawPointer and casting it to
   indices tuple pointer in SIL.
2. Bind generic arguments info from the given argument buffer while emitting
   prologue in IRGen by creating a new forwarding thunk.

This 2-phase lowering approach was not ideal, as it blocked KeyPath
projection optimization [^1], and also required having a target arch
specific signature lowering logic in SIL-level [^2].

This patch centralizes the KeyPath accessor calling convention logic to
IRGen, by introducing `@convention(keypath_accessor_XXX)` convention in
SIL and lowering it in IRGen. This change unblocks the KeyPath projection
optimization while capturing subscript indices, and also makes it easier
to support WebAssembly target.

[^1]: https://github.com/apple/swift/pull/28799
[^2]: https://forums.swift.org/t/wasm-support/16087/21
2023-09-20 11:25:39 -07:00
Ben Barham
095d67593e [rebranch] Fix the spelling of memeffect attributes in IRGen
Fixes the last few remaining `read*` -> `memory(*)`. Note that
`object_type.swift` is still failing as it now has different attributes.
2023-08-07 14:04:15 -07:00
Arnold Schwaighofer
d7852025a9 IRGen: Change to using frame-pointer=non-leaf for functions that request no framepointer
Using frame-pointer=none inhibits usage of compact unwind info.

rdar://98857255
2023-02-08 08:54:41 -08:00
Arnold Schwaighofer
4ad42e65f5 IRGen: Set readonly and willreturn on meta data instantiation functions
`readonly` (instead of `readnone`) because we want there to be a memory control
dependence on potential preceeding availability checks.

`willreturn` such that LLVM can remove calls without a use.
2022-04-21 13:11:53 -07:00
Yuta Saito
b5ae4d1397 [IRGen] Emit keypath thunk helpers with swiftcc to match the caller cc
KeyPath thunk helpers are called from stdlib indirectly through
descriptor and its calling-convention in the caller side is SwiftCC.
However, the definition side expects C calling-convention, so they
can be broken on some architectures, that SwiftCC is not compatible
with C-CC on it.

This patch changes to use SwiftCC consistently on caller side and
definition side.
This doesn't have any effect on the ABI stable platforms because
SwiftCC is compatible with C-CC on them.
2021-10-01 10:01:39 -07:00
John McCall
03d94b44a6 Add default IR attributes to helper functions and convert
several more places to use getOrCreateHelperFunction.

This means that several of these places are now emitting
shared functions rather than private ones, which I've
verified is okay.  There are some other places where
privacy is still unfortunately necessary.

I've also fixed the name of the store-extra-inhabitants
helper function to say "store" instead of "get", which
is longstanding (but harmless because it's private).

Fixes rdar://66707994.
2020-08-08 16:57:02 -04:00