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

Method GetConditionID

source/opt/control_dependence.cpp:42–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40constexpr uint32_t ControlDependenceAnalysis::kPseudoEntryBlock;
41
42uint32_t ControlDependence::GetConditionID(const CFG& cfg) const {
43 if (source_bb_id() == 0) {
44 // Entry dependence; return 0.
45 return 0;
46 }
47 const BasicBlock* source_bb = cfg.block(source_bb_id());
48 const Instruction* branch = source_bb->terminator();
49 assert((branch->opcode() == spv::Op::OpBranchConditional ||
50 branch->opcode() == spv::Op::OpSwitch) &&
51 "invalid control dependence; last instruction must be conditional "
52 "branch or switch");
53 return branch->GetSingleWordInOperand(0);
54}
55
56bool ControlDependence::operator<(const ControlDependence& other) const {
57 return std::tie(source_bb_id_, target_bb_id_, branch_target_bb_id_) <

Callers 2

VisitBlockMethod · 0.80
TESTFunction · 0.80

Calls 4

blockMethod · 0.45
terminatorMethod · 0.45
opcodeMethod · 0.45

Tested by

no test coverage detected