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

Method ClearDebugInfo

source/opt/debug_info_manager.cpp:854–945  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

852}
853
854void DebugInfoManager::ClearDebugInfo(Instruction* instr) {
855 auto scope_id_to_users_itr =
856 scope_id_to_users_.find(instr->GetDebugScope().GetLexicalScope());
857 if (scope_id_to_users_itr != scope_id_to_users_.end()) {
858 scope_id_to_users_itr->second.erase(instr);
859 }
860 auto inlinedat_id_to_users_itr =
861 inlinedat_id_to_users_.find(instr->GetDebugInlinedAt());
862 if (inlinedat_id_to_users_itr != inlinedat_id_to_users_.end()) {
863 inlinedat_id_to_users_itr->second.erase(instr);
864 }
865
866 if (instr == nullptr || !instr->IsCommonDebugInstr()) {
867 return;
868 }
869
870 id_to_dbg_inst_.erase(instr->result_id());
871
872 if (instr->GetOpenCL100DebugOpcode() == OpenCLDebugInfo100DebugFunction) {
873 auto fn_id =
874 instr->GetSingleWordOperand(kDebugFunctionOperandFunctionIndex);
875 fn_id_to_dbg_fn_.erase(fn_id);
876 }
877 if (instr->GetShaderDebugOpcode() ==
878 NonSemanticShaderDebugInfoDebugFunctionDefinition) {
879 auto fn_id = instr->GetSingleWordOperand(
880 kDebugFunctionDefinitionOperandOpFunctionIndex);
881 fn_id_to_dbg_fn_.erase(fn_id);
882 }
883
884 if (instr->GetCommonDebugOpcode() == CommonDebugInfoDebugDeclare ||
885 instr->GetCommonDebugOpcode() == CommonDebugInfoDebugValue) {
886 auto var_or_value_id =
887 instr->GetSingleWordOperand(kDebugDeclareOperandVariableIndex);
888 auto dbg_decl_itr = var_id_to_dbg_decl_.find(var_or_value_id);
889 if (dbg_decl_itr != var_id_to_dbg_decl_.end()) {
890 dbg_decl_itr->second.erase(instr);
891 }
892 }
893
894 if (deref_operation_ == instr) {
895 deref_operation_ = nullptr;
896 for (auto dbg_instr_itr = context()->module()->ext_inst_debuginfo_begin();
897 dbg_instr_itr != context()->module()->ext_inst_debuginfo_end();
898 ++dbg_instr_itr) {
899 // OpenCL.DebugInfo.100 contains the operation as a literal operand, in
900 // Vulkan it's referenced as an OpConstant.
901 if (instr != &*dbg_instr_itr &&
902 dbg_instr_itr->GetOpenCL100DebugOpcode() ==
903 OpenCLDebugInfo100DebugOperation &&
904 dbg_instr_itr->GetSingleWordOperand(
905 kDebugOperationOperandOperationIndex) ==
906 OpenCLDebugInfo100Deref) {
907 deref_operation_ = &*dbg_instr_itr;
908 break;
909 } else if (instr != &*dbg_instr_itr &&
910 dbg_instr_itr->GetShaderDebugOpcode() ==
911 NonSemanticShaderDebugInfoDebugOperation) {

Callers 2

KillInstMethod · 0.80
ForgetUsesMethod · 0.80

Calls 14

IsEmptyDebugExpressionFunction · 0.85
GetLexicalScopeMethod · 0.80
IsCommonDebugInstrMethod · 0.80
GetSingleWordOperandMethod · 0.80
GetShaderDebugOpcodeMethod · 0.80
GetCommonDebugOpcodeMethod · 0.80
endMethod · 0.45
eraseMethod · 0.45
GetDebugInlinedAtMethod · 0.45
result_idMethod · 0.45

Tested by

no test coverage detected