Home | History | Annotate | Download | only in SPIRV

Lines Matching refs:block

38 // Because such algorithms visit a block only after traversing some path to it
39 // from the root, they necessarily visit the block's idom first.
56 using spv::Block;
60 // Traverses CFG in a readable order, invoking a pre-set callback on each block.
61 // Use by calling visit() on the root block.
64 explicit ReadableOrderTraverser(std::function<void(Block*)> callback) : callback_(callback) {}
65 // Visits the block if it hasn't been visited already and isn't currently
66 // being delayed. Invokes callback(block), then descends into its
67 // successors. Delays merge-block and continue-block processing until all
69 void visit(Block* block)
71 assert(block);
72 if (visited_.count(block) || delayed_.count(block))
74 callback_(block);
75 visited_.insert(block);
76 Block* mergeBlock = nullptr;
77 Block* continueBlock = nullptr;
78 auto mergeInst = block->getMergeInstruction();
81 mergeBlock = block->getParent().getParent().getInstruction(mergeId)->getBlock();
86 block->getParent().getParent().getInstruction(continueId)->getBlock();
90 const auto successors = block->getSuccessors();
104 std::function<void(Block*)> callback_;
105 // Whether a block has already been visited or is being delayed.
106 std::unordered_set<Block *> visited_, delayed_;
110 void spv::inReadableOrder(Block* root, std::function<void(Block*)> callback)