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

Function DisassembleModule

test/opt/def_use_test.cpp:592–604  ·  view source on GitHub ↗

Disassembles the given |module| and returns the disassembly.

Source from the content-addressed store, hash-verified

590
591// Disassembles the given |module| and returns the disassembly.
592std::string DisassembleModule(Module* module) {
593 SpirvTools tools(SPV_ENV_UNIVERSAL_1_1);
594
595 std::vector<uint32_t> binary;
596 module->ToBinary(&binary, /* skip_nop = */ false);
597
598 std::string text;
599 // We'll need to check the underlying id numbers.
600 // So turn off friendly names for ids.
601 tools.Disassemble(binary, &text, SPV_BINARY_TO_TEXT_OPTION_NO_HEADER);
602 while (!text.empty() && text.back() == '\n') text.pop_back();
603 return text;
604}
605
606TEST_P(ReplaceUseTest, Case) {
607 const auto& tc = GetParam();

Callers 2

TEST_PFunction · 0.85
TESTFunction · 0.85

Calls 5

backMethod · 0.80
pop_backMethod · 0.80
ToBinaryMethod · 0.45
DisassembleMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected