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

Method AddBlocksToFunction

source/opt/loop_unroller.cpp:889–902  ·  view source on GitHub ↗

Whenever the utility copies a block it stores it in a temporary buffer, this function adds the buffer into the Function. The blocks will be inserted after the block |insert_point|.

Source from the content-addressed store, hash-verified

887// function adds the buffer into the Function. The blocks will be inserted
888// after the block |insert_point|.
889void LoopUnrollerUtilsImpl::AddBlocksToFunction(
890 const BasicBlock* insert_point) {
891 for (auto basic_block_iterator = function_.begin();
892 basic_block_iterator != function_.end(); ++basic_block_iterator) {
893 if (basic_block_iterator->id() == insert_point->id()) {
894 basic_block_iterator.InsertBefore(&blocks_to_add_);
895 return;
896 }
897 }
898
899 assert(
900 false &&
901 "Could not add basic blocks to function as insert point was not found.");
902}
903
904// Assign all result_ids in |basic_block| instructions to new IDs and preserve
905// the mapping of new ids to old ones.

Callers

nothing calls this directly

Calls 4

beginMethod · 0.45
endMethod · 0.45
idMethod · 0.45
InsertBeforeMethod · 0.45

Tested by

no test coverage detected