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

Method CollectTargetVars

source/opt/mem_pass.cpp:505–529  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

503}
504
505void MemPass::CollectTargetVars(Function* func) {
506 seen_target_vars_.clear();
507 seen_non_target_vars_.clear();
508 type2undefs_.clear();
509
510 // Collect target (and non-) variable sets. Remove variables with
511 // non-load/store refs from target variable set
512 for (auto& blk : *func) {
513 for (auto& inst : blk) {
514 switch (inst.opcode()) {
515 case spv::Op::OpStore:
516 case spv::Op::OpLoad: {
517 uint32_t varId;
518 (void)GetPtr(&inst, &varId);
519 if (!IsTargetVar(varId)) break;
520 if (HasOnlySupportedRefs(varId)) break;
521 seen_non_target_vars_.insert(varId);
522 seen_target_vars_.erase(varId);
523 } break;
524 default:
525 break;
526 }
527 }
528 }
529}
530
531} // namespace opt
532} // namespace spvtools

Callers 1

Calls 4

clearMethod · 0.45
opcodeMethod · 0.45
insertMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected