mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
SwiftCompilerSources: move SIL-related Context APIs from Optimizer to the SIL module
This commit is contained in:
@@ -94,6 +94,11 @@ final public class Function : CustomStringConvertible, HasShortDescription, Hash
|
||||
|
||||
public var entryBlock: BasicBlock { blocks.first! }
|
||||
|
||||
public func appendNewBlock(_ context: some MutatingContext) -> BasicBlock {
|
||||
context.notifyBranchesChanged()
|
||||
return context._bridged.appendBlock(bridged).block
|
||||
}
|
||||
|
||||
public var arguments: LazyMapSequence<ArgumentArray, FunctionArgument> {
|
||||
entryBlock.arguments.lazy.map { $0 as! FunctionArgument }
|
||||
}
|
||||
@@ -242,6 +247,15 @@ final public class Function : CustomStringConvertible, HasShortDescription, Hash
|
||||
fatalError()
|
||||
}
|
||||
}
|
||||
public func set(thunkKind: ThunkKind, _ context: some MutatingContext) {
|
||||
context.notifyEffectsChanged()
|
||||
switch thunkKind {
|
||||
case .noThunk: bridged.setThunk(.IsNotThunk)
|
||||
case .thunk: bridged.setThunk(.IsThunk)
|
||||
case .reabstractionThunk: bridged.setThunk(.IsReabstractionThunk)
|
||||
case .signatureOptimizedThunk: bridged.setThunk(.IsSignatureOptimizedThunk)
|
||||
}
|
||||
}
|
||||
|
||||
public var accessorKindName: String? {
|
||||
guard bridged.isAccessor() else {
|
||||
@@ -260,6 +274,10 @@ final public class Function : CustomStringConvertible, HasShortDescription, Hash
|
||||
public var needsStackProtection: Bool {
|
||||
bridged.needsStackProtection()
|
||||
}
|
||||
public func set(needStackProtection: Bool, _ context: some MutatingContext) {
|
||||
context.notifyEffectsChanged()
|
||||
bridged.setNeedStackProtection(needStackProtection)
|
||||
}
|
||||
|
||||
public var isDeinitBarrier: Bool {
|
||||
effects.sideEffects?.global.isDeinitBarrier ?? true
|
||||
@@ -285,6 +303,10 @@ final public class Function : CustomStringConvertible, HasShortDescription, Hash
|
||||
default: fatalError("unknown performance constraint")
|
||||
}
|
||||
}
|
||||
public func set(isPerformanceConstraint: Bool, _ context: some MutatingContext) {
|
||||
context.notifyEffectsChanged()
|
||||
bridged.setIsPerformanceConstraint(isPerformanceConstraint)
|
||||
}
|
||||
|
||||
public enum InlineStrategy {
|
||||
case automatic
|
||||
@@ -460,8 +482,8 @@ extension Function {
|
||||
}
|
||||
}
|
||||
|
||||
// Only to be called by PassContext
|
||||
public func _modifyEffects(_ body: (inout FunctionEffects) -> ()) {
|
||||
public func modifyEffects(_ context: some MutatingContext, _ body: (inout FunctionEffects) -> ()) {
|
||||
context.notifyEffectsChanged()
|
||||
body(&effects)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user