| 84 | } |
| 85 | |
| 86 | void Module::ForEachInst(const std::function<void(Instruction*)>& f, |
| 87 | bool run_on_debug_line_insts) { |
| 88 | #define DELEGATE(list) list.ForEachInst(f, run_on_debug_line_insts) |
| 89 | DELEGATE(capabilities_); |
| 90 | DELEGATE(extensions_); |
| 91 | DELEGATE(ext_inst_imports_); |
| 92 | if (memory_model_) memory_model_->ForEachInst(f, run_on_debug_line_insts); |
| 93 | if (sampled_image_address_mode_) |
| 94 | sampled_image_address_mode_->ForEachInst(f, run_on_debug_line_insts); |
| 95 | DELEGATE(entry_points_); |
| 96 | DELEGATE(graph_entry_points_); |
| 97 | DELEGATE(execution_modes_); |
| 98 | DELEGATE(debugs1_); |
| 99 | DELEGATE(debugs2_); |
| 100 | DELEGATE(debugs3_); |
| 101 | DELEGATE(ext_inst_debuginfo_); |
| 102 | DELEGATE(annotations_); |
| 103 | DELEGATE(types_values_); |
| 104 | for (auto& i : functions_) { |
| 105 | i->ForEachInst(f, run_on_debug_line_insts, |
| 106 | /* run_on_non_semantic_insts = */ true); |
| 107 | } |
| 108 | for (auto& g : graphs_) { |
| 109 | g->ForEachInst(f, run_on_debug_line_insts, |
| 110 | /* run_on_non_semantic_insts = */ true); |
| 111 | } |
| 112 | #undef DELEGATE |
| 113 | } |
| 114 | |
| 115 | void Module::ForEachInst(const std::function<void(const Instruction*)>& f, |
| 116 | bool run_on_debug_line_insts) const { |