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`
This commit is contained in:
Erik Eckstein
2022-01-20 19:01:36 +01:00
parent ab1a9896f9
commit 325a0b1f48
14 changed files with 280 additions and 48 deletions

View File

@@ -21,19 +21,7 @@ public struct Operand : CustomStringConvertible, CustomReflectable {
}
public var value: Value {
let v = Operand_getValue(bridged).getAs(AnyObject.self)
switch v {
case let inst as SingleValueInstruction:
return inst
case let arg as Argument:
return arg
case let mvr as MultipleValueInstructionResult:
return mvr
case let undef as Undef:
return undef
default:
fatalError("unknown Value type")
}
Operand_getValue(bridged).value
}
public static func ==(lhs: Operand, rhs: Operand) -> Bool {