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

Function InterestingWhileOpcodeExists

test/reduce/reducer_test.cpp:224–252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

222}
223
224bool InterestingWhileOpcodeExists(const std::vector<uint32_t>& binary,
225 spv::Op opcode, uint32_t count, bool dump) {
226 if (dump) {
227 std::stringstream ss;
228 ss << "temp_" << count << ".spv";
229 DumpShader(binary, ss.str().c_str());
230 }
231
232 std::unique_ptr<opt::IRContext> context =
233 BuildModule(kEnv, kMessageConsumer, binary.data(), binary.size());
234 assert(context);
235 bool interesting = false;
236 for (auto& function : *context->module()) {
237 context->cfg()->ForEachBlockInPostOrder(
238 &*function.begin(),
239 [opcode, &interesting](opt::BasicBlock* block) -> void {
240 for (auto& inst : *block) {
241 if (inst.opcode() == spv::Op(opcode)) {
242 interesting = true;
243 break;
244 }
245 }
246 });
247 if (interesting) {
248 break;
249 }
250 }
251 return interesting;
252}
253
254bool InterestingWhileIMulReachable(const std::vector<uint32_t>& binary,
255 uint32_t count) {

Callers 2

Calls 11

c_strMethod · 0.80
DumpShaderFunction · 0.70
BuildModuleFunction · 0.50
strMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
moduleMethod · 0.45
cfgMethod · 0.45
beginMethod · 0.45
opcodeMethod · 0.45

Tested by

no test coverage detected