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

Method ComputeRecursiveEntryPoints

source/val/validation_state.cpp:1878–1909  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1876}
1877
1878void 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
1911const std::vector<uint32_t>& ValidationState_t::FunctionEntryPoints(
1912 uint32_t func) const {

Callers 1

ValidateEntryPointsFunction · 0.80

Calls 4

function_call_targetsMethod · 0.80
emptyMethod · 0.45
insertMethod · 0.45
idMethod · 0.45

Tested by

no test coverage detected