@@ -1291,8 +1291,9 @@ void PyOperation::checkValid() const {
1291
1291
void PyOperationBase::print (std::optional<int64_t > largeElementsLimit,
1292
1292
bool enableDebugInfo, bool prettyDebugInfo,
1293
1293
bool printGenericOpForm, bool useLocalScope,
1294
- bool assumeVerified, nb::object fileObject,
1295
- bool binary, bool skipRegions) {
1294
+ bool useNameLocAsPrefix, bool assumeVerified,
1295
+ nb::object fileObject, bool binary,
1296
+ bool skipRegions) {
1296
1297
PyOperation &operation = getOperation ();
1297
1298
operation.checkValid ();
1298
1299
if (fileObject.is_none ())
@@ -1314,6 +1315,8 @@ void PyOperationBase::print(std::optional<int64_t> largeElementsLimit,
1314
1315
mlirOpPrintingFlagsAssumeVerified (flags);
1315
1316
if (skipRegions)
1316
1317
mlirOpPrintingFlagsSkipRegions (flags);
1318
+ if (useNameLocAsPrefix)
1319
+ mlirOpPrintingFlagsPrintNameLocAsPrefix (flags);
1317
1320
1318
1321
PyFileAccumulator accum (fileObject, binary);
1319
1322
mlirOperationPrintWithFlags (operation, flags, accum.getCallback (),
@@ -1390,7 +1393,8 @@ nb::object PyOperationBase::getAsm(bool binary,
1390
1393
std::optional<int64_t > largeElementsLimit,
1391
1394
bool enableDebugInfo, bool prettyDebugInfo,
1392
1395
bool printGenericOpForm, bool useLocalScope,
1393
- bool assumeVerified, bool skipRegions) {
1396
+ bool useNameLocAsPrefix, bool assumeVerified,
1397
+ bool skipRegions) {
1394
1398
nb::object fileObject;
1395
1399
if (binary) {
1396
1400
fileObject = nb::module_::import_ (" io" ).attr (" BytesIO" )();
@@ -1402,6 +1406,7 @@ nb::object PyOperationBase::getAsm(bool binary,
1402
1406
/* prettyDebugInfo=*/ prettyDebugInfo,
1403
1407
/* printGenericOpForm=*/ printGenericOpForm,
1404
1408
/* useLocalScope=*/ useLocalScope,
1409
+ /* useNameLocAsPrefix=*/ useNameLocAsPrefix,
1405
1410
/* assumeVerified=*/ assumeVerified,
1406
1411
/* fileObject=*/ fileObject,
1407
1412
/* binary=*/ binary,
@@ -3195,6 +3200,7 @@ void mlir::python::populateIRCore(nb::module_ &m) {
3195
3200
/* prettyDebugInfo=*/ false ,
3196
3201
/* printGenericOpForm=*/ false ,
3197
3202
/* useLocalScope=*/ false ,
3203
+ /* useNameLocAsPrefix=*/ false ,
3198
3204
/* assumeVerified=*/ false ,
3199
3205
/* skipRegions=*/ false );
3200
3206
},
@@ -3206,14 +3212,15 @@ void mlir::python::populateIRCore(nb::module_ &m) {
3206
3212
nb::arg (" binary" ) = false , kOperationPrintStateDocstring )
3207
3213
.def (" print" ,
3208
3214
nb::overload_cast<std::optional<int64_t >, bool , bool , bool , bool ,
3209
- bool , nb::object, bool , bool >(
3215
+ bool , bool , nb::object, bool , bool >(
3210
3216
&PyOperationBase::print),
3211
3217
// Careful: Lots of arguments must match up with print method.
3212
3218
nb::arg (" large_elements_limit" ).none () = nb::none (),
3213
3219
nb::arg (" enable_debug_info" ) = false ,
3214
3220
nb::arg (" pretty_debug_info" ) = false ,
3215
3221
nb::arg (" print_generic_op_form" ) = false ,
3216
3222
nb::arg (" use_local_scope" ) = false ,
3223
+ nb::arg (" use_name_loc_as_prefix" ) = false ,
3217
3224
nb::arg (" assume_verified" ) = false ,
3218
3225
nb::arg (" file" ).none () = nb::none (), nb::arg (" binary" ) = false ,
3219
3226
nb::arg (" skip_regions" ) = false , kOperationPrintDocstring )
@@ -3228,6 +3235,7 @@ void mlir::python::populateIRCore(nb::module_ &m) {
3228
3235
nb::arg (" pretty_debug_info" ) = false ,
3229
3236
nb::arg (" print_generic_op_form" ) = false ,
3230
3237
nb::arg (" use_local_scope" ) = false ,
3238
+ nb::arg (" use_name_loc_as_prefix" ) = false ,
3231
3239
nb::arg (" assume_verified" ) = false , nb::arg (" skip_regions" ) = false ,
3232
3240
kOperationGetAsmDocstring )
3233
3241
.def (" verify" , &PyOperationBase::verify,
0 commit comments