Commit Graph

20 Commits

Author SHA1 Message Date
Andrew Trick
e4d8277723 SwiftCompilerSources: add UseList ignoreTypeDependence 2024-01-17 08:37:14 -08:00
Andrew Trick
f69dfe4e79 Add OperandOwnership.endsLifetime
And rename `uses.lifetimeEndingUses` to `uses.endingLifetime`
2024-01-17 08:37:14 -08:00
Andrew Trick
ed53ab764a [SIL] add Value.lifetimeEndingUses 2023-12-19 02:05:16 -08:00
Erik Eckstein
0509a056fb SwiftCompilerSources: improve APIs for UseList
Make filter APIs for UseList chainable by adding them to Sequence where Element == Operand

For example, it allows to write:
```
let singleUse = value.uses.ignoreDebugUses.ignoreUsers(ofType: EndAccessInst.self).singleUse
```

Also, add `UseList.getSingleUser(notOfType:)`
2023-11-13 20:18:07 +01:00
Erik Eckstein
eb597cb6d8 Swift SIL: add a few ownership APIs to ForwardingInstruction
* `canForwardGuaranteedValues`
* `canForwardOwnedValues`
* `setForwardingOwnership`
* `Operand.canAccept(ownership:)`
2023-11-13 20:18:07 +01:00
Nate Chandler
ae1f950315 [SwiftCompilerSources] Moved Test into Optimizer.
And changed the type of the context argument to FunctionPassContext.
2023-10-07 21:23:13 -07:00
Andrew Trick
bce9817162 SwiftCompilerSources: add ForwardingInstruction 2023-10-03 23:54:57 -07:00
Andrew Trick
139c573920 SwiftCompilerSources: add OperandOwnership enum. 2023-10-02 09:41:12 -07:00
Andrew Trick
1f7bfd8f12 SwiftCompilerSources: expose Swift Operand.endsLifetime 2023-10-02 09:41:12 -07:00
Erik Eckstein
5325a4fe21 Swift SIL: add some instruction classes and APIs
* add `UnownedRetainInst` and `UnownedReleaseInst`
* add `var value` to `RetainValueInst` and `ReleaseValueInst`
* make the protocol `UnaryInstruction` be an `Instruction`
* add `var Type.isValueTypeWithDeinit`
* add `var Type.isUnownedStorageType`
* add `var OperandArray.values`
2023-06-07 12:55:56 +02:00
Erik Eckstein
ee1c52bc77 Swift SIL: add some APIs 2023-05-22 15:34:26 +02:00
Erik Eckstein
eecea088e7 Swift Bridging: use C++ instead of C bridging for BridgedOperand and BridgedValue 2023-03-21 15:33:09 +01:00
Erik Eckstein
aea26bbc6e Swift SIL: add a utility protocol NoReflectionChildren for better debug output with lldb po
Let's lldb's `po` command not print any "internal" properties of the conforming type.
This is useful if the `description` already contains all the information of a type instance.
2022-10-05 07:37:41 +02:00
Erik Eckstein
4554939dc4 SwiftCompilerSources: consistently use assert instead of precondition
It's better to use the new assert implementation (defined in the "Basic" module) than Swift's `precondition`
2022-09-14 14:16:26 +02:00
Erik Eckstein
a17ee435b6 Swift SIL: fix var ApplySite.arguments
In case of type-dependent operands, not all operands are part of the arguments
2022-06-08 22:51:57 +02:00
Erik Eckstein
7c71f0091e Swift SIL: add UseList.isSingleUse 2022-05-12 21:48:37 +02: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
da6814d510 [SwiftCompiler] Make BridgedArrayRef.data nullable
ArrayRef.data() can be nullptr when the array is empty.
2022-02-20 22:30:18 -08: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
4beb94c2f9 Rename the libswift directory to SwiftCompilerSources 2021-12-22 09:46:25 +01:00