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_store_elim_pass.cpp')
-rw-r--r--source/opt/local_single_store_elim_pass.cpp44
1 files changed, 22 insertions, 22 deletions
diff --git a/source/opt/local_single_store_elim_pass.cpp b/source/opt/local_single_store_elim_pass.cpp
index 81648c7ba..2b2b8c15b 100644
--- a/source/opt/local_single_store_elim_pass.cpp
+++ b/source/opt/local_single_store_elim_pass.cpp
@@ -37,7 +37,7 @@ bool LocalSingleStoreElimPass::LocalSingleStoreElim(Function* func) {
// Check all function scope variables in |func|.
BasicBlock* entry_block = &*func->begin();
for (Instruction& inst : *entry_block) {
- if (inst.opcode() != SpvOpVariable) {
+ if (inst.opcode() != spv::Op::OpVariable) {
break;
}
@@ -57,7 +57,7 @@ bool LocalSingleStoreElimPass::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.") &&
@@ -70,7 +70,7 @@ bool LocalSingleStoreElimPass::AllExtensionsSupported() const {
Pass::Status LocalSingleStoreElimPass::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 any disallowed extensions are enabled
@@ -194,7 +194,7 @@ Instruction* LocalSingleStoreElimPass::FindSingleStoreAndCheckUses(
for (Instruction* user : users) {
switch (user->opcode()) {
- case SpvOpStore:
+ case spv::Op::OpStore:
// Since we are in the relaxed addressing mode, the use has to be the
// base address of the store, and not the value being store. Otherwise,
// we would have a pointer to a pointer to function scope memory, which
@@ -206,19 +206,19 @@ Instruction* LocalSingleStoreElimPass::FindSingleStoreAndCheckUses(
return nullptr;
}
break;
- case SpvOpAccessChain:
- case SpvOpInBoundsAccessChain:
+ case spv::Op::OpAccessChain:
+ case spv::Op::OpInBoundsAccessChain:
if (FeedsAStore(user)) {
// Has a partial store. Cannot propagate that.
return nullptr;
}
break;
- case SpvOpLoad:
- case SpvOpImageTexelPointer:
- case SpvOpName:
- case SpvOpCopyObject:
+ case spv::Op::OpLoad:
+ case spv::Op::OpImageTexelPointer:
+ case spv::Op::OpName:
+ case spv::Op::OpCopyObject:
break;
- case SpvOpExtInst: {
+ case spv::Op::OpExtInst: {
auto dbg_op = user->GetCommonDebugOpcode();
if (dbg_op == CommonDebugInfoDebugDeclare ||
dbg_op == CommonDebugInfoDebugValue) {
@@ -243,7 +243,7 @@ void LocalSingleStoreElimPass::FindUses(
analysis::DefUseManager* def_use_mgr = context()->get_def_use_mgr();
def_use_mgr->ForEachUser(var_inst, [users, this](Instruction* user) {
users->push_back(user);
- if (user->opcode() == SpvOpCopyObject) {
+ if (user->opcode() == spv::Op::OpCopyObject) {
FindUses(user, users);
}
});
@@ -253,15 +253,15 @@ bool LocalSingleStoreElimPass::FeedsAStore(Instruction* inst) const {
analysis::DefUseManager* def_use_mgr = context()->get_def_use_mgr();
return !def_use_mgr->WhileEachUser(inst, [this](Instruction* user) {
switch (user->opcode()) {
- case SpvOpStore:
+ case spv::Op::OpStore:
return false;
- case SpvOpAccessChain:
- case SpvOpInBoundsAccessChain:
- case SpvOpCopyObject:
+ case spv::Op::OpAccessChain:
+ case spv::Op::OpInBoundsAccessChain:
+ case spv::Op::OpCopyObject:
return !FeedsAStore(user);
- case SpvOpLoad:
- case SpvOpImageTexelPointer:
- case SpvOpName:
+ case spv::Op::OpLoad:
+ case spv::Op::OpImageTexelPointer:
+ case spv::Op::OpName:
return true;
default:
// Don't know if this instruction modifies the variable.
@@ -279,7 +279,7 @@ bool LocalSingleStoreElimPass::RewriteLoads(
context()->GetDominatorAnalysis(store_block->GetParent());
uint32_t stored_id;
- if (store_inst->opcode() == SpvOpStore)
+ if (store_inst->opcode() == spv::Op::OpStore)
stored_id = store_inst->GetSingleWordInOperand(kStoreValIdInIdx);
else
stored_id = store_inst->GetSingleWordInOperand(kVariableInitIdInIdx);
@@ -287,12 +287,12 @@ bool LocalSingleStoreElimPass::RewriteLoads(
*all_rewritten = true;
bool modified = false;
for (Instruction* use : uses) {
- if (use->opcode() == SpvOpStore) continue;
+ if (use->opcode() == spv::Op::OpStore) continue;
auto dbg_op = use->GetCommonDebugOpcode();
if (dbg_op == CommonDebugInfoDebugDeclare ||
dbg_op == CommonDebugInfoDebugValue)
continue;
- if (use->opcode() == SpvOpLoad &&
+ if (use->opcode() == spv::Op::OpLoad &&
dominator_analysis->Dominates(store_inst, use)) {
modified = true;
context()->KillNamesAndDecorates(use->result_id());