MCPcopy Create free account
hub / github.com/KhronosGroup/SPIRV-Tools / RegisterBlock

Method RegisterBlock

source/val/function.cpp:118–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

116}
117
118spv_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
142void Function::RegisterBlockEnd(std::vector<uint32_t> next_list) {
143 assert(

Callers 1

CfgPassFunction · 0.45

Calls 4

BasicBlockClass · 0.70
insertMethod · 0.45
eraseMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected