diff options
Diffstat (limited to 'source/opt/module.cpp')
-rw-r--r-- | source/opt/module.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/source/opt/module.cpp b/source/opt/module.cpp index 2f788ffda..a9710c6a3 100644 --- a/source/opt/module.cpp +++ b/source/opt/module.cpp @@ -69,14 +69,14 @@ std::vector<const Instruction*> Module::GetConstants() const { return const_insts; } -uint32_t Module::GetGlobalValue(SpvOp opcode) const { +uint32_t Module::GetGlobalValue(spv::Op opcode) const { for (auto& inst : types_values_) { if (inst.opcode() == opcode) return inst.result_id(); } return 0; } -void Module::AddGlobalValue(SpvOp opcode, uint32_t result_id, +void Module::AddGlobalValue(spv::Op opcode, uint32_t result_id, uint32_t type_id) { std::unique_ptr<Instruction> newGlobal( new Instruction(context(), opcode, type_id, result_id, {})); @@ -180,21 +180,23 @@ void Module::ToBinary(std::vector<uint32_t>* binary, bool skip_nop) const { ->get_feature_mgr() ->GetExtInstImportId_Shader100DebugInfo(); if (shader_set_id != 0) { - binary->push_back((5 << 16) | static_cast<uint16_t>(SpvOpExtInst)); + binary->push_back((5 << 16) | + static_cast<uint16_t>(spv::Op::OpExtInst)); binary->push_back(context()->get_type_mgr()->GetVoidTypeId()); binary->push_back(context()->TakeNextId()); binary->push_back(shader_set_id); binary->push_back(NonSemanticShaderDebugInfo100DebugNoLine); } else { - binary->push_back((1 << 16) | static_cast<uint16_t>(SpvOpNoLine)); + binary->push_back((1 << 16) | + static_cast<uint16_t>(spv::Op::OpNoLine)); } last_line_inst = nullptr; } } - if (opcode == SpvOpLabel) { + if (opcode == spv::Op::OpLabel) { between_label_and_phi_var = true; - } else if (opcode != SpvOpVariable && opcode != SpvOpPhi && + } else if (opcode != spv::Op::OpVariable && opcode != spv::Op::OpPhi && !spvtools::opt::IsOpLineInst(opcode)) { between_label_and_phi_var = false; } @@ -223,7 +225,8 @@ void Module::ToBinary(std::vector<uint32_t>* binary, bool skip_nop) const { between_merge_and_branch = false; if (spvOpcodeIsBlockTerminator(opcode) || i->IsNoLine()) { last_line_inst = nullptr; - } else if (opcode == SpvOpLoopMerge || opcode == SpvOpSelectionMerge) { + } else if (opcode == spv::Op::OpLoopMerge || + opcode == spv::Op::OpSelectionMerge) { between_merge_and_branch = true; last_line_inst = nullptr; } else if (i->IsLine()) { @@ -272,7 +275,7 @@ uint32_t Module::GetExtInstImportId(const char* extstr) { std::ostream& operator<<(std::ostream& str, const Module& module) { module.ForEachInst([&str](const Instruction* inst) { str << *inst; - if (inst->opcode() != SpvOpFunctionEnd) { + if (inst->opcode() != spv::Op::OpFunctionEnd) { str << std::endl; } }); |