| 65 | } |
| 66 | |
| 67 | spv_result_t Function::RegisterLoopMerge(uint32_t merge_id, |
| 68 | uint32_t continue_id) { |
| 69 | RegisterBlock(merge_id, false); |
| 70 | RegisterBlock(continue_id, false); |
| 71 | BasicBlock& merge_block = blocks_.at(merge_id); |
| 72 | BasicBlock& continue_target_block = blocks_.at(continue_id); |
| 73 | assert(current_block_ && |
| 74 | "RegisterLoopMerge must be called when called within a block"); |
| 75 | current_block_->RegisterStructuralSuccessor(&merge_block); |
| 76 | current_block_->RegisterStructuralSuccessor(&continue_target_block); |
| 77 | |
| 78 | current_block_->set_type(kBlockTypeLoop); |
| 79 | merge_block.set_type(kBlockTypeMerge); |
| 80 | continue_target_block.set_type(kBlockTypeContinue); |
| 81 | Construct& loop_construct = |
| 82 | AddConstruct({ConstructType::kLoop, current_block_, &merge_block}); |
| 83 | Construct& continue_construct = |
| 84 | AddConstruct({ConstructType::kContinue, &continue_target_block}); |
| 85 | |
| 86 | continue_construct.set_corresponding_constructs({&loop_construct}); |
| 87 | loop_construct.set_corresponding_constructs({&continue_construct}); |
| 88 | merge_block_header_[&merge_block] = current_block_; |
| 89 | if (continue_target_headers_.find(&continue_target_block) == |
| 90 | continue_target_headers_.end()) { |
| 91 | continue_target_headers_[&continue_target_block] = {current_block_}; |
| 92 | } else { |
| 93 | continue_target_headers_[&continue_target_block].push_back(current_block_); |
| 94 | } |
| 95 | |
| 96 | return SPV_SUCCESS; |
| 97 | } |
| 98 | |
| 99 | spv_result_t Function::RegisterSelectionMerge(uint32_t merge_id) { |
| 100 | RegisterBlock(merge_id, false); |
no test coverage detected