Generates C++ code within the 'write ' function to serialize the regions of the given operation, if it has any.
| 522 | /// Generates C++ code within the 'write<OpName>' function to serialize the |
| 523 | /// regions of the given operation, if it has any. |
| 524 | static void generateRegionSerialization(const Operator &op, raw_ostream &os) { |
| 525 | // Only emit region code if this op can have regions |
| 526 | if (!op.getNumRegions()) |
| 527 | return; |
| 528 | |
| 529 | os << " // Serialize Regions\n" |
| 530 | << " writer.writeVarInt(op->getNumRegions());\n" |
| 531 | << " for (Region ®ion : op->getRegions()) {\n" |
| 532 | << " if (failed(writeRegion(region, writer)))\n" |
| 533 | << " return failure();\n" |
| 534 | << " }\n\n"; |
| 535 | } |
| 536 | |
| 537 | /// Generate result serialization without version checking. |
| 538 | static void generateSimpleResultSerialization(const Operator &op, |