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

Method ProcessFunction

source/opt/combine_access_chains.cpp:38–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36}
37
38Pass::Status CombineAccessChains::ProcessFunction(Function& function) {
39 if (function.IsDeclaration()) {
40 return Status::SuccessWithoutChange;
41 }
42
43 bool modified = false;
44 bool failure = false;
45
46 cfg()->ForEachBlockInReversePostOrder(
47 function.entry().get(), [&modified, &failure, this](BasicBlock* block) {
48 if (failure) return;
49 block->ForEachInst([&modified, &failure, this](Instruction* inst) {
50 if (failure) return;
51 switch (inst->opcode()) {
52 case spv::Op::OpAccessChain:
53 case spv::Op::OpInBoundsAccessChain:
54 case spv::Op::OpPtrAccessChain:
55 case spv::Op::OpInBoundsPtrAccessChain: {
56 auto status = CombineAccessChain(inst);
57 if (status == Status::Failure) {
58 failure = true;
59 } else if (status == Status::SuccessWithChange) {
60 modified = true;
61 }
62 break;
63 }
64 default:
65 break;
66 }
67 });
68 });
69
70 if (failure) return Status::Failure;
71 return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange;
72}
73
74uint32_t CombineAccessChains::GetConstantValue(
75 const analysis::Constant* constant_inst) {

Callers

nothing calls this directly

Calls 5

IsDeclarationMethod · 0.80
getMethod · 0.80
ForEachInstMethod · 0.45
opcodeMethod · 0.45

Tested by

no test coverage detected