90
90
//===----------------------------------------------------------------------===//
91
91
92
92
import Basic
93
+ import SIL
93
94
import SILBridging
95
+ import OptimizerBridging
94
96
95
97
/// The primary interface to in-IR tests.
96
- public struct FunctionTest {
98
+ struct FunctionTest {
97
99
let name : String
98
100
let invocation : FunctionTestInvocation
99
101
@@ -104,7 +106,7 @@ public struct FunctionTest {
104
106
}
105
107
106
108
/// The type of the closure passed to a FunctionTest.
107
- public typealias FunctionTestInvocation = @convention ( thin) ( Function , TestArguments , TestContext ) -> ( )
109
+ typealias FunctionTestInvocation = @convention ( thin) ( Function , TestArguments , FunctionPassContext ) -> ( )
108
110
109
111
/// Wraps the arguments specified in the specify_test instruction.
110
112
public struct TestArguments {
@@ -129,20 +131,8 @@ extension BridgedTestArguments {
129
131
public var native : TestArguments { TestArguments ( bridged: self ) }
130
132
}
131
133
132
- /// An interface to the various analyses that are available.
133
- public struct TestContext {
134
- public var bridged : BridgedTestContext
135
- fileprivate init ( bridged: BridgedTestContext ) {
136
- self . bridged = bridged
137
- }
138
- }
139
-
140
- extension BridgedTestContext {
141
- public var native : TestContext { TestContext ( bridged: self ) }
142
- }
143
-
144
134
/// Registration of each test in the SIL module.
145
- public func registerSILTests ( ) {
135
+ public func registerOptimizerTests ( ) {
146
136
// Register each test.
147
137
registerFunctionTest ( parseTestSpecificationTest)
148
138
@@ -161,16 +151,18 @@ private func registerFunctionTest(_ test: FunctionTest) {
161
151
/// actual test function.
162
152
///
163
153
/// This function is necessary because tests need to be written in terms of
164
- /// native Swift types (Function, TestArguments, TestContext) rather than their
165
- /// bridged variants, but such a function isn't representable in C++. This
166
- /// thunk unwraps the bridged types and invokes the real function.
154
+ /// native Swift types (Function, TestArguments, BridgedPassContext)
155
+ /// rather than their bridged variants, but such a function isn't representable
156
+ /// in C++. This thunk unwraps the bridged types and invokes the real
157
+ /// function.
167
158
private func functionTestThunk(
168
159
_ erasedInvocation: UnsafeMutableRawPointer ,
169
160
_ function: BridgedFunction ,
170
161
_ arguments: BridgedTestArguments ,
171
- _ context : BridgedTestContext ) {
162
+ _ passInvocation : BridgedSwiftPassInvocation ) {
172
163
let invocation = uneraseInvocation ( erasedInvocation)
173
- invocation ( function. function, arguments. native, context. native)
164
+ let context = FunctionPassContext ( _bridged: BridgedPassContext ( invocation: passInvocation. invocation) )
165
+ invocation ( function. function, arguments. native, context)
174
166
}
175
167
176
168
/// Bitcast a thin test closure to void *.
0 commit comments