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

Method Analyze

source/opt/loop_utils.cpp:717–735  ·  view source on GitHub ↗

Class to gather some metrics about a region of interest.

Source from the content-addressed store, hash-verified

715
716// Class to gather some metrics about a region of interest.
717void CodeMetrics::Analyze(const Loop& loop) {
718 CFG& cfg = *loop.GetContext()->cfg();
719
720 roi_size_ = 0;
721 block_sizes_.clear();
722
723 for (uint32_t id : loop.GetBlocks()) {
724 const BasicBlock* bb = cfg.block(id);
725 size_t bb_size = 0;
726 bb->ForEachInst([&bb_size](const Instruction* insn) {
727 if (insn->opcode() == spv::Op::OpLabel) return;
728 if (insn->IsNop()) return;
729 if (insn->opcode() == spv::Op::OpPhi) return;
730 bb_size++;
731 });
732 block_sizes_[bb->id()] = bb_size;
733 roi_size_ += bb_size;
734 }
735}
736
737} // namespace opt
738} // namespace spvtools

Callers 4

ProcessFunctionMethod · 0.45
IsConsistentMethod · 0.45
AnalyzeFeaturesMethod · 0.45

Calls 8

IsNopMethod · 0.80
cfgMethod · 0.45
GetContextMethod · 0.45
clearMethod · 0.45
blockMethod · 0.45
ForEachInstMethod · 0.45
opcodeMethod · 0.45
idMethod · 0.45

Tested by

no test coverage detected