@@ -64,80 +64,78 @@ public struct Builder {
64
64
operandType: Type , resultType: Type , arguments: [ Value ] ) -> BuiltinInst {
65
65
return arguments. withBridgedValues { valuesRef in
66
66
return name. _withStringRef { nameStr in
67
- let bi = SILBuilder_createBuiltinBinaryFunction (
68
- bridged , nameStr, operandType. bridged, resultType. bridged, valuesRef)
67
+ let bi = bridged . createBuiltinBinaryFunction (
68
+ nameStr, operandType. bridged, resultType. bridged, valuesRef)
69
69
return notifyNew ( bi. getAs ( BuiltinInst . self) )
70
70
}
71
71
}
72
72
}
73
73
74
74
public func createCondFail( condition: Value , message: String ) -> CondFailInst {
75
75
return message. _withStringRef { messageStr in
76
- let cf = SILBuilder_createCondFail ( bridged, condition. bridged, messageStr)
76
+ let cf = bridged. createCondFail ( condition. bridged, messageStr)
77
77
return notifyNew ( cf. getAs ( CondFailInst . self) )
78
78
}
79
79
}
80
80
81
81
public func createIntegerLiteral( _ value: Int , type: Type ) -> IntegerLiteralInst {
82
- let literal = SILBuilder_createIntegerLiteral ( bridged, type. bridged, value)
82
+ let literal = bridged. createIntegerLiteral ( type. bridged, value)
83
83
return notifyNew ( literal. getAs ( IntegerLiteralInst . self) )
84
84
}
85
85
86
86
public func createAllocStack( _ type: Type , hasDynamicLifetime: Bool = false ,
87
- isLexical: Bool = false ,
88
- usesMoveableValueDebugInfo: Bool = false ) -> AllocStackInst {
89
- let dr = SILBuilder_createAllocStack ( bridged, type. bridged, hasDynamicLifetime ? 1 : 0 ,
90
- isLexical ? 1 : 0 , usesMoveableValueDebugInfo ? 1 : 0 )
87
+ isLexical: Bool = false , usesMoveableValueDebugInfo: Bool = false ) -> AllocStackInst {
88
+ let dr = bridged. createAllocStack ( type. bridged, hasDynamicLifetime, isLexical, usesMoveableValueDebugInfo)
91
89
return notifyNew ( dr. getAs ( AllocStackInst . self) )
92
90
}
93
91
94
92
@discardableResult
95
93
public func createDeallocStack( _ operand: Value ) -> DeallocStackInst {
96
- let dr = SILBuilder_createDeallocStack ( bridged, operand. bridged)
94
+ let dr = bridged. createDeallocStack ( operand. bridged)
97
95
return notifyNew ( dr. getAs ( DeallocStackInst . self) )
98
96
}
99
97
100
98
@discardableResult
101
99
public func createDeallocStackRef( _ operand: Value ) -> DeallocStackRefInst {
102
- let dr = SILBuilder_createDeallocStackRef ( bridged, operand. bridged)
100
+ let dr = bridged. createDeallocStackRef ( operand. bridged)
103
101
return notifyNew ( dr. getAs ( DeallocStackRefInst . self) )
104
102
}
105
103
106
104
public func createUncheckedRefCast( object: Value , type: Type ) -> UncheckedRefCastInst {
107
- let object = SILBuilder_createUncheckedRefCast ( bridged, object. bridged, type. bridged)
105
+ let object = bridged. createUncheckedRefCast ( object. bridged, type. bridged)
108
106
return notifyNew ( object. getAs ( UncheckedRefCastInst . self) )
109
107
}
110
108
111
109
@discardableResult
112
110
public func createSetDeallocating( operand: Value , isAtomic: Bool ) -> SetDeallocatingInst {
113
- let setDeallocating = SILBuilder_createSetDeallocating ( bridged, operand. bridged, isAtomic)
111
+ let setDeallocating = bridged. createSetDeallocating ( operand. bridged, isAtomic)
114
112
return notifyNew ( setDeallocating. getAs ( SetDeallocatingInst . self) )
115
113
}
116
114
117
115
public func createFunctionRef( _ function: Function ) -> FunctionRefInst {
118
- let functionRef = SILBuilder_createFunctionRef ( bridged, function. bridged)
116
+ let functionRef = bridged. createFunctionRef ( function. bridged)
119
117
return notifyNew ( functionRef. getAs ( FunctionRefInst . self) )
120
118
}
121
119
122
120
public func createCopyValue( operand: Value ) -> CopyValueInst {
123
- return notifyNew ( SILBuilder_createCopyValue ( bridged, operand. bridged) . getAs ( CopyValueInst . self) )
121
+ return notifyNew ( bridged. createCopyValue ( operand. bridged) . getAs ( CopyValueInst . self) )
124
122
}
125
123
126
124
@discardableResult
127
125
public func createCopyAddr( from fromAddr: Value , to toAddr: Value ,
128
126
takeSource: Bool = false , initializeDest: Bool = false ) -> CopyAddrInst {
129
- return notifyNew ( SILBuilder_createCopyAddr ( bridged, fromAddr. bridged, toAddr. bridged,
130
- takeSource ? 1 : 0 , initializeDest ? 1 : 0 ) . getAs ( CopyAddrInst . self) )
127
+ return notifyNew ( bridged. createCopyAddr ( fromAddr. bridged, toAddr. bridged,
128
+ takeSource , initializeDest ) . getAs ( CopyAddrInst . self) )
131
129
}
132
130
133
131
@discardableResult
134
132
public func createDestroyValue( operand: Value ) -> DestroyValueInst {
135
- return notifyNew ( SILBuilder_createDestroyValue ( bridged, operand. bridged) . getAs ( DestroyValueInst . self) )
133
+ return notifyNew ( bridged. createDestroyValue ( operand. bridged) . getAs ( DestroyValueInst . self) )
136
134
}
137
135
138
136
@discardableResult
139
137
public func createDebugStep( ) -> DebugStepInst {
140
- return notifyNew ( SILBuilder_createDebugStep ( bridged) . getAs ( DebugStepInst . self) )
138
+ return notifyNew ( bridged. createDebugStep ( ) . getAs ( DebugStepInst . self) )
141
139
}
142
140
143
141
@discardableResult
@@ -150,40 +148,40 @@ public struct Builder {
150
148
specializationInfo: ApplyInst . SpecializationInfo = nil
151
149
) -> ApplyInst {
152
150
let apply = arguments. withBridgedValues { valuesRef in
153
- SILBuilder_createApply ( bridged, function. bridged, substitutionMap. bridged, valuesRef,
154
- isNonThrowing, isNonAsync, specializationInfo)
151
+ bridged. createApply ( function. bridged, substitutionMap. bridged, valuesRef,
152
+ isNonThrowing, isNonAsync, specializationInfo)
155
153
}
156
154
return notifyNew ( apply. getAs ( ApplyInst . self) )
157
155
}
158
156
159
157
public func createUncheckedEnumData( enum enumVal: Value ,
160
158
caseIndex: Int ,
161
159
resultType: Type ) -> UncheckedEnumDataInst {
162
- let ued = SILBuilder_createUncheckedEnumData ( bridged, enumVal. bridged, caseIndex, resultType. bridged)
160
+ let ued = bridged. createUncheckedEnumData ( enumVal. bridged, caseIndex, resultType. bridged)
163
161
return notifyNew ( ued. getAs ( UncheckedEnumDataInst . self) )
164
162
}
165
163
@discardableResult
166
164
public func createSwitchEnum( enum enumVal: Value ,
167
165
cases: [ ( Int , BasicBlock ) ] ,
168
166
defaultBlock: BasicBlock ? = nil ) -> SwitchEnumInst {
169
167
let se = cases. withUnsafeBufferPointer { caseBuffer in
170
- SILBuilder_createSwitchEnumInst (
171
- bridged , enumVal . bridged , defaultBlock . bridged , caseBuffer. baseAddress, caseBuffer. count)
168
+ bridged . createSwitchEnumInst ( enumVal . bridged , defaultBlock . bridged ,
169
+ caseBuffer. baseAddress, caseBuffer. count)
172
170
}
173
171
return notifyNew ( se. getAs ( SwitchEnumInst . self) )
174
172
}
175
173
176
174
@discardableResult
177
175
public func createBranch( to destBlock: BasicBlock , arguments: [ Value ] = [ ] ) -> BranchInst {
178
176
return arguments. withBridgedValues { valuesRef in
179
- let bi = SILBuilder_createBranch ( bridged, destBlock. bridged, valuesRef)
177
+ let bi = bridged. createBranch ( destBlock. bridged, valuesRef)
180
178
return notifyNew ( bi. getAs ( BranchInst . self) )
181
179
}
182
180
}
183
181
184
182
@discardableResult
185
183
public func createUnreachable( ) -> UnreachableInst {
186
- let ui = SILBuilder_createUnreachable ( bridged)
184
+ let ui = bridged. createUnreachable ( )
187
185
return notifyNew ( ui. getAs ( UnreachableInst . self) )
188
186
}
189
187
}
0 commit comments