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

Method EmitMaskOperand

source/disassemble.cpp:1023–1049  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1021}
1022
1023void InstructionDisassembler::EmitMaskOperand(std::ostream& stream,
1024 const spv_operand_type_t type,
1025 const uint32_t word) const {
1026 // Scan the mask from least significant bit to most significant bit. For each
1027 // set bit, emit the name of that bit. Separate multiple names with '|'.
1028 uint32_t remaining_word = word;
1029 uint32_t mask;
1030 int num_emitted = 0;
1031 for (mask = 1; remaining_word; mask <<= 1) {
1032 if (remaining_word & mask) {
1033 remaining_word ^= mask;
1034 const spvtools::OperandDesc* entry = nullptr;
1035 if (spvtools::LookupOperand(type, mask, &entry))
1036 assert(false && "should have caught this earlier");
1037 if (num_emitted) stream << "|";
1038 stream << entry->name().data();
1039 num_emitted++;
1040 }
1041 }
1042 if (!num_emitted) {
1043 // An operand value of 0 was provided, so represent it by the name
1044 // of the 0 value. In many cases, that's "None".
1045 const spvtools::OperandDesc* entry = nullptr;
1046 if (SPV_SUCCESS == spvtools::LookupOperand(type, 0, &entry))
1047 stream << entry->name().data();
1048 }
1049}
1050
1051void InstructionDisassembler::ResetColor(std::ostream& stream) const {
1052 if (color_) stream << spvtools::clr::reset{print_};

Callers

nothing calls this directly

Calls 3

LookupOperandFunction · 0.85
dataMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected