10
10
//
11
11
//===----------------------------------------------------------------------===//
12
12
13
- import SIL
14
- import OptimizerBridging
13
+ import SILBridging
15
14
16
15
/// Utility for updating SSA for a set of SIL instructions defined in multiple blocks.
17
- struct SSAUpdater < Context: MutatingContext > {
16
+ public struct SSAUpdater < Context: MutatingContext > {
18
17
let context : Context
19
18
20
- init ( function: Function , type: Type , ownership: Ownership ,
21
- _ context: Context ) {
19
+ public init ( function: Function , type: Type , ownership: Ownership , _ context: Context ) {
22
20
self . context = context
23
- context. _bridged. SSAUpdater_initialize ( function. bridged, type. bridged,
24
- ownership. _bridged)
21
+ context. _bridged. SSAUpdater_initialize ( function. bridged, type. bridged, ownership. _bridged)
25
22
}
26
23
27
- mutating func addAvailableValue( _ value: Value , in block: BasicBlock ) {
24
+ public mutating func addAvailableValue( _ value: Value , in block: BasicBlock ) {
28
25
context. _bridged. SSAUpdater_addAvailableValue ( block. bridged, value. bridged)
29
26
}
30
27
31
28
/// Construct SSA for a value that is live at the *end* of a basic block.
32
- mutating func getValue( atEndOf block: BasicBlock ) -> Value {
29
+ public mutating func getValue( atEndOf block: BasicBlock ) -> Value {
33
30
context. notifyInstructionsChanged ( )
34
31
return context. _bridged. SSAUpdater_getValueAtEndOfBlock ( block. bridged) . value
35
32
}
@@ -46,12 +43,12 @@ struct SSAUpdater<Context: MutatingContext> {
46
43
/// cond_br bb2, bb3
47
44
///
48
45
/// In this case we need to insert a phi argument in bb2, merging %1 and %2.
49
- mutating func getValue( inMiddleOf block: BasicBlock ) -> Value {
46
+ public mutating func getValue( inMiddleOf block: BasicBlock ) -> Value {
50
47
context. notifyInstructionsChanged ( )
51
48
return context. _bridged. SSAUpdater_getValueInMiddleOfBlock ( block. bridged) . value
52
49
}
53
50
54
- var insertedPhis : [ Phi ] {
51
+ public var insertedPhis : [ Phi ] {
55
52
var phis = [ Phi] ( )
56
53
let numPhis = context. _bridged. SSAUpdater_getNumInsertedPhis ( )
57
54
phis. reserveCapacity ( numPhis)
0 commit comments