mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Swift SIL: rename isTakeOfSrc -> isTakeOfSource and isInitializationOfDest -> isInitializationOfDestination
Trying to avoid abbreviations in ABI names
This commit is contained in:
@@ -262,8 +262,8 @@ struct AliasAnalysis {
|
||||
case let copy as SourceDestAddrInstruction:
|
||||
let mayRead = memLoc.mayAlias(with: copy.source, self)
|
||||
let mayWrite = memLoc.mayAlias(with: copy.destination, self)
|
||||
var effects = SideEffects.Memory(read: mayRead, write: mayWrite || (mayRead && copy.isTakeOfSrc))
|
||||
if !copy.isInitializationOfDest {
|
||||
var effects = SideEffects.Memory(read: mayRead, write: mayWrite || (mayRead && copy.isTakeOfSource))
|
||||
if !copy.isInitializationOfDestination {
|
||||
effects.merge(with: defaultEffects(of: copy, on: memLoc))
|
||||
}
|
||||
return effects
|
||||
|
||||
@@ -108,10 +108,10 @@ private struct CollectedEffects {
|
||||
addEffects(.read, to: copy.source)
|
||||
addEffects(.write, to: copy.destination)
|
||||
|
||||
if !copy.isTakeOfSrc {
|
||||
if !copy.isTakeOfSource {
|
||||
addEffects(.copy, to: copy.source)
|
||||
}
|
||||
if !copy.isInitializationOfDest {
|
||||
if !copy.isInitializationOfDestination {
|
||||
addDestroyEffects(ofAddress: copy.destination)
|
||||
}
|
||||
|
||||
@@ -494,7 +494,7 @@ private struct ArgumentEscapingWalker : ValueDefUseWalker, AddressDefUseWalker {
|
||||
case let copy as CopyAddrInst:
|
||||
if address == copy.sourceOperand &&
|
||||
!address.value.hasTrivialType &&
|
||||
(!function.hasOwnership || copy.isTakeOfSrc) {
|
||||
(!function.hasOwnership || copy.isTakeOfSource) {
|
||||
foundTakingLoad = true
|
||||
}
|
||||
return .continueWalk
|
||||
|
||||
@@ -153,7 +153,7 @@ private func constructLetInitRegion(
|
||||
|
||||
case let copy as CopyAddrInst
|
||||
where copy.destination.isLetFieldAddress(of: markUninitialized):
|
||||
assert(copy.isInitializationOfDest)
|
||||
assert(copy.isInitializationOfDestination)
|
||||
initRegion.insert(inst)
|
||||
|
||||
case let beginAccess as BeginAccessInst
|
||||
|
||||
@@ -78,7 +78,7 @@ private func findCopyForNRVO(for outArg: FunctionArgument) -> CopyAddrInst? {
|
||||
// %local = alloc_stack $T
|
||||
// store %in to %local : $*T
|
||||
// copy_addr %local to [init] %out : $*T
|
||||
if !copyToArg.isTakeOfSrc {
|
||||
if !copyToArg.isTakeOfSource {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -158,7 +158,7 @@ extension CopyAddrInst : LoadingInstruction {
|
||||
return false
|
||||
}
|
||||
if !parentFunction.hasOwnership {
|
||||
if !isTakeOfSrc || !isInitializationOfDest {
|
||||
if !isTakeOfSource || !isInitializationOfDestination {
|
||||
// For simplicity, bail if we would have to insert compensating retains and releases.
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -519,7 +519,7 @@ fileprivate struct EscapeWalker<V: EscapeVisitor> : ValueDefUseWalker,
|
||||
if operand == copyAddr.sourceOperand {
|
||||
return walkUp(address: copyAddr.destination, path: path)
|
||||
} else {
|
||||
if !copyAddr.isInitializationOfDest {
|
||||
if !copyAddr.isInitializationOfDestination {
|
||||
if handleDestroy(of: operand.value, path: path.with(knownType: nil)) == .abortWalk {
|
||||
return .abortWalk
|
||||
}
|
||||
|
||||
@@ -495,7 +495,7 @@ extension LifetimeDependence.Scope {
|
||||
case is DestroyAddrInst:
|
||||
range.insert(inst)
|
||||
case let sdai as SourceDestAddrInstruction
|
||||
where sdai.sourceOperand == use && sdai.isTakeOfSrc:
|
||||
where sdai.sourceOperand == use && sdai.isTakeOfSource:
|
||||
range.insert(inst)
|
||||
case let li as LoadInst where li.loadOwnership == .take:
|
||||
range.insert(inst)
|
||||
|
||||
@@ -954,7 +954,7 @@ extension CopyAddrInst {
|
||||
let srcFieldAddr = builder.createStructElementAddr(structAddress: source, fieldIndex: idx)
|
||||
let destFieldAddr = builder.createStructElementAddr(structAddress: destination, fieldIndex: idx)
|
||||
builder.createCopyAddr(from: srcFieldAddr, to: destFieldAddr,
|
||||
takeSource: isTake(for: srcFieldAddr), initializeDest: isInitializationOfDest)
|
||||
takeSource: isTake(for: srcFieldAddr), initializeDest: isInitializationOfDestination)
|
||||
}
|
||||
context.erase(instruction: self)
|
||||
return true
|
||||
@@ -964,7 +964,7 @@ extension CopyAddrInst {
|
||||
let srcFieldAddr = builder.createTupleElementAddr(tupleAddress: source, elementIndex: idx)
|
||||
let destFieldAddr = builder.createTupleElementAddr(tupleAddress: destination, elementIndex: idx)
|
||||
builder.createCopyAddr(from: srcFieldAddr, to: destFieldAddr,
|
||||
takeSource: isTake(for: srcFieldAddr), initializeDest: isInitializationOfDest)
|
||||
takeSource: isTake(for: srcFieldAddr), initializeDest: isInitializationOfDestination)
|
||||
}
|
||||
context.erase(instruction: self)
|
||||
return true
|
||||
@@ -973,7 +973,7 @@ extension CopyAddrInst {
|
||||
}
|
||||
|
||||
private func isTake(for fieldValue: Value) -> Bool {
|
||||
return isTakeOfSrc && !fieldValue.type.objectType.isTrivial(in: parentFunction)
|
||||
return isTakeOfSource && !fieldValue.type.objectType.isTrivial(in: parentFunction)
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
@@ -992,7 +992,7 @@ extension CopyAddrInst {
|
||||
if type.isTrivial(in: parentFunction) {
|
||||
return .trivial
|
||||
}
|
||||
if isTakeOfSrc {
|
||||
if isTakeOfSource {
|
||||
return .take
|
||||
}
|
||||
return .copy
|
||||
@@ -1005,7 +1005,7 @@ extension CopyAddrInst {
|
||||
if type.isTrivial(in: parentFunction) {
|
||||
return .trivial
|
||||
}
|
||||
if isInitializationOfDest {
|
||||
if isInitializationOfDestination {
|
||||
return .initialize
|
||||
}
|
||||
return .assign
|
||||
|
||||
@@ -230,7 +230,7 @@ private extension Operand {
|
||||
case let copy as SourceDestAddrInstruction:
|
||||
if self == copy.destinationOperand {
|
||||
return true
|
||||
} else if self == copy.sourceOperand && copy.isTakeOfSrc {
|
||||
} else if self == copy.sourceOperand && copy.isTakeOfSource {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
||||
@@ -318,8 +318,8 @@ final public class AssignOrInitInst : Instruction, StoringInstruction {}
|
||||
public protocol SourceDestAddrInstruction : Instruction {
|
||||
var sourceOperand: Operand { get }
|
||||
var destinationOperand: Operand { get }
|
||||
var isTakeOfSrc: Bool { get }
|
||||
var isInitializationOfDest: Bool { get }
|
||||
var isTakeOfSource: Bool { get }
|
||||
var isInitializationOfDestination: Bool { get }
|
||||
}
|
||||
|
||||
extension SourceDestAddrInstruction {
|
||||
@@ -330,10 +330,10 @@ extension SourceDestAddrInstruction {
|
||||
}
|
||||
|
||||
final public class CopyAddrInst : Instruction, SourceDestAddrInstruction {
|
||||
public var isTakeOfSrc: Bool {
|
||||
public var isTakeOfSource: Bool {
|
||||
bridged.CopyAddrInst_isTakeOfSrc()
|
||||
}
|
||||
public var isInitializationOfDest: Bool {
|
||||
public var isInitializationOfDestination: Bool {
|
||||
bridged.CopyAddrInst_isInitializationOfDest()
|
||||
}
|
||||
}
|
||||
@@ -342,10 +342,10 @@ final public class ExplicitCopyAddrInst : Instruction, SourceDestAddrInstruction
|
||||
public var source: Value { return sourceOperand.value }
|
||||
public var destination: Value { return destinationOperand.value }
|
||||
|
||||
public var isTakeOfSrc: Bool {
|
||||
public var isTakeOfSource: Bool {
|
||||
bridged.ExplicitCopyAddrInst_isTakeOfSrc()
|
||||
}
|
||||
public var isInitializationOfDest: Bool {
|
||||
public var isInitializationOfDestination: Bool {
|
||||
bridged.ExplicitCopyAddrInst_isInitializationOfDest()
|
||||
}
|
||||
}
|
||||
@@ -542,8 +542,8 @@ final public class UnconditionalCheckedCastAddrInst : Instruction, SourceDestAdd
|
||||
CanonicalType(bridged: bridged.UnconditionalCheckedCastAddr_getTargetFormalType())
|
||||
}
|
||||
|
||||
public var isTakeOfSrc: Bool { true }
|
||||
public var isInitializationOfDest: Bool { true }
|
||||
public var isTakeOfSource: Bool { true }
|
||||
public var isInitializationOfDestination: Bool { true }
|
||||
public override var mayTrap: Bool { true }
|
||||
|
||||
public var isolatedConformances: CastingIsolatedConformances {
|
||||
@@ -723,8 +723,8 @@ class UncheckedRefCastInst : SingleValueInstruction, UnaryInstruction {
|
||||
|
||||
final public
|
||||
class UncheckedRefCastAddrInst : Instruction, SourceDestAddrInstruction {
|
||||
public var isTakeOfSrc: Bool { true }
|
||||
public var isInitializationOfDest: Bool { true }
|
||||
public var isTakeOfSource: Bool { true }
|
||||
public var isInitializationOfDestination: Bool { true }
|
||||
}
|
||||
|
||||
final public class UncheckedAddrCastInst : SingleValueInstruction, UnaryInstruction {
|
||||
@@ -1318,8 +1318,8 @@ final public class MarkUnresolvedNonCopyableValueInst: SingleValueInstruction, U
|
||||
final public class MarkUnresolvedReferenceBindingInst : SingleValueInstruction {}
|
||||
|
||||
final public class MarkUnresolvedMoveAddrInst : Instruction, SourceDestAddrInstruction {
|
||||
public var isTakeOfSrc: Bool { true }
|
||||
public var isInitializationOfDest: Bool { true }
|
||||
public var isTakeOfSource: Bool { true }
|
||||
public var isInitializationOfDestination: Bool { true }
|
||||
}
|
||||
|
||||
final public class CopyableToMoveOnlyWrapperValueInst: SingleValueInstruction, UnaryInstruction {}
|
||||
|
||||
Reference in New Issue
Block a user