Commit Graph

26 Commits

Author SHA1 Message Date
Doug Gregor
9ea8671c3f Use @c instead of @_cdecl in the Embedded Swift runtime
This change moves us toward the official feature, and eliminates the
extra level of "thunk" that was implied by `@_cdecl`. Amusingly, this
trips up the LLVM-level ARC optimizations, because we are trying to
perform ARC optimizations within the retain/release runtime functions.
Teach those optimization passes to leave swift_retainN et al alone.
2025-11-13 18:39:10 -08:00
Arnold Schwaighofer
5c9eab0f6c Update Swift's LLVM passes to include new pass manager versions 2022-07-15 08:22:32 -07:00
Anthony Latsis
9fd1aa5d59 [NFC] Pre- increment and decrement where possible 2020-06-01 15:39:29 +03:00
Mike Ash
46309d9794 [Runtime] Rename swift_unknown* functions to swift_unknownObject*.
These functions don't accept local variable heap memory, although the names make it sound like they work on anything. When you try, they mistakenly identify such things as ObjC objects, call through to the equivalent objc_* function, and crash confusingly. This adds Object to the name of each one to make it more clear what they accept.

rdar://problem/37285743
2018-08-15 17:48:23 -04:00
Michael Gottesman
32805cbd23 [llvm-arc-opts] When RAUWing of bridgeRetain->bridgeRetainN, cast the result of the bridgeRetainN to the type of bridgeRetain.
Since we introduce the declaration for bridgeRetainN, its result type may be out
of sync with bridgeRetain's. This means that when we perform a RAUW of one for
the other, the types do not match and we get an LLVM error. Instead, just cast
the bridgeRetainN's type to bridgeRetain's result type.

rdar://40507281
2018-06-04 13:15:28 -07:00
Hugh Bellamy
f001b7562b Use relatively new LLVM_FALLLTHROUGH instead of our own SWIFT_FALLTHROUGH 2017-02-12 10:47:03 +07:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Michael Gottesman
b018645418 [semantic-arc] Add __swift_endBorrow support to LLVMPasses and make sure it is removed by LLVMARCContract.cpp. 2016-10-17 14:43:28 -07:00
Roman Levenstein
d8e28bb690 Handle the [nonatomic] attribute in IRGen and LLVM passes.
Properly lower reference counting SIL instructions with nonatomic attribute as invocations of corresponding non-atomic reference counting runtime functions.
2016-04-06 22:30:23 -07:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
Michael Gottesman
9ebc0d214b Move the declaration of initializeSwiftARCContractPass and initializeSwiftARCOptPass from {LLVMARCContarct,LLVMARCOpts}.cpp => PassesFwd.h so swift-llvm-opts can use them.
Swift SVN r32807
2015-10-21 21:45:19 +00:00
Chris Lattner
fe78e77783 silence some warnings.
Swift SVN r32176
2015-09-23 05:06:51 +00:00
Xin Tong
2b546cd6b5 Implement bridgeobject_retain/release merging in LLVMARCContract. rdar://22108790
recommit for r32132.

Swift SVN r32145
2015-09-22 04:34:53 +00:00
Dmitri Hrybenko
55c6c8bd98 Revert "Implement bridgeobject_retain/release merging in LLVMARCContract. rdar://22108790"
This reverts commit r32132.  It broke tests:

Swift :: 1_stdlib/FloatingPoint.swift.gyb
Swift :: 1_stdlib/NSStringAPI.swift
Swift :: 1_stdlib/Runtime.swift
Swift :: Interpreter/SDK/CoreGraphics_CGFloat.swift

Swift SVN r32142
2015-09-22 01:08:02 +00:00
Xin Tong
3eb7000b8f Implement bridgeobject_retain/release merging in LLVMARCContract. rdar://22108790
Swift SVN r32132
2015-09-21 23:06:19 +00:00
Xin Tong
c9f43c824c LLVM level RC identity, strip off pointer casts as well as reference forwarding
for some of the entry points. rdar://22774326

Swift SVN r32124
2015-09-21 21:16:22 +00:00
Xin Tong
768a6011de Add retain_n entry points to SwiftAA. rdar://22765670
Swift SVN r32094
2015-09-19 16:37:27 +00:00
Xin Tong
75385d0501 merge multiple unknownRetain/unknownReleases to
unknownRetain_n/unknownRelease_n rdar://21945003

Swift SVN r32084
2015-09-18 22:25:59 +00:00
Xin Tong
dca508bfbb This is part of a series of commits to remove reference forwarding for
some of the ARC entry points. rdar://22724641. After this commit,
swift_retain_noresult will be completely replaced by swift_retain.
LLVMARCOpts pass is modified NOT to rewrite swift_retain to
swift_retain_noresult which forward no reference.

Swift SVN r32082
2015-09-18 21:56:50 +00:00
Xin Tong
bc3fe169b4 This is part of a series of commits to remove reference forwarding for some of the ARC entry points. rdar://22724641.
After this commit, swift_retain will return no reference and LLVMARCContract pass is modified NOT to rewrite
swift_retain_noresult to old swift_retain which forwarded the reference.

Swift SVN r32075
2015-09-18 20:35:39 +00:00
Michael Gottesman
121ef3ef9f Revert the series of commits for removing the return value from swift_retain_noresult.
I asked that the patches were split up so I could do post commit review.

This reverts commit r32059.
This reverts commit r32058.
This reverts commit r32056.
This reverts commit r32055.

Swift SVN r32060
2015-09-18 02:31:24 +00:00
Xin Tong
4e46dacc3d Completely replace swift_retain_noresult with swift_retain. this is part of a series of commits
to remove reference forwarding for some of the ARC entry points. rdar://22724641. After this
commit, swift_retain_noresult will be completely replaced by swift_retain and LLVMARCOpts.cpp
will no longer canonicalize swift_retain to swift_retain_noresult as now swift_retain returns no
reference.

Swift SVN r32058
2015-09-18 01:51:17 +00:00
Xin Tong
955e4ed652 Change swift_retain/swift_retain_n to return no value. this is part of a series of commits
to remove reference forwarding for some of the ARC entry points. rdar://22724641. After this
commit, swift_retain will be the same as swift_retain_noresult, returning no reference.
LLVMARCContract pass is also modified NOT to rewrite swift_retain_noresult to the
old swift_retain which forwards the reference.

Swift SVN r32055
2015-09-18 00:41:35 +00:00
Michael Gottesman
8e9bc84677 Perform the RRN optimization early/clear when we see an unknown call.
If we have an unknown call, we need to create any retainN calls we
have seen. The reason why is that we do not want to move retains,
releases over isUniquelyReferenced calls. Specifically imagine this:

retain(x); unknown(x); release(x); isUniquelyReferenced(x); retain(x);

In this case we would with this optimization merge the last retain
with the first. This would then create an additional copy. The
release side of this is:

retain(x); unknown(x); release(x); isUniquelyReferenced(x); release(x);

Again in such a case by merging the first release with the second
release, we would be introducing an additional copy.

Thus if we see an unknown call we merge together all retains and
releases before to get some optimization without any loss of
correctness. This could be made more aggressive through appropriate
alias analysis and usage of LLVM's function attributes to determine that
a function does not touch globals.

Swift SVN r30394
2015-07-20 06:34:57 +00:00
Michael Gottesman
0db8d77e4c Refactor LLVMARCContract => LLVMARCContract.cpp.
Swift SVN r30393
2015-07-20 06:34:55 +00:00