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

Method EmitSectionComment

source/disassemble.cpp:859–891  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

857}
858
859void InstructionDisassembler::EmitSectionComment(
860 const spv_parsed_instruction_t& inst, bool& inserted_decoration_space,
861 bool& inserted_debug_space, bool& inserted_type_space) {
862 auto opcode = static_cast<spv::Op>(inst.opcode);
863 if (comment_ && opcode == spv::Op::OpFunction) {
864 stream_ << std::endl;
865 if (nested_indent_) {
866 // Double the empty lines between Function sections since nested_indent_
867 // also separates blocks by a blank.
868 stream_ << std::endl;
869 }
870 stream_ << std::string(indent_, ' ');
871 stream_ << "; Function " << name_mapper_(inst.result_id) << std::endl;
872 }
873 if (comment_ && !inserted_decoration_space && spvOpcodeIsDecoration(opcode)) {
874 inserted_decoration_space = true;
875 stream_ << std::endl;
876 stream_ << std::string(indent_, ' ');
877 stream_ << "; Annotations" << std::endl;
878 }
879 if (comment_ && !inserted_debug_space && spvOpcodeIsDebug(opcode)) {
880 inserted_debug_space = true;
881 stream_ << std::endl;
882 stream_ << std::string(indent_, ' ');
883 stream_ << "; Debug Information" << std::endl;
884 }
885 if (comment_ && !inserted_type_space && spvOpcodeGeneratesType(opcode)) {
886 inserted_type_space = true;
887 stream_ << std::endl;
888 stream_ << std::string(indent_, ' ');
889 stream_ << "; Types, variables and constants" << std::endl;
890 }
891}
892
893void InstructionDisassembler::EmitOperand(std::ostream& stream,
894 const spv_parsed_instruction_t& inst,

Callers 1

HandleInstructionMethod · 0.80

Calls 3

spvOpcodeIsDecorationFunction · 0.85
spvOpcodeIsDebugFunction · 0.85
spvOpcodeGeneratesTypeFunction · 0.85

Tested by

no test coverage detected