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

Method ProcessReachableCallTree

source/opt/ir_context.cpp:1013–1041  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1011}
1012
1013bool IRContext::ProcessReachableCallTree(ProcessFunction& pfn) {
1014 std::queue<uint32_t> roots;
1015
1016 // Add all entry points since they can be reached from outside the module.
1017 for (auto& e : module()->entry_points())
1018 roots.push(e.GetSingleWordInOperand(kEntryPointFunctionIdInIdx));
1019
1020 // Add all exported functions since they can be reached from outside the
1021 // module.
1022 for (auto& a : annotations()) {
1023 // TODO: Handle group decorations as well. Currently not generate by any
1024 // front-end, but could be coming.
1025 if (a.opcode() == spv::Op::OpDecorate) {
1026 if (spv::Decoration(a.GetSingleWordOperand(1)) ==
1027 spv::Decoration::LinkageAttributes) {
1028 uint32_t lastOperand = a.NumOperands() - 1;
1029 if (spv::LinkageType(a.GetSingleWordOperand(lastOperand)) ==
1030 spv::LinkageType::Export) {
1031 uint32_t id = a.GetSingleWordOperand(0);
1032 if (GetFunction(id)) {
1033 roots.push(id);
1034 }
1035 }
1036 }
1037 }
1038 }
1039
1040 return ProcessCallTreeFromRoots(pfn, &roots);
1041}
1042
1043bool IRContext::ProcessCallTreeFromRoots(ProcessFunction& pfn,
1044 std::queue<uint32_t>* roots) {

Callers 15

ProcessMethod · 0.80
ProcessImplMethod · 0.80
ProcessImplMethod · 0.80
ProcessCurrentModuleMethod · 0.80
ProcessImplMethod · 0.80
ProcessImplMethod · 0.80
ProcessMethod · 0.80
ProcessMethod · 0.80
FixBlockOrderMethod · 0.80
ProcessMethod · 0.80
ProcessImplMethod · 0.80

Calls 7

DecorationClass · 0.85
GetFunctionFunction · 0.85
entry_pointsMethod · 0.80
GetSingleWordOperandMethod · 0.80
NumOperandsMethod · 0.80
opcodeMethod · 0.45

Tested by 1

TEST_FFunction · 0.64