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

Method AddGuardBlock

source/opt/inline_pass.cpp:294–311  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

292}
293
294std::unique_ptr<BasicBlock> InlinePass::AddGuardBlock(
295 std::vector<std::unique_ptr<BasicBlock>>* new_blocks,
296 std::unordered_map<uint32_t, uint32_t>* callee2caller,
297 std::unique_ptr<BasicBlock> new_blk_ptr, uint32_t entry_blk_label_id) {
298 const auto guard_block_id = context()->TakeNextId();
299 if (guard_block_id == 0) {
300 return nullptr;
301 }
302 AddBranch(guard_block_id, &new_blk_ptr);
303 new_blocks->push_back(std::move(new_blk_ptr));
304 // Start the next block.
305 new_blk_ptr = MakeUnique<BasicBlock>(NewLabel(guard_block_id));
306 // Reset the mapping of the callee's entry block to point to
307 // the guard block. Do this so we can fix up phis later on to
308 // satisfy dominance.
309 (*callee2caller)[entry_blk_label_id] = guard_block_id;
310 return new_blk_ptr;
311}
312
313InstructionList::iterator InlinePass::AddStoresForVariableInitializers(
314 const std::unordered_map<uint32_t, uint32_t>& callee2caller,

Callers

nothing calls this directly

Calls 2

TakeNextIdMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected