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/ir_loader.cpp')
-rw-r--r--source/opt/ir_loader.cpp45
1 files changed, 23 insertions, 22 deletions
diff --git a/source/opt/ir_loader.cpp b/source/opt/ir_loader.cpp
index 734ad554b..4b78ddd73 100644
--- a/source/opt/ir_loader.cpp
+++ b/source/opt/ir_loader.cpp
@@ -39,9 +39,9 @@ IrLoader::IrLoader(const MessageConsumer& consumer, Module* m)
last_dbg_scope_(kNoDebugScope, kNoInlinedAt) {}
bool IsLineInst(const spv_parsed_instruction_t* inst) {
- const auto opcode = static_cast<SpvOp>(inst->opcode);
+ const auto opcode = static_cast<spv::Op>(inst->opcode);
if (IsOpLineInst(opcode)) return true;
- if (opcode != SpvOpExtInst) return false;
+ if (opcode != spv::Op::OpExtInst) return false;
if (inst->ext_inst_type != SPV_EXT_INST_TYPE_NONSEMANTIC_SHADER_DEBUGINFO_100)
return false;
const uint32_t ext_inst_index = inst->words[kExtInstSetIndex];
@@ -63,8 +63,9 @@ bool IrLoader::AddInstruction(const spv_parsed_instruction_t* inst) {
// If it is a DebugScope or DebugNoScope of debug extension, we do not
// create a new instruction, but simply keep the information in
// struct DebugScope.
- const auto opcode = static_cast<SpvOp>(inst->opcode);
- if (opcode == SpvOpExtInst && spvExtInstIsDebugInfo(inst->ext_inst_type)) {
+ const auto opcode = static_cast<spv::Op>(inst->opcode);
+ if (opcode == spv::Op::OpExtInst &&
+ spvExtInstIsDebugInfo(inst->ext_inst_type)) {
const uint32_t ext_inst_index = inst->words[kExtInstSetIndex];
if (inst->ext_inst_type == SPV_EXT_INST_TYPE_OPENCL_DEBUGINFO_100 ||
inst->ext_inst_type ==
@@ -130,13 +131,13 @@ bool IrLoader::AddInstruction(const spv_parsed_instruction_t* inst) {
// Handle function and basic block boundaries first, then normal
// instructions.
- if (opcode == SpvOpFunction) {
+ if (opcode == spv::Op::OpFunction) {
if (function_ != nullptr) {
Error(consumer_, src, loc, "function inside function");
return false;
}
function_ = MakeUnique<Function>(std::move(spv_inst));
- } else if (opcode == SpvOpFunctionEnd) {
+ } else if (opcode == spv::Op::OpFunctionEnd) {
if (function_ == nullptr) {
Error(consumer_, src, loc,
"OpFunctionEnd without corresponding OpFunction");
@@ -149,7 +150,7 @@ bool IrLoader::AddInstruction(const spv_parsed_instruction_t* inst) {
function_->SetFunctionEnd(std::move(spv_inst));
module_->AddFunction(std::move(function_));
function_ = nullptr;
- } else if (opcode == SpvOpLabel) {
+ } else if (opcode == spv::Op::OpLabel) {
if (function_ == nullptr) {
Error(consumer_, src, loc, "OpLabel outside function");
return false;
@@ -179,20 +180,20 @@ bool IrLoader::AddInstruction(const spv_parsed_instruction_t* inst) {
} else {
if (function_ == nullptr) { // Outside function definition
SPIRV_ASSERT(consumer_, block_ == nullptr);
- if (opcode == SpvOpCapability) {
+ if (opcode == spv::Op::OpCapability) {
module_->AddCapability(std::move(spv_inst));
- } else if (opcode == SpvOpExtension) {
+ } else if (opcode == spv::Op::OpExtension) {
module_->AddExtension(std::move(spv_inst));
- } else if (opcode == SpvOpExtInstImport) {
+ } else if (opcode == spv::Op::OpExtInstImport) {
module_->AddExtInstImport(std::move(spv_inst));
- } else if (opcode == SpvOpMemoryModel) {
+ } else if (opcode == spv::Op::OpMemoryModel) {
module_->SetMemoryModel(std::move(spv_inst));
- } else if (opcode == SpvOpSamplerImageAddressingModeNV) {
+ } else if (opcode == spv::Op::OpSamplerImageAddressingModeNV) {
module_->SetSampledImageAddressMode(std::move(spv_inst));
- } else if (opcode == SpvOpEntryPoint) {
+ } else if (opcode == spv::Op::OpEntryPoint) {
module_->AddEntryPoint(std::move(spv_inst));
- } else if (opcode == SpvOpExecutionMode ||
- opcode == SpvOpExecutionModeId) {
+ } else if (opcode == spv::Op::OpExecutionMode ||
+ opcode == spv::Op::OpExecutionModeId) {
module_->AddExecutionMode(std::move(spv_inst));
} else if (IsDebug1Inst(opcode)) {
module_->AddDebug1Inst(std::move(spv_inst));
@@ -204,13 +205,13 @@ bool IrLoader::AddInstruction(const spv_parsed_instruction_t* inst) {
module_->AddAnnotationInst(std::move(spv_inst));
} else if (IsTypeInst(opcode)) {
module_->AddType(std::move(spv_inst));
- } else if (IsConstantInst(opcode) || opcode == SpvOpVariable ||
- opcode == SpvOpUndef) {
+ } else if (IsConstantInst(opcode) || opcode == spv::Op::OpVariable ||
+ opcode == spv::Op::OpUndef) {
module_->AddGlobalValue(std::move(spv_inst));
- } else if (opcode == SpvOpExtInst &&
+ } else if (opcode == spv::Op::OpExtInst &&
spvExtInstIsDebugInfo(inst->ext_inst_type)) {
module_->AddExtInstDebugInfo(std::move(spv_inst));
- } else if (opcode == SpvOpExtInst &&
+ } else if (opcode == spv::Op::OpExtInst &&
spvExtInstIsNonSemantic(inst->ext_inst_type)) {
// If there are no functions, add the non-semantic instructions to the
// global values. Otherwise append it to the list of the last function.
@@ -229,11 +230,11 @@ bool IrLoader::AddInstruction(const spv_parsed_instruction_t* inst) {
return false;
}
} else {
- if (opcode == SpvOpLoopMerge || opcode == SpvOpSelectionMerge)
+ if (opcode == spv::Op::OpLoopMerge || opcode == spv::Op::OpSelectionMerge)
last_dbg_scope_ = DebugScope(kNoDebugScope, kNoInlinedAt);
if (last_dbg_scope_.GetLexicalScope() != kNoDebugScope)
spv_inst->SetDebugScope(last_dbg_scope_);
- if (opcode == SpvOpExtInst &&
+ if (opcode == spv::Op::OpExtInst &&
spvExtInstIsDebugInfo(inst->ext_inst_type)) {
const uint32_t ext_inst_index = inst->words[kExtInstSetIndex];
if (inst->ext_inst_type == SPV_EXT_INST_TYPE_OPENCL_DEBUGINFO_100) {
@@ -322,7 +323,7 @@ bool IrLoader::AddInstruction(const spv_parsed_instruction_t* inst) {
}
} else {
if (block_ == nullptr) { // Inside function but outside blocks
- if (opcode != SpvOpFunctionParameter) {
+ if (opcode != spv::Op::OpFunctionParameter) {
Errorf(consumer_, src, loc,
"Non-OpFunctionParameter (opcode: %d) found inside "
"function but outside basic block",