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

Function load_module

tools/diff/diff.cpp:82–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80}
81
82std::unique_ptr<spvtools::opt::IRContext> load_module(const char* path) {
83 if (is_assembly(path)) {
84 std::vector<char> contents;
85 if (!ReadTextFile(path, &contents)) return {};
86
87 return spvtools::BuildModule(
88 kDefaultEnvironment, spvtools::utils::CLIMessageConsumer,
89 std::string(contents.begin(), contents.end()),
90 static_cast<spv_text_to_binary_options_t>(
91 spvtools::SpirvTools::kDefaultAssembleOption) |
92 SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS);
93 }
94
95 std::vector<uint32_t> contents;
96 if (!ReadBinaryFile(path, &contents)) return {};
97
98 return spvtools::BuildModule(kDefaultEnvironment,
99 spvtools::utils::CLIMessageConsumer,
100 contents.data(), contents.size());
101}
102
103} // namespace
104

Callers 1

mainFunction · 0.85

Calls 8

is_assemblyFunction · 0.85
ReadTextFileFunction · 0.85
ReadBinaryFileFunction · 0.85
BuildModuleFunction · 0.50
beginMethod · 0.45
endMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected