diff options
Diffstat (limited to 'source/opt/instruction.cpp')
-rw-r--r-- | source/opt/instruction.cpp | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/source/opt/instruction.cpp b/source/opt/instruction.cpp index 37ff0358..af61bf19 100644 --- a/source/opt/instruction.cpp +++ b/source/opt/instruction.cpp @@ -145,7 +145,7 @@ void Instruction::ReplaceOperands(const OperandList& new_operands) { bool Instruction::IsReadOnlyLoad() const { if (IsLoad()) { - opt::Instruction* address_def = GetBaseAddress(); + Instruction* address_def = GetBaseAddress(); if (!address_def || address_def->opcode() != SpvOpVariable) { return false; } @@ -161,7 +161,7 @@ Instruction* Instruction::GetBaseAddress() const { "GetBaseAddress should only be called on instructions that take a " "pointer or image."); uint32_t base = GetSingleWordInOperand(kLoadBaseIndex); - opt::Instruction* base_inst = context()->get_def_use_mgr()->GetDef(base); + Instruction* base_inst = context()->get_def_use_mgr()->GetDef(base); bool done = false; while (!done) { switch (base_inst->opcode()) { @@ -217,7 +217,7 @@ bool Instruction::IsVulkanStorageImage() const { return false; } - opt::Instruction* base_type = + Instruction* base_type = context()->get_def_use_mgr()->GetDef(GetSingleWordInOperand(1)); if (base_type->opcode() != SpvOpTypeImage) { return false; @@ -243,7 +243,7 @@ bool Instruction::IsVulkanSampledImage() const { return false; } - opt::Instruction* base_type = + Instruction* base_type = context()->get_def_use_mgr()->GetDef(GetSingleWordInOperand(1)); if (base_type->opcode() != SpvOpTypeImage) { return false; @@ -269,7 +269,7 @@ bool Instruction::IsVulkanStorageTexelBuffer() const { return false; } - opt::Instruction* base_type = + Instruction* base_type = context()->get_def_use_mgr()->GetDef(GetSingleWordInOperand(1)); if (base_type->opcode() != SpvOpTypeImage) { return false; @@ -291,7 +291,7 @@ bool Instruction::IsVulkanStorageBuffer() const { return false; } - opt::Instruction* base_type = + Instruction* base_type = context()->get_def_use_mgr()->GetDef(GetSingleWordInOperand(1)); if (base_type->opcode() != SpvOpTypeStruct) { @@ -303,15 +303,13 @@ bool Instruction::IsVulkanStorageBuffer() const { bool is_buffer_block = false; context()->get_decoration_mgr()->ForEachDecoration( base_type->result_id(), SpvDecorationBufferBlock, - [&is_buffer_block](const opt::Instruction&) { - is_buffer_block = true; - }); + [&is_buffer_block](const Instruction&) { is_buffer_block = true; }); return is_buffer_block; } else if (storage_class == SpvStorageClassStorageBuffer) { bool is_block = false; context()->get_decoration_mgr()->ForEachDecoration( base_type->result_id(), SpvDecorationBlock, - [&is_block](const opt::Instruction&) { is_block = true; }); + [&is_block](const Instruction&) { is_block = true; }); return is_block; } return false; @@ -327,7 +325,7 @@ bool Instruction::IsVulkanUniformBuffer() const { return false; } - opt::Instruction* base_type = + Instruction* base_type = context()->get_def_use_mgr()->GetDef(GetSingleWordInOperand(1)); if (base_type->opcode() != SpvOpTypeStruct) { return false; @@ -336,7 +334,7 @@ bool Instruction::IsVulkanUniformBuffer() const { bool is_block = false; context()->get_decoration_mgr()->ForEachDecoration( base_type->result_id(), SpvDecorationBlock, - [&is_block](const opt::Instruction&) { is_block = true; }); + [&is_block](const Instruction&) { is_block = true; }); return is_block; } @@ -416,7 +414,7 @@ bool Instruction::IsValidBasePointer() const { return false; } - opt::Instruction* type = context()->get_def_use_mgr()->GetDef(tid); + Instruction* type = context()->get_def_use_mgr()->GetDef(tid); if (type->opcode() != SpvOpTypePointer) { return false; } @@ -431,7 +429,7 @@ bool Instruction::IsValidBasePointer() const { } uint32_t pointee_type_id = type->GetSingleWordInOperand(1); - opt::Instruction* pointee_type_inst = + Instruction* pointee_type_inst = context()->get_def_use_mgr()->GetDef(pointee_type_id); if (pointee_type_inst->IsOpaqueType()) { @@ -446,7 +444,7 @@ bool Instruction::IsValidBaseImage() const { return false; } - opt::Instruction* type = context()->get_def_use_mgr()->GetDef(tid); + Instruction* type = context()->get_def_use_mgr()->GetDef(tid); return (type->opcode() == SpvOpTypeImage || type->opcode() == SpvOpTypeSampledImage); } @@ -455,14 +453,13 @@ bool Instruction::IsOpaqueType() const { if (opcode() == SpvOpTypeStruct) { bool is_opaque = false; ForEachInOperand([&is_opaque, this](const uint32_t* op_id) { - opt::Instruction* type_inst = - context()->get_def_use_mgr()->GetDef(*op_id); + Instruction* type_inst = context()->get_def_use_mgr()->GetDef(*op_id); is_opaque |= type_inst->IsOpaqueType(); }); return is_opaque; } else if (opcode() == SpvOpTypeArray) { uint32_t sub_type_id = GetSingleWordInOperand(0); - opt::Instruction* sub_type_inst = + Instruction* sub_type_inst = context()->get_def_use_mgr()->GetDef(sub_type_id); return sub_type_inst->IsOpaqueType(); } else { @@ -477,7 +474,7 @@ bool Instruction::IsFoldable() const { } bool Instruction::IsFoldableByFoldScalar() const { - const opt::InstructionFolder& folder = context()->get_instruction_folder(); + const InstructionFolder& folder = context()->get_instruction_folder(); if (!folder.IsFoldableOpcode(opcode())) { return false; } @@ -494,7 +491,7 @@ bool Instruction::IsFloatingPointFoldingAllowed() const { bool is_nocontract = false; context_->get_decoration_mgr()->WhileEachDecoration( opcode_, SpvDecorationNoContraction, - [&is_nocontract](const opt::Instruction&) { + [&is_nocontract](const Instruction&) { is_nocontract = true; return false; }); @@ -518,7 +515,7 @@ std::string Instruction::PrettyPrint(uint32_t options) const { options | SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); } -std::ostream& operator<<(std::ostream& str, const opt::Instruction& inst) { +std::ostream& operator<<(std::ostream& str, const Instruction& inst) { str << inst.PrettyPrint(); return str; } |