diff options
Diffstat (limited to 'source/opt/reduce_load_size.cpp')
-rw-r--r-- | source/opt/reduce_load_size.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/source/opt/reduce_load_size.cpp b/source/opt/reduce_load_size.cpp index 56491b2f2..860ba21f5 100644 --- a/source/opt/reduce_load_size.cpp +++ b/source/opt/reduce_load_size.cpp @@ -38,7 +38,7 @@ Pass::Status ReduceLoadSize::Process() { for (auto& func : *get_module()) { func.ForEachInst([&modified, this](Instruction* inst) { - if (inst->opcode() == SpvOpCompositeExtract) { + if (inst->opcode() == spv::Op::OpCompositeExtract) { if (ShouldReplaceExtract(inst)) { modified |= ReplaceExtract(inst); } @@ -50,7 +50,7 @@ Pass::Status ReduceLoadSize::Process() { } bool ReduceLoadSize::ReplaceExtract(Instruction* inst) { - assert(inst->opcode() == SpvOpCompositeExtract && + assert(inst->opcode() == spv::Op::OpCompositeExtract && "Wrong opcode. Should be OpCompositeExtract."); analysis::DefUseManager* def_use_mgr = context()->get_def_use_mgr(); analysis::TypeManager* type_mgr = context()->get_type_mgr(); @@ -60,7 +60,7 @@ bool ReduceLoadSize::ReplaceExtract(Instruction* inst) { inst->GetSingleWordInOperand(kExtractCompositeIdInIdx); Instruction* composite_inst = def_use_mgr->GetDef(composite_id); - if (composite_inst->opcode() != SpvOpLoad) { + if (composite_inst->opcode() != spv::Op::OpLoad) { return false; } @@ -71,16 +71,16 @@ bool ReduceLoadSize::ReplaceExtract(Instruction* inst) { } Instruction* var = composite_inst->GetBaseAddress(); - if (var == nullptr || var->opcode() != SpvOpVariable) { + if (var == nullptr || var->opcode() != spv::Op::OpVariable) { return false; } - SpvStorageClass storage_class = static_cast<SpvStorageClass>( + spv::StorageClass storage_class = static_cast<spv::StorageClass>( var->GetSingleWordInOperand(kVariableStorageClassInIdx)); switch (storage_class) { - case SpvStorageClassUniform: - case SpvStorageClassUniformConstant: - case SpvStorageClassInput: + case spv::StorageClass::Uniform: + case spv::StorageClass::UniformConstant: + case spv::StorageClass::Input: break; default: return false; @@ -124,7 +124,7 @@ bool ReduceLoadSize::ShouldReplaceExtract(Instruction* inst) { Instruction* op_inst = def_use_mgr->GetDef( inst->GetSingleWordInOperand(kExtractCompositeIdInIdx)); - if (op_inst->opcode() != SpvOpLoad) { + if (op_inst->opcode() != spv::Op::OpLoad) { return false; } @@ -139,7 +139,7 @@ bool ReduceLoadSize::ShouldReplaceExtract(Instruction* inst) { all_elements_used = !def_use_mgr->WhileEachUser(op_inst, [&elements_used](Instruction* use) { if (use->IsCommonDebugInstr()) return true; - if (use->opcode() != SpvOpCompositeExtract || + if (use->opcode() != spv::Op::OpCompositeExtract || use->NumInOperands() == 1) { return false; } |