| 1919 | } |
| 1920 | |
| 1921 | std::set<uint32_t> ValidationState_t::EntryPointReferences(uint32_t id) const { |
| 1922 | std::set<uint32_t> referenced_entry_points; |
| 1923 | const auto inst = FindDef(id); |
| 1924 | if (!inst) return referenced_entry_points; |
| 1925 | |
| 1926 | std::vector<const Instruction*> stack; |
| 1927 | stack.push_back(inst); |
| 1928 | while (!stack.empty()) { |
| 1929 | const auto current_inst = stack.back(); |
| 1930 | stack.pop_back(); |
| 1931 | |
| 1932 | if (const auto func = current_inst->function()) { |
| 1933 | // Instruction lives in a function, we can stop searching. |
| 1934 | const auto function_entry_points = FunctionEntryPoints(func->id()); |
| 1935 | referenced_entry_points.insert(function_entry_points.begin(), |
| 1936 | function_entry_points.end()); |
| 1937 | } else { |
| 1938 | // Instruction is in the global scope, keep searching its uses. |
| 1939 | for (auto pair : current_inst->uses()) { |
| 1940 | const auto next_inst = pair.first; |
| 1941 | stack.push_back(next_inst); |
| 1942 | } |
| 1943 | } |
| 1944 | } |
| 1945 | |
| 1946 | return referenced_entry_points; |
| 1947 | } |
| 1948 | |
| 1949 | std::string ValidationState_t::Disassemble(const Instruction& inst) const { |
| 1950 | const spv_parsed_instruction_t& c_inst(inst.c_inst()); |
no test coverage detected