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

Method WhileEachInst

source/opt/function.cpp:82–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80}
81
82bool Function::WhileEachInst(const std::function<bool(Instruction*)>& f,
83 bool run_on_debug_line_insts,
84 bool run_on_non_semantic_insts) {
85 if (def_inst_) {
86 if (!def_inst_->WhileEachInst(f, run_on_debug_line_insts)) {
87 return false;
88 }
89 }
90
91 for (auto& param : params_) {
92 if (!param->WhileEachInst(f, run_on_debug_line_insts)) {
93 return false;
94 }
95 }
96
97 if (!debug_insts_in_header_.empty()) {
98 Instruction* di = &debug_insts_in_header_.front();
99 while (di != nullptr) {
100 Instruction* next_instruction = di->NextNode();
101 if (!di->WhileEachInst(f, run_on_debug_line_insts)) return false;
102 di = next_instruction;
103 }
104 }
105
106 for (auto& bb : blocks_) {
107 if (!bb->WhileEachInst(f, run_on_debug_line_insts)) {
108 return false;
109 }
110 }
111
112 if (end_inst_) {
113 if (!end_inst_->WhileEachInst(f, run_on_debug_line_insts)) {
114 return false;
115 }
116 }
117
118 if (run_on_non_semantic_insts) {
119 for (auto& non_semantic : non_semantic_) {
120 if (!non_semantic->WhileEachInst(f, run_on_debug_line_insts)) {
121 return false;
122 }
123 }
124 }
125
126 return true;
127}
128
129bool Function::WhileEachInst(const std::function<bool(const Instruction*)>& f,
130 bool run_on_debug_line_insts,

Callers 15

GetFunctionHeaderMethod · 0.45
IsConsistentMethod · 0.45
ProcessMethod · 0.45
HasCallMethod · 0.45
AnalyseAndHoistFromBBMethod · 0.45
CanonicalizeFunctionsMethod · 0.45
SimulateMethod · 0.45
GenInlineCodeMethod · 0.45

Calls 4

frontMethod · 0.80
NextNodeMethod · 0.80
getMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected