File tree Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -51,9 +51,13 @@ DEFINE_C_API_STRUCT(MlirOpPassManager, void);
51
51
// PassManager/OpPassManager APIs.
52
52
//===----------------------------------------------------------------------===//
53
53
54
- /// Create a new top-level PassManager.
54
+ /// Create a new top-level PassManager with the default anchor .
55
55
MLIR_CAPI_EXPORTED MlirPassManager mlirPassManagerCreate (MlirContext ctx );
56
56
57
+ /// Create a new top-level PassManager anchored on `anchorOp`.
58
+ MLIR_CAPI_EXPORTED MlirPassManager
59
+ mlirPassManagerCreateOnOperation (MlirContext ctx , MlirStringRef anchorOp );
60
+
57
61
/// Destroy the provided PassManager.
58
62
MLIR_CAPI_EXPORTED void mlirPassManagerDestroy (MlirPassManager passManager );
59
63
Original file line number Diff line number Diff line change @@ -24,6 +24,11 @@ MlirPassManager mlirPassManagerCreate(MlirContext ctx) {
24
24
return wrap (new PassManager (unwrap (ctx)));
25
25
}
26
26
27
+ MlirPassManager mlirPassManagerCreateOnOperation (MlirContext ctx,
28
+ MlirStringRef anchorOp) {
29
+ return wrap (new PassManager (unwrap (ctx), unwrap (anchorOp)));
30
+ }
31
+
27
32
void mlirPassManagerDestroy (MlirPassManager passManager) {
28
33
delete unwrap (passManager);
29
34
}
Original file line number Diff line number Diff line change @@ -140,7 +140,8 @@ static void dontPrint(MlirStringRef str, void *userData) {
140
140
141
141
void testPrintPassPipeline () {
142
142
MlirContext ctx = mlirContextCreate ();
143
- MlirPassManager pm = mlirPassManagerCreate (ctx );
143
+ MlirPassManager pm = mlirPassManagerCreateOnOperation (
144
+ ctx , mlirStringRefCreateFromCString ("any" ));
144
145
// Populate the pass-manager
145
146
MlirOpPassManager nestedModulePm = mlirPassManagerGetNestedUnder (
146
147
pm , mlirStringRefCreateFromCString ("builtin.module" ));
@@ -150,7 +151,7 @@ void testPrintPassPipeline() {
150
151
mlirOpPassManagerAddOwnedPass (nestedFuncPm , printOpStatPass );
151
152
152
153
// Print the top level pass manager
153
- // CHECK: Top-level: builtin.module (
154
+ // CHECK: Top-level: any (
154
155
// CHECK-SAME: builtin.module(func.func(print-op-stats{json=false}))
155
156
// CHECK-SAME: )
156
157
fprintf (stderr , "Top-level: " );
You can’t perform that action at this time.
0 commit comments