Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/KhronosGroup/SPIRV-Tools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/opt/local_single_block_elim_pass.cpp')
-rw-r--r--source/opt/local_single_block_elim_pass.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/source/opt/local_single_block_elim_pass.cpp b/source/opt/local_single_block_elim_pass.cpp
index a58e8e4cc..6678c0480 100644
--- a/source/opt/local_single_block_elim_pass.cpp
+++ b/source/opt/local_single_block_elim_pass.cpp
@@ -37,13 +37,13 @@ bool LocalSingleBlockLoadStoreElimPass::HasOnlySupportedRefs(uint32_t ptrId) {
dbg_op == CommonDebugInfoDebugValue) {
return true;
}
- SpvOp op = user->opcode();
- if (IsNonPtrAccessChain(op) || op == SpvOpCopyObject) {
+ spv::Op op = user->opcode();
+ if (IsNonPtrAccessChain(op) || op == spv::Op::OpCopyObject) {
if (!HasOnlySupportedRefs(user->result_id())) {
return false;
}
- } else if (op != SpvOpStore && op != SpvOpLoad && op != SpvOpName &&
- !IsNonTypeDecorate(op)) {
+ } else if (op != spv::Op::OpStore && op != spv::Op::OpLoad &&
+ op != spv::Op::OpName && !IsNonTypeDecorate(op)) {
return false;
}
return true;
@@ -68,7 +68,7 @@ bool LocalSingleBlockLoadStoreElimPass::LocalSingleBlockLoadStoreElim(
for (auto ii = next; ii != bi->end(); ii = next) {
++next;
switch (ii->opcode()) {
- case SpvOpStore: {
+ case spv::Op::OpStore: {
// Verify store variable is target type
uint32_t varId;
Instruction* ptrInst = GetPtr(&*ii, &varId);
@@ -77,7 +77,7 @@ bool LocalSingleBlockLoadStoreElimPass::LocalSingleBlockLoadStoreElim(
// If a store to the whole variable, remember it for succeeding
// loads and stores. Otherwise forget any previous store to that
// variable.
- if (ptrInst->opcode() == SpvOpVariable) {
+ if (ptrInst->opcode() == spv::Op::OpVariable) {
// If a previous store to same variable, mark the store
// for deletion if not still used. Don't delete store
// if debugging; let ssa-rewrite and DCE handle it
@@ -114,14 +114,14 @@ bool LocalSingleBlockLoadStoreElimPass::LocalSingleBlockLoadStoreElim(
var2load_.erase(varId);
}
} break;
- case SpvOpLoad: {
+ case spv::Op::OpLoad: {
// Verify store variable is target type
uint32_t varId;
Instruction* ptrInst = GetPtr(&*ii, &varId);
if (!IsTargetVar(varId)) continue;
if (!HasOnlySupportedRefs(varId)) continue;
uint32_t replId = 0;
- if (ptrInst->opcode() == SpvOpVariable) {
+ if (ptrInst->opcode() == spv::Op::OpVariable) {
// If a load from a variable, look for a previous store or
// load from that variable and use its value.
auto si = var2store_.find(varId);
@@ -146,11 +146,11 @@ bool LocalSingleBlockLoadStoreElimPass::LocalSingleBlockLoadStoreElim(
instructions_to_kill.push_back(&*ii);
modified = true;
} else {
- if (ptrInst->opcode() == SpvOpVariable)
+ if (ptrInst->opcode() == spv::Op::OpVariable)
var2load_[varId] = &*ii; // register load
}
} break;
- case SpvOpFunctionCall: {
+ case spv::Op::OpFunctionCall: {
// Conservatively assume all locals are redefined for now.
// TODO(): Handle more optimally
var2store_.clear();
@@ -192,7 +192,7 @@ bool LocalSingleBlockLoadStoreElimPass::AllExtensionsSupported() const {
// around unknown extended
// instruction sets even if they are non-semantic
for (auto& inst : context()->module()->ext_inst_imports()) {
- assert(inst.opcode() == SpvOpExtInstImport &&
+ assert(inst.opcode() == spv::Op::OpExtInstImport &&
"Expecting an import of an extension's instruction set.");
const std::string extension_name = inst.GetInOperand(0).AsString();
if (spvtools::utils::starts_with(extension_name, "NonSemantic.") &&
@@ -205,14 +205,15 @@ bool LocalSingleBlockLoadStoreElimPass::AllExtensionsSupported() const {
Pass::Status LocalSingleBlockLoadStoreElimPass::ProcessImpl() {
// Assumes relaxed logical addressing only (see instruction.h).
- if (context()->get_feature_mgr()->HasCapability(SpvCapabilityAddresses))
+ if (context()->get_feature_mgr()->HasCapability(spv::Capability::Addresses))
return Status::SuccessWithoutChange;
// Do not process if module contains OpGroupDecorate. Additional
// support required in KillNamesAndDecorates().
// TODO(greg-lunarg): Add support for OpGroupDecorate
for (auto& ai : get_module()->annotations())
- if (ai.opcode() == SpvOpGroupDecorate) return Status::SuccessWithoutChange;
+ if (ai.opcode() == spv::Op::OpGroupDecorate)
+ return Status::SuccessWithoutChange;
// If any extensions in the module are not explicitly supported,
// return unmodified.
if (!AllExtensionsSupported()) return Status::SuccessWithoutChange;