| 116 | } |
| 117 | |
| 118 | spv_result_t Function::RegisterBlock(uint32_t block_id, bool is_definition) { |
| 119 | assert( |
| 120 | declaration_type_ == FunctionDecl::kFunctionDeclDefinition && |
| 121 | "RegisterBlocks can only be called after declaration_type_ is defined"); |
| 122 | |
| 123 | std::unordered_map<uint32_t, BasicBlock>::iterator inserted_block; |
| 124 | bool success = false; |
| 125 | tie(inserted_block, success) = |
| 126 | blocks_.insert({block_id, BasicBlock(block_id)}); |
| 127 | if (is_definition) { // new block definition |
| 128 | assert(current_block_ == nullptr && |
| 129 | "Register Block can only be called when parsing a binary outside of " |
| 130 | "a BasicBlock"); |
| 131 | |
| 132 | undefined_blocks_.erase(block_id); |
| 133 | current_block_ = &inserted_block->second; |
| 134 | ordered_blocks_.push_back(current_block_); |
| 135 | } else if (success) { // Block doesn't exist but this is not a definition |
| 136 | undefined_blocks_.insert(block_id); |
| 137 | } |
| 138 | |
| 139 | return SPV_SUCCESS; |
| 140 | } |
| 141 | |
| 142 | void Function::RegisterBlockEnd(std::vector<uint32_t> next_list) { |
| 143 | assert( |
no test coverage detected