mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user