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

Method FindFuncsCalledFromContinue

source/opt/struct_cfg_analysis.cpp:217–246  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

215}
216
217std::unordered_set<uint32_t>
218StructuredCFGAnalysis::FindFuncsCalledFromContinue() {
219 std::unordered_set<uint32_t> called_from_continue;
220 std::queue<uint32_t> funcs_to_process;
221
222 // First collect the functions that are called directly from a continue
223 // construct.
224 for (Function& func : *context_->module()) {
225 for (auto& bb : func) {
226 if (IsInContainingLoopsContinueConstruct(bb.id())) {
227 for (const Instruction& inst : bb) {
228 if (inst.opcode() == spv::Op::OpFunctionCall) {
229 funcs_to_process.push(inst.GetSingleWordInOperand(0));
230 }
231 }
232 }
233 }
234 }
235
236 // Now collect all of the functions that are indirectly called as well.
237 while (!funcs_to_process.empty()) {
238 uint32_t func_id = funcs_to_process.front();
239 funcs_to_process.pop();
240 Function* func = context_->GetFunction(func_id);
241 if (called_from_continue.insert(func_id).second) {
242 context_->AddCalls(func, &funcs_to_process);
243 }
244 }
245 return called_from_continue;
246}
247
248} // namespace opt
249} // namespace spvtools

Callers 3

InitializeInlineMethod · 0.80
ProcessMethod · 0.80
TEST_FFunction · 0.80

Calls 9

frontMethod · 0.80
AddCallsMethod · 0.80
moduleMethod · 0.45
idMethod · 0.45
opcodeMethod · 0.45
emptyMethod · 0.45
GetFunctionMethod · 0.45
insertMethod · 0.45

Tested by 1

TEST_FFunction · 0.64