Commit Graph

1680 Commits

Author SHA1 Message Date
Konrad `ktoso` Malawski
54dec38a34 initial complete impl 2023-01-05 16:19:05 +09:00
swift-ci
f476abf4a1 Merge remote-tracking branch 'origin/main' into rebranch 2022-12-20 17:13:36 -08:00
Pavel Yaskevich
0c5e133ab4 [IRGen] Add runtime accessible functions to a special section 2022-12-20 09:45:01 -08:00
swift-ci
c8bcfcc57f Merge remote-tracking branch 'origin/main' into rebranch 2022-12-16 18:34:15 -08:00
Adrian Prantl
a9f0b2a84f Remove StorageType from DebugTypeInfo::getErrorResult().
Error results are always indirect so passing in the llvm storage type (which is
always a pointer) is entirely pointless.

rdar://103416237
2022-12-16 13:32:48 -08:00
swift-ci
2a6e9d30eb Merge remote-tracking branch 'origin/main' into rebranch 2022-12-14 19:54:28 -08:00
swift-ci
9eb3adb69e Merge pull request #62591 from adrian-prantl/fixed-buffer
Sink isFixedBuffer into DebugTypeInfo and ensure the enclosed types
2022-12-14 19:51:26 -08:00
Adrian Prantl
06a54432ab Sink isFixedBuffer into DebugTypeInfo and ensure the enclosed types aren't
emitted with the size of the fixed buffer.
2022-12-14 14:18:28 -08:00
swift-ci
d9031ef308 Merge remote-tracking branch 'origin/main' into rebranch 2022-12-13 19:12:55 -08:00
Slava Pestov
57eeb1894d Merge pull request #62548 from slavapestov/irgen-pack-shape
IRGen: Preliminary support for working with pack shapes
2022-12-13 22:08:54 -05:00
swift-ci
dcfb01cfb3 Merge remote-tracking branch 'origin/main' into rebranch 2022-12-13 09:16:29 -08:00
Slava Pestov
6e31af6dda IRGen: Simplify enumerateFulfillments() 2022-12-13 11:56:33 -05:00
Adrian Prantl
2dc75858ae Merge pull request #62542 from adrian-prantl/task-alloc
Fix IRGen debug info for swift_task_alloc'ed variables.
2022-12-13 08:55:49 -08:00
Adrian Prantl
e67d8bf4e3 Fix IRGen debug info for swift_task_alloc'ed variables.
The old code attempted to load the variable despite not knowing its size. Fixed
by describing the variable's address on the task heap.
2022-12-12 17:19:49 -08:00
swift-ci
328e716489 Merge remote-tracking branch 'origin/main' into rebranch 2022-12-12 07:33:19 -08:00
Nate Chandler
8d8577e5b0 [SIL] Removed Indirect_In_Constant convention.
It is no different from @in.

Continue parse @in_constant in textual and serialized SIL, but just as
an alias for @in.
2022-12-09 21:54:00 -08:00
swift-ci
b2dc50cc25 Merge remote-tracking branch 'origin/main' into rebranch 2022-12-06 17:33:32 -08:00
Arnold Schwaighofer
0ca27df7fc IRGen: Fix a use-after-free error in ShadowStackSlots creation
The `ShadowStackSlots` map uses a `StringRef` to the `SmallString<4>` entry in
the `AnonymousVariables` map. When `AnonymousVariables` is resized the pointer
to the inline string entry will no longer be valid.

No reproducer.

rdar://102982240
2022-12-06 12:28:58 -08:00
swift-ci
efef52a86e Merge remote-tracking branch 'origin/main' into rebranch 2022-11-28 09:33:40 -08:00
Erik Eckstein
ab1b343dad use new llvm::Optional API
`getValue` -> `value`
`getValueOr` -> `value_or`
`hasValue` -> `has_value`
`map` -> `transform`

The old API will be deprecated in the rebranch.
To avoid merge conflicts, use the new API already in the main branch.

rdar://102362022
2022-11-21 19:44:24 +01:00
Rintaro Ishizaki
d458c8b74a Merge remote-tracking branch 'origin/main' into rebranch
Conflicts:
	include/swift/Sema/ConstraintSystem.h
	include/swift/Syntax/AbsoluteRawSyntax.h
	include/swift/Syntax/Syntax.h
	include/swift/Syntax/SyntaxData.h
	lib/DependencyScan/ModuleDependencyCacheSerialization.cpp
	lib/Syntax/SyntaxFactory.cpp.gyb
	lib/Syntax/SyntaxNodes.cpp.gyb
	tools/SourceKit/lib/SwiftLang/SwiftEditor.cpp
	tools/swift-syntax-test/swift-syntax-test.cpp
2022-11-18 09:37:38 -08:00
Xi Ge
c5a7eff0c9 Merge pull request #62147 from tshortli/has-symbol-sil-instruction 2022-11-18 04:34:24 -08:00
Allan Shortlidge
ae32b8e148 IRGen: Implement lowering of has_symbol SIL instruction. 2022-11-16 16:07:29 -08:00
Allan Shortlidge
0a24042cdd SIL: Introduce the has_symbol SIL instruction. 2022-11-16 16:07:26 -08:00
Arnold Schwaighofer
a667c7348f DebugInfo: Fix shadow variable emisson for non-loadable types
rdar://102157827
2022-11-16 12:34:39 -08:00
swift-ci
6bb167f353 Merge remote-tracking branch 'origin/main' into rebranch 2022-11-14 23:34:22 -08:00
Erik Eckstein
190fea8acc IRGen: getPointerElementType -> getNonOpaquePointerElementType
`getPointerElementType` is deprecated in a newer LLVM.
2022-11-14 20:36:09 +01:00
Arnold Schwaighofer
d68dc2d06e IRGen: objc_direct method calls have a different convention
objc_direct methods no longer have the CMD argument.

rdar://102151993
2022-11-10 12:55:51 -08:00
Erik Eckstein
533fa45f79 IRgen: AllocAInst::getAlignment -> AllocaInst::getAlign 2022-11-04 20:44:19 +01:00
Arnold Schwaighofer
8535e808b0 Merge pull request #61459 from aschwaighofer/opaque_ptr_part_2
IRGen: More fixes for LLVM's opaque pointers
2022-10-18 08:01:21 -07:00
Nate Chandler
ab35362056 [SIL] Added new test_specification instruction.
The new instruction exists only to be used in tests.  The idea is to
specify tests that ought to be run "in the context" of the containing
function.
2022-10-11 17:15:13 -07:00
Arnold Schwaighofer
296c1e9fbd fix IRGenSILFunction::visitClassMethodInst 2022-10-05 09:23:53 -07:00
Arnold Schwaighofer
1264735c0c Fix emitIsUniqueCall 2022-10-05 09:23:25 -07:00
Arnold Schwaighofer
815372e688 More places we expect the signature to be used 2022-10-05 09:23:06 -07:00
Arnold Schwaighofer
3115feae7e Track when we expect the signature to be used for the function type 2022-10-05 09:21:12 -07:00
Arnold Schwaighofer
d810b0f7e4 IRGen: Pass the elementType of pointers through to operations
In preparation for moving to llvm's opaque pointer representation
replace getPointerElementType and CreateCall/CreateLoad/Store uses that
dependent on the address operand's pointer element type.

This means an `Address` carries the element type and we use
`FunctionPointer` in more places or read the function type off the
`llvm::Function`.
2022-10-03 15:27:12 -07:00
Hamish Knight
b12015c343 [SIL] Introduce the increment_profiler_counter instruction
This is a dedicated instruction for incrementing a
profiler counter, which lowers to the
`llvm.instrprof.increment` intrinsic. This
replaces the builtin instruction that was
previously used, and ensures that its arguments
are statically known. This ensures that SIL
optimization passes do not invalidate the
instruction, fixing some code coverage cases in
`-O`.

rdar://39146527
2022-09-07 17:55:13 +01:00
Mishal Shah
91b2abe996 Merge pull request #60531 from apple/pull-request-rebranch
Merge `rebranch` into  `main` to support llvm-project `stable/20220421`
2022-08-15 17:10:56 -07:00
zoecarver
39af79f491 [cxx-interop] Re-enable debug mangling. 2022-08-12 15:57:56 -07:00
swift-ci
117d22acd9 Merge remote-tracking branch 'origin/main' into rebranch 2022-08-11 16:34:43 -07:00
Michael Gottesman
5baf2af88a [sil] Add a new instruction called explicit_copy_addr.
This is exactly like copy_addr except that it is not viewed from the verifiers
perspective as an "invalid" copy of a move only value. It is intended to be used
in two contexts:

1. When the move checker emits a diagnostic since it could not eliminate a copy,
we still need to produce valid SIL without copy_addr on move only types since we
will hit canonical SIL eventually even if we don't actually codegen the SIL. The
pass can just convert said copy_addr to explicit_copy_addr and everyone is
happy.

2. To implement the explicit copy function for address only types.
2022-08-11 11:40:53 -07:00
swift-ci
d735697088 Merge remote-tracking branch 'origin/main' into rebranch 2022-07-14 01:13:21 -07:00
Pavel Yaskevich
5bd077a461 [SIL] Keep alive @_alwaysEmitIntoClient decls with opaque result types
If such declarations have availability conditions they have to be
kept alive until IRGen to emit opaque type descriptor that is going
be used at runtime to determine the underlying type.

This is important for "optimized" mode only because in non-optimized
mode "shared" symbol survives SILGen.
2022-07-13 15:46:23 -07:00
swift-ci
8a2b842d23 Merge remote-tracking branch 'origin/main' into rebranch 2022-07-12 15:54:33 -07:00
Pavel Yaskevich
76ab70c3a8 [IRGen] Emit opaque type descriptors into client for @_alwaysInlineIntoClient decls
If opaque result type has availability conditions and is associated with
an `@_alwaysInlineIntoClient` declaration, its metadata descriptor has to
be emitted into a client module because the body of the inlined function
depends on it for the runtime information about the underlying type.

Resolves: rdar://82791712
2022-07-12 11:36:38 -07:00
swift-ci
bc8cecbd9a Merge remote-tracking branch 'origin/main' into rebranch 2022-06-22 22:13:18 -07:00
Erik Eckstein
24d077e78b IRGen: re-enable generate static arrays in read-only data sections.
So far, static arrays had to be put into a writable section, because the isa pointer and the (immortal) ref count field were initialized dynamically at the first use of such an array.

But with a new runtime library, which exports the symbols for the (immortal) ref count field and the isa pointer, it's possible to put the whole array into a read-only section. I.e. make it a constant global.

rdar://94185998

This reverts the revert commit df353ff3c0.
Also, I added a frontend option to disable this optimization: `-disable-readonly-static-objects`
2022-06-21 18:30:42 +02:00
swift-ci
743cd8cb76 Merge remote-tracking branch 'origin/main' into rebranch 2022-06-17 13:55:02 -07:00
Erik Eckstein
df353ff3c0 Revert "IRGen: generate static arrays in read-only data sections."
This reverts commit aca0d8358b.

I need to fix a problem before this can actually land.
2022-06-17 20:32:32 +02:00
swift-ci
0c25b6259b Merge remote-tracking branch 'origin/main' into rebranch 2022-06-17 06:34:50 -07:00