@@ -1291,8 +1291,9 @@ void PyOperation::checkValid() const {
12911291void PyOperationBase::print (std::optional<int64_t > largeElementsLimit,
12921292 bool enableDebugInfo, bool prettyDebugInfo,
12931293 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) {
12961297 PyOperation &operation = getOperation ();
12971298 operation.checkValid ();
12981299 if (fileObject.is_none ())
@@ -1314,6 +1315,8 @@ void PyOperationBase::print(std::optional<int64_t> largeElementsLimit,
13141315 mlirOpPrintingFlagsAssumeVerified (flags);
13151316 if (skipRegions)
13161317 mlirOpPrintingFlagsSkipRegions (flags);
1318+ if (useNameLocAsPrefix)
1319+ mlirOpPrintingFlagsPrintNameLocAsPrefix (flags);
13171320
13181321 PyFileAccumulator accum (fileObject, binary);
13191322 mlirOperationPrintWithFlags (operation, flags, accum.getCallback (),
@@ -1390,7 +1393,8 @@ nb::object PyOperationBase::getAsm(bool binary,
13901393 std::optional<int64_t > largeElementsLimit,
13911394 bool enableDebugInfo, bool prettyDebugInfo,
13921395 bool printGenericOpForm, bool useLocalScope,
1393- bool assumeVerified, bool skipRegions) {
1396+ bool useNameLocAsPrefix, bool assumeVerified,
1397+ bool skipRegions) {
13941398 nb::object fileObject;
13951399 if (binary) {
13961400 fileObject = nb::module_::import_ (" io" ).attr (" BytesIO" )();
@@ -1402,6 +1406,7 @@ nb::object PyOperationBase::getAsm(bool binary,
14021406 /* prettyDebugInfo=*/ prettyDebugInfo,
14031407 /* printGenericOpForm=*/ printGenericOpForm,
14041408 /* useLocalScope=*/ useLocalScope,
1409+ /* useNameLocAsPrefix=*/ useNameLocAsPrefix,
14051410 /* assumeVerified=*/ assumeVerified,
14061411 /* fileObject=*/ fileObject,
14071412 /* binary=*/ binary,
@@ -3195,6 +3200,7 @@ void mlir::python::populateIRCore(nb::module_ &m) {
31953200 /* prettyDebugInfo=*/ false ,
31963201 /* printGenericOpForm=*/ false ,
31973202 /* useLocalScope=*/ false ,
3203+ /* useNameLocAsPrefix=*/ false ,
31983204 /* assumeVerified=*/ false ,
31993205 /* skipRegions=*/ false );
32003206 },
@@ -3206,14 +3212,15 @@ void mlir::python::populateIRCore(nb::module_ &m) {
32063212 nb::arg (" binary" ) = false , kOperationPrintStateDocstring )
32073213 .def (" print" ,
32083214 nb::overload_cast<std::optional<int64_t >, bool , bool , bool , bool ,
3209- bool , nb::object, bool , bool >(
3215+ bool , bool , nb::object, bool , bool >(
32103216 &PyOperationBase::print),
32113217 // Careful: Lots of arguments must match up with print method.
32123218 nb::arg (" large_elements_limit" ).none () = nb::none (),
32133219 nb::arg (" enable_debug_info" ) = false ,
32143220 nb::arg (" pretty_debug_info" ) = false ,
32153221 nb::arg (" print_generic_op_form" ) = false ,
32163222 nb::arg (" use_local_scope" ) = false ,
3223+ nb::arg (" use_name_loc_as_prefix" ) = false ,
32173224 nb::arg (" assume_verified" ) = false ,
32183225 nb::arg (" file" ).none () = nb::none (), nb::arg (" binary" ) = false ,
32193226 nb::arg (" skip_regions" ) = false , kOperationPrintDocstring )
@@ -3228,6 +3235,7 @@ void mlir::python::populateIRCore(nb::module_ &m) {
32283235 nb::arg (" pretty_debug_info" ) = false ,
32293236 nb::arg (" print_generic_op_form" ) = false ,
32303237 nb::arg (" use_local_scope" ) = false ,
3238+ nb::arg (" use_name_loc_as_prefix" ) = false ,
32313239 nb::arg (" assume_verified" ) = false , nb::arg (" skip_regions" ) = false ,
32323240 kOperationGetAsmDocstring )
32333241 .def (" verify" , &PyOperationBase::verify,
0 commit comments