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

Method IdInstructions

source/diff/diff.cpp:197–224  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

195// Mappings from ids to instructions and metadata, for a single module's ids.
196struct IdInstructions {
197 IdInstructions(const opt::Module* module)
198 : inst_map_(module->IdBound(), nullptr),
199 name_map_(module->IdBound()),
200 decoration_map_(module->IdBound()),
201 forward_pointer_map_(module->IdBound()) {
202 // Map ids from all sections to instructions that define them.
203 MapIdsToInstruction(module->ext_inst_imports());
204 MapIdsToInstruction(module->debugs1());
205 MapIdsToInstruction(module->debugs2());
206 MapIdsToInstruction(module->debugs3());
207 MapIdsToInstruction(module->ext_inst_debuginfo());
208 MapIdsToInstruction(module->types_values());
209 for (const opt::Function& function : *module) {
210 function.ForEachInst(
211 [this](const opt::Instruction* inst) {
212 if (inst->HasResultId()) {
213 MapIdToInstruction(inst->result_id(), inst);
214 }
215 },
216 true, true);
217 }
218
219 // Gather decorations applied to ids that could be useful in matching them
220 // between src and dst modules.
221 MapIdsToInfos(module->debugs2());
222 MapIdsToInfos(module->annotations());
223 MapIdsToInfos(module->types_values());
224 }
225
226 void MapIdToInstruction(uint32_t id, const opt::Instruction* inst);
227

Callers

nothing calls this directly

Calls 11

HasResultIdMethod · 0.80
IdBoundMethod · 0.45
ext_inst_importsMethod · 0.45
debugs1Method · 0.45
debugs2Method · 0.45
debugs3Method · 0.45
ext_inst_debuginfoMethod · 0.45
types_valuesMethod · 0.45
ForEachInstMethod · 0.45
result_idMethod · 0.45
annotationsMethod · 0.45

Tested by

no test coverage detected