Helper function to parse a region during deserialization.
| 1261 | |
| 1262 | /// Helper function to parse a region during deserialization. |
| 1263 | static LogicalResult |
| 1264 | parseRegion(EncodingReader &reader, OpBuilder &builder, Location loc, |
| 1265 | std::vector<Value> &parentValueIndexList, |
| 1266 | ArrayRef<ArrayRef<uint8_t>> constants, LazyTypeTable &types, |
| 1267 | DenseElementsAttrCache &constCache, |
| 1268 | DebugInfoReader::Iterator &diIterator, MLIRContext &context, |
| 1269 | Region ®ionToPopulate, |
| 1270 | const BytecodeVersion &bytecodeVersion) { |
| 1271 | // Read number of blocks in the region. |
| 1272 | uint64_t numBlocks; |
| 1273 | if (failed(reader.readVarInt(numBlocks))) |
| 1274 | return reader.emitError() << "failed to read region block count"; |
| 1275 | |
| 1276 | // Parse each block in the region. |
| 1277 | for (uint64_t i = 0; i < numBlocks; ++i) { |
| 1278 | Block ¤tBlock = regionToPopulate.emplaceBlock(); |
| 1279 | // The value context for this block's arguments and operations starts |
| 1280 | // with values defined in the parent scope. |
| 1281 | if (failed(parseBlock(reader, builder, loc, currentBlock, |
| 1282 | parentValueIndexList, constants, types, constCache, |
| 1283 | diIterator, context, bytecodeVersion))) |
| 1284 | return reader.emitError() |
| 1285 | << "failed to parse block " << i << " in region."; |
| 1286 | } |
| 1287 | |
| 1288 | return success(); |
| 1289 | } |
| 1290 | |
| 1291 | // ===----------------------------------------------------------------------===// |
| 1292 | // Helper Functions for Attribute Deserialization |
no test coverage detected