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

Method ReorderBasicBlocks

source/opt/function.h:298–310  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

296
297template <class It>
298void Function::ReorderBasicBlocks(It begin, It end) {
299 // Asserts to make sure every node in the function is in new_order.
300 assert(ContainsAllBlocksInTheFunction(begin, end));
301
302 // We have a pointer to all the elements in order, so we can release all
303 // pointers in |block_|, and then create the new unique pointers from |{begin,
304 // end}|.
305 std::for_each(blocks_.begin(), blocks_.end(),
306 [](std::unique_ptr<BasicBlock>& bb) { bb.release(); });
307 std::transform(begin, end, blocks_.begin(), [](BasicBlock* bb) {
308 return std::unique_ptr<BasicBlock>(bb);
309 });
310}
311
312template <class It>
313bool Function::ContainsAllBlocksInTheFunction(It begin, It end) {

Callers

nothing calls this directly

Calls 2

beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected