| 1876 | } |
| 1877 | |
| 1878 | void ValidationState_t::ComputeRecursiveEntryPoints() { |
| 1879 | for (const Function& func : functions()) { |
| 1880 | std::stack<uint32_t> call_stack; |
| 1881 | std::set<uint32_t> visited; |
| 1882 | |
| 1883 | for (const uint32_t new_call : func.function_call_targets()) { |
| 1884 | call_stack.push(new_call); |
| 1885 | } |
| 1886 | |
| 1887 | while (!call_stack.empty()) { |
| 1888 | const uint32_t called_func_id = call_stack.top(); |
| 1889 | call_stack.pop(); |
| 1890 | |
| 1891 | if (!visited.insert(called_func_id).second) continue; |
| 1892 | |
| 1893 | if (called_func_id == func.id()) { |
| 1894 | for (const uint32_t entry_point : |
| 1895 | function_to_entry_points_[called_func_id]) |
| 1896 | recursive_entry_points_.insert(entry_point); |
| 1897 | break; |
| 1898 | } |
| 1899 | |
| 1900 | const Function* called_func = function(called_func_id); |
| 1901 | if (called_func) { |
| 1902 | // Other checks should error out on this invalid SPIR-V. |
| 1903 | for (const uint32_t new_call : called_func->function_call_targets()) { |
| 1904 | call_stack.push(new_call); |
| 1905 | } |
| 1906 | } |
| 1907 | } |
| 1908 | } |
| 1909 | } |
| 1910 | |
| 1911 | const std::vector<uint32_t>& ValidationState_t::FunctionEntryPoints( |
| 1912 | uint32_t func) const { |
no test coverage detected