| 586 | } |
| 587 | |
| 588 | Instruction* DebugInfoManager::AddDebugValueForDecl(Instruction* dbg_decl, |
| 589 | uint32_t value_id, |
| 590 | Instruction* insert_before, |
| 591 | Instruction* line) { |
| 592 | if (dbg_decl == nullptr || !IsDebugDeclare(dbg_decl)) return nullptr; |
| 593 | |
| 594 | std::unique_ptr<Instruction> dbg_val(dbg_decl->Clone(context())); |
| 595 | dbg_val->SetResultId(context()->TakeNextId()); |
| 596 | dbg_val->SetInOperand(kExtInstInstructionInIdx, {CommonDebugInfoDebugValue}); |
| 597 | dbg_val->SetOperand(kDebugDeclareOperandVariableIndex, {value_id}); |
| 598 | dbg_val->SetOperand(kDebugValueOperandExpressionIndex, |
| 599 | {GetEmptyDebugExpression()->result_id()}); |
| 600 | dbg_val->UpdateDebugInfoFrom(dbg_decl, line); |
| 601 | |
| 602 | auto* added_dbg_val = insert_before->InsertBefore(std::move(dbg_val)); |
| 603 | AnalyzeDebugInst(added_dbg_val); |
| 604 | if (context()->AreAnalysesValid(IRContext::Analysis::kAnalysisDefUse)) |
| 605 | context()->get_def_use_mgr()->AnalyzeInstDefUse(added_dbg_val); |
| 606 | if (context()->AreAnalysesValid( |
| 607 | IRContext::Analysis::kAnalysisInstrToBlockMapping)) { |
| 608 | auto insert_blk = context()->get_instr_block(insert_before); |
| 609 | context()->set_instr_block(added_dbg_val, insert_blk); |
| 610 | } |
| 611 | return added_dbg_val; |
| 612 | } |
| 613 | |
| 614 | uint32_t DebugInfoManager::GetVulkanDebugOperation(Instruction* inst) { |
| 615 | assert(inst->GetShaderDebugOpcode() == |