diff options
Diffstat (limited to 'source/opt/dead_variable_elimination.cpp')
-rw-r--r-- | source/opt/dead_variable_elimination.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/source/opt/dead_variable_elimination.cpp b/source/opt/dead_variable_elimination.cpp index e39132c2..28371068 100644 --- a/source/opt/dead_variable_elimination.cpp +++ b/source/opt/dead_variable_elimination.cpp @@ -33,7 +33,7 @@ Pass::Status DeadVariableElimination::Process() { // Get the reference count for all of the global OpVariable instructions. for (auto& inst : context()->types_values()) { - if (inst.opcode() != spv::Op::OpVariable) { + if (inst.opcode() != SpvOp::SpvOpVariable) { continue; } @@ -43,11 +43,11 @@ Pass::Status DeadVariableElimination::Process() { // Check the linkage. If it is exported, it could be reference somewhere // else, so we must keep the variable around. get_decoration_mgr()->ForEachDecoration( - result_id, uint32_t(spv::Decoration::LinkageAttributes), + result_id, SpvDecorationLinkageAttributes, [&count](const Instruction& linkage_instruction) { uint32_t last_operand = linkage_instruction.NumOperands() - 1; - if (spv::LinkageType(linkage_instruction.GetSingleWordOperand( - last_operand)) == spv::LinkageType::Export) { + if (linkage_instruction.GetSingleWordOperand(last_operand) == + SpvLinkageTypeExport) { count = kMustKeep; } }); @@ -57,8 +57,7 @@ Pass::Status DeadVariableElimination::Process() { // at the uses and count the number of real references. count = 0; get_def_use_mgr()->ForEachUser(result_id, [&count](Instruction* user) { - if (!IsAnnotationInst(user->opcode()) && - user->opcode() != spv::Op::OpName) { + if (!IsAnnotationInst(user->opcode()) && user->opcode() != SpvOpName) { ++count; } }); @@ -82,7 +81,7 @@ Pass::Status DeadVariableElimination::Process() { void DeadVariableElimination::DeleteVariable(uint32_t result_id) { Instruction* inst = get_def_use_mgr()->GetDef(result_id); - assert(inst->opcode() == spv::Op::OpVariable && + assert(inst->opcode() == SpvOpVariable && "Should not be trying to delete anything other than an OpVariable."); // Look for an initializer that references another variable. We need to know @@ -94,7 +93,7 @@ void DeadVariableElimination::DeleteVariable(uint32_t result_id) { // TODO: Handle OpSpecConstantOP which might be defined in terms of other // variables. Will probably require a unified dead code pass that does all // instruction types. (Issue 906) - if (initializer->opcode() == spv::Op::OpVariable) { + if (initializer->opcode() == SpvOpVariable) { uint32_t initializer_id = initializer->result_id(); size_t& count = reference_count_[initializer_id]; if (count != kMustKeep) { |