| 195 | // Mappings from ids to instructions and metadata, for a single module's ids. |
| 196 | struct 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 |
nothing calls this directly
no test coverage detected