Erik Eckstein
082aec0990
Swift SIL: add var FunctionArgument.convention
...
Also:
* move the `ArgumentConvention` enum from Function.swift to Argument.swift.
* `FunctionArgument.isExclusiveIndirectParameter` -> `ArgumentConvention.isExclusiveIndirect`
* add `ArgumentConvention.isInout`
2022-09-02 07:11:49 +02:00
Erik Eckstein
fe40707d5e
Swift SIL: add Function.isPossiblyUsedExternally and Function.isAvailableExternally
2022-08-24 17:54:46 +02:00
Erik Eckstein
306e5b0c9c
Swift SIL: make Function hashable
2022-08-24 17:54:46 +02:00
Erik Eckstein
3bba7caacc
Swift SIL: add var Function.instructions
...
To be used to iterate over all instructions in a function without the need of two loops - one for blocks and one for instructions.
2022-08-24 17:54:46 +02:00
Egor Zhdan
0e2d438c5b
[cxx-interop][SwiftCompilerSources] Use llvm::StringRef instead of BridgedStringRef
...
rdar://83361000
2022-07-21 16:32:16 +01:00
Egor Zhdan
f476f6245c
[cxx-interop][SwiftCompilerSources] Workaround for std::string crash on arm64 Linux
...
`std::string` constructor crashes when called from `SILBridging.cpp`, likely due to a miscompile. This is a workaround that fixes the crash.
2022-06-15 15:54:45 +01:00
Egor Zhdan
ffb9ee9422
Revert "Revert "[cxx-interop][SwiftCompilerSources] Fix conversion between std::string and Swift.String""
...
This reverts commit 9542837a18 .
2022-06-09 23:40:51 +01:00
Egor Zhdan
9542837a18
Revert "[cxx-interop][SwiftCompilerSources] Fix conversion between std::string and Swift.String"
...
This reverts commit be711e387f .
2022-06-08 14:10:04 +01:00
Egor Zhdan
be711e387f
[cxx-interop][SwiftCompilerSources] Fix conversion between std::string and Swift.String
...
This fixes a dangling pointer issue when creating a `Swift.String` from `std::string`.
Also fixes a warning:
```
warning: variable 's' was never mutated; consider changing to 'let' constant
var s = SILBasicBlock_debugDescription(bridged)
~~~ ^
let
```
rdar://92963081
rdar://93053488
2022-05-30 20:06:36 +01:00
Erik Eckstein
a91d541a26
Swift SIL: add ApplySite.substitutionMap and ApplySite.getArgumentConvention()
2022-05-12 21:48:37 +02:00
Erik Eckstein
dd5d5f97c4
Swift SIL: add Function.hasSemanticsAttribute
2022-05-12 21:48:37 +02:00
Erik Eckstein
14b985d87e
Swift SIL: support ownership
...
* add the `Ownership` enum and the `Value.ownership` getter
* add `Function.hasOwnership`
2022-05-12 21:48:37 +02:00
Erik Eckstein
cd456fa792
Swift SIL: make Function.name and GlobalVariable.name return a StringRef and not a String
...
and introduce the StringRef struct.
It's more efficient.
Also, rename the `HasName` protocol to `HasShortDescription`, which introduces the new requirement `shortDescription`. This is need because `name` now has `StringRef` type and not `String` anymore
2022-05-12 21:48:37 +02:00
Allan Shortlidge
1ffe55b856
Revert "swift SIL: Fix variable 's' was never mutated; consider changing to 'let' constant warnings."
...
This reverts commit d83c17e832 .
2022-05-10 10:38:58 -07:00
Allan Shortlidge
d83c17e832
swift SIL: Fix variable 's' was never mutated; consider changing to 'let' constant warnings.
2022-05-06 17:29:12 -07:00
Egor Zhdan
145ed33482
[cxx-interop][SwiftCompilerSources] Use std::string instead of BridgedStringRef
...
This reverts commit 2900dec7
2022-05-03 19:48:14 +01:00
Erik Eckstein
325a0b1f48
swift SIL: add some Instruction, Value and Type APIs
...
* instructions `RefToBridgeObjectInst`, `BridgeObjectToWordInst`, `StringLiteralInst`, `ProjectBoxInst`, `InitEnumDataAddrInst`, `UncheckedTakeEnumDataAddrInst`, `InjectEnumAddrInst`
* protocols `StoringInstruction` and `EnumInstruction`
* load/store-weak/unowned instructions
* `CopyAddrInst.isTakeOfSrc/isInitializationOfDest`
* `ApplySite.calleeArgIndex/callerArgIndex`
* `SILValue.definingInstruction/definingBlock/function`
* `Type.isReferenceCounted`
* `FunctionArgument.isExclusiveIndirectParameter`
* support `CondBranchInst` in `incomingPhiValues`
2022-03-30 14:45:58 +02:00
Rintaro Ishizaki
7486cd1c21
[SwiftCompiler] Move common bridging facilities to 'Basic'
...
A preparation for AST/DiagnosticEngine bridging
2022-02-20 22:06:39 -08:00
Erik Eckstein
603e837a8f
Swift optimizations: make isSwift51RuntimeAvailable sensitive to the resilience domain of the function.
2022-01-27 13:20:38 +01:00
Erik Eckstein
f09dfc93a9
Swift SIL: escape effects for function arguments.
...
Store a list of argument effects in a function, which specify if and how arguments escape.
Such effects can be specified in the Swift source code (for details see docs/ReferenceGuides/UnderscoredAttributes.md) or derived in an optimization pass.
For details see the documentation in SwiftCompilerSources/Sources/SIL/Effects.swift.
2022-01-25 11:29:44 +01:00
Erik Eckstein
cec4b82b39
swift SIL: add some SIL type related bridging
...
* `Function.argumentTypes` and `Function.resultType`
* `Type.isNominal`, `Type.isClass`, `Type.isTuple`, `Type.isStruct` and `Type.isEnum`
* `Type.getFieldIndexOfNominal`
* `Type.getFieldTypeOfNominal`
* `Type.tupleElements`
* `Type.description` for better debugging
# Conflicts:
# SwiftCompilerSources/Sources/SIL/Type.swift
# SwiftCompilerSources/Sources/SIL/Utils.swift
# SwiftCompilerSources/Sources/SIL/Value.swift
# include/swift/SIL/SILBridging.h
# lib/SIL/Utils/SILBridging.cpp
2022-01-19 18:51:19 +00:00
Max Desiatov
7d961001d3
libswift: bridge more functions from SILBuilder
2022-01-19 18:51:18 +00:00
Max Desiatov
f2aefad246
libswift: clean up SIL/Function.swift formatting
2022-01-19 18:51:18 +00:00
Erik Eckstein
345fcbe39a
Improve collections in the swift SIL/Optimizer
...
Improve block/instruction lists and similar collections
* pretty print collections in the form “[a, b, c]”
* also do this for lazy sequences
* define a custom Mirror
* in a collection, only print the name of blocks, functions and globals (instead of the full object)
* replace `BasicBlock.reverseInstructions` with `BasicBlock.instructions.reversed()` - in an efficient way
2022-01-12 15:47:16 +01:00
Erik Eckstein
24b62d4d7c
Swift SIL: add a few utilities and instructions
...
* instructions: function_ref, mark_dependence
* add `BuiltinInst.id`
* add isObjC and canAllocOnStack for alloc_ref and alloc_ref_dynamic
* add `ApplySite::referencedFunction`
* add `Builder.createDeallocStackRef`
* add == and != operators for `Function`
* add `List.first` and `ReverseList.first`
2022-01-12 15:47:15 +01:00
Erik Eckstein
4beb94c2f9
Rename the libswift directory to SwiftCompilerSources
2021-12-22 09:46:25 +01:00