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

Method Process

source/opt/desc_sroa.cpp:32–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30} // namespace
31
32Pass::Status DescriptorScalarReplacement::Process() {
33 bool modified = false;
34 std::vector<Instruction*> vars_to_kill;
35
36 for (Instruction& var : context()->types_values()) {
37 bool is_candidate =
38 flatten_arrays_ && descsroautil::IsDescriptorArray(context(), &var);
39 is_candidate |= flatten_composites_ &&
40 descsroautil::IsDescriptorStruct(context(), &var);
41 if (is_candidate) {
42 modified = true;
43 if (!ReplaceCandidate(&var)) {
44 return Status::Failure;
45 }
46 vars_to_kill.push_back(&var);
47 }
48 }
49
50 for (Instruction* var : vars_to_kill) {
51 context()->KillInst(var);
52 }
53
54 return (modified ? Status::SuccessWithChange : Status::SuccessWithoutChange);
55}
56
57bool DescriptorScalarReplacement::ReplaceCandidate(Instruction* var) {
58 std::vector<Instruction*> access_chain_work_list;

Callers

nothing calls this directly

Calls 5

IsDescriptorArrayFunction · 0.85
IsDescriptorStructFunction · 0.85
types_valuesMethod · 0.45
push_backMethod · 0.45
KillInstMethod · 0.45

Tested by

no test coverage detected