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 'test/fuzz/transformation_add_function_test.cpp')
-rw-r--r--test/fuzz/transformation_add_function_test.cpp554
1 files changed, 296 insertions, 258 deletions
diff --git a/test/fuzz/transformation_add_function_test.cpp b/test/fuzz/transformation_add_function_test.cpp
index d55fb9318..65ae2f2dd 100644
--- a/test/fuzz/transformation_add_function_test.cpp
+++ b/test/fuzz/transformation_add_function_test.cpp
@@ -84,7 +84,7 @@ bool AllVariablesAndParametersExceptLoopLimiterAreIrrelevant(
&found_non_irrelevant_parameter](
opt::Instruction* inst) {
if (context->get_def_use_mgr()->GetDef(inst->type_id())->opcode() ==
- SpvOpTypePointer &&
+ spv::Op::OpTypePointer &&
!transformation_context.GetFactManager()->PointeeValueIsIrrelevant(
inst->result_id())) {
found_non_irrelevant_parameter = true;
@@ -96,7 +96,7 @@ bool AllVariablesAndParametersExceptLoopLimiterAreIrrelevant(
}
// Look through the instructions in the function's first block.
for (auto& inst : *function.begin()) {
- if (inst.opcode() != SpvOpVariable) {
+ if (inst.opcode() != spv::Op::OpVariable) {
// We have found a non-variable instruction; this means we have gotten
// past all variables, so we are done.
return true;
@@ -154,73 +154,84 @@ TEST(TransformationAddFunctionTest, BasicTest) {
TransformationContext transformation_context(
MakeUnique<FactManager>(context.get()), validator_options);
TransformationAddFunction transformation1(std::vector<protobufs::Instruction>(
- {MakeInstructionMessage(
- SpvOpFunction, 8, 13,
- {{SPV_OPERAND_TYPE_FUNCTION_CONTROL, {SpvFunctionControlMaskNone}},
- {SPV_OPERAND_TYPE_ID, {10}}}),
- MakeInstructionMessage(SpvOpFunctionParameter, 7, 11, {}),
- MakeInstructionMessage(SpvOpFunctionParameter, 9, 12, {}),
- MakeInstructionMessage(SpvOpLabel, 0, 14, {}),
+ {MakeInstructionMessage(spv::Op::OpFunction, 8, 13,
+ {{SPV_OPERAND_TYPE_FUNCTION_CONTROL,
+ {uint32_t(spv::FunctionControlMask::MaskNone)}},
+ {SPV_OPERAND_TYPE_ID, {10}}}),
+ MakeInstructionMessage(spv::Op::OpFunctionParameter, 7, 11, {}),
+ MakeInstructionMessage(spv::Op::OpFunctionParameter, 9, 12, {}),
+ MakeInstructionMessage(spv::Op::OpLabel, 0, 14, {}),
+ MakeInstructionMessage(spv::Op::OpVariable, 9, 17,
+ {{SPV_OPERAND_TYPE_STORAGE_CLASS,
+ {uint32_t(spv::StorageClass::Function)}}}),
+ MakeInstructionMessage(spv::Op::OpVariable, 7, 19,
+ {{SPV_OPERAND_TYPE_STORAGE_CLASS,
+ {uint32_t(spv::StorageClass::Function)}}}),
MakeInstructionMessage(
- SpvOpVariable, 9, 17,
- {{SPV_OPERAND_TYPE_STORAGE_CLASS, {SpvStorageClassFunction}}}),
- MakeInstructionMessage(
- SpvOpVariable, 7, 19,
- {{SPV_OPERAND_TYPE_STORAGE_CLASS, {SpvStorageClassFunction}}}),
- MakeInstructionMessage(
- SpvOpStore, 0, 0,
+ spv::Op::OpStore, 0, 0,
{{SPV_OPERAND_TYPE_ID, {17}}, {SPV_OPERAND_TYPE_ID, {18}}}),
MakeInstructionMessage(
- SpvOpStore, 0, 0,
+ spv::Op::OpStore, 0, 0,
{{SPV_OPERAND_TYPE_ID, {19}}, {SPV_OPERAND_TYPE_ID, {20}}}),
- MakeInstructionMessage(SpvOpBranch, 0, 0, {{SPV_OPERAND_TYPE_ID, {21}}}),
- MakeInstructionMessage(SpvOpLabel, 0, 21, {}),
+ MakeInstructionMessage(spv::Op::OpBranch, 0, 0,
+ {{SPV_OPERAND_TYPE_ID, {21}}}),
+ MakeInstructionMessage(spv::Op::OpLabel, 0, 21, {}),
+ MakeInstructionMessage(spv::Op::OpLoopMerge, 0, 0,
+ {{SPV_OPERAND_TYPE_ID, {23}},
+ {SPV_OPERAND_TYPE_ID, {24}},
+ {SPV_OPERAND_TYPE_LOOP_CONTROL,
+ {uint32_t(spv::LoopControlMask::MaskNone)}}}),
+ MakeInstructionMessage(spv::Op::OpBranch, 0, 0,
+ {{SPV_OPERAND_TYPE_ID, {25}}}),
+ MakeInstructionMessage(spv::Op::OpLabel, 0, 25, {}),
+ MakeInstructionMessage(spv::Op::OpLoad, 6, 26,
+ {{SPV_OPERAND_TYPE_ID, {19}}}),
+ MakeInstructionMessage(spv::Op::OpLoad, 6, 27,
+ {{SPV_OPERAND_TYPE_ID, {11}}}),
MakeInstructionMessage(
- SpvOpLoopMerge, 0, 0,
- {{SPV_OPERAND_TYPE_ID, {23}},
- {SPV_OPERAND_TYPE_ID, {24}},
- {SPV_OPERAND_TYPE_LOOP_CONTROL, {SpvLoopControlMaskNone}}}),
- MakeInstructionMessage(SpvOpBranch, 0, 0, {{SPV_OPERAND_TYPE_ID, {25}}}),
- MakeInstructionMessage(SpvOpLabel, 0, 25, {}),
- MakeInstructionMessage(SpvOpLoad, 6, 26, {{SPV_OPERAND_TYPE_ID, {19}}}),
- MakeInstructionMessage(SpvOpLoad, 6, 27, {{SPV_OPERAND_TYPE_ID, {11}}}),
- MakeInstructionMessage(
- SpvOpSLessThan, 28, 29,
+ spv::Op::OpSLessThan, 28, 29,
{{SPV_OPERAND_TYPE_ID, {26}}, {SPV_OPERAND_TYPE_ID, {27}}}),
- MakeInstructionMessage(SpvOpBranchConditional, 0, 0,
+ MakeInstructionMessage(spv::Op::OpBranchConditional, 0, 0,
{{SPV_OPERAND_TYPE_ID, {29}},
{SPV_OPERAND_TYPE_ID, {22}},
{SPV_OPERAND_TYPE_ID, {23}}}),
- MakeInstructionMessage(SpvOpLabel, 0, 22, {}),
- MakeInstructionMessage(SpvOpLoad, 8, 30, {{SPV_OPERAND_TYPE_ID, {12}}}),
- MakeInstructionMessage(SpvOpLoad, 6, 31, {{SPV_OPERAND_TYPE_ID, {19}}}),
- MakeInstructionMessage(SpvOpConvertSToF, 8, 32,
+ MakeInstructionMessage(spv::Op::OpLabel, 0, 22, {}),
+ MakeInstructionMessage(spv::Op::OpLoad, 8, 30,
+ {{SPV_OPERAND_TYPE_ID, {12}}}),
+ MakeInstructionMessage(spv::Op::OpLoad, 6, 31,
+ {{SPV_OPERAND_TYPE_ID, {19}}}),
+ MakeInstructionMessage(spv::Op::OpConvertSToF, 8, 32,
{{SPV_OPERAND_TYPE_ID, {31}}}),
MakeInstructionMessage(
- SpvOpFMul, 8, 33,
+ spv::Op::OpFMul, 8, 33,
{{SPV_OPERAND_TYPE_ID, {30}}, {SPV_OPERAND_TYPE_ID, {32}}}),
- MakeInstructionMessage(SpvOpLoad, 8, 34, {{SPV_OPERAND_TYPE_ID, {17}}}),
+ MakeInstructionMessage(spv::Op::OpLoad, 8, 34,
+ {{SPV_OPERAND_TYPE_ID, {17}}}),
MakeInstructionMessage(
- SpvOpFAdd, 8, 35,
+ spv::Op::OpFAdd, 8, 35,
{{SPV_OPERAND_TYPE_ID, {34}}, {SPV_OPERAND_TYPE_ID, {33}}}),
MakeInstructionMessage(
- SpvOpStore, 0, 0,
+ spv::Op::OpStore, 0, 0,
{{SPV_OPERAND_TYPE_ID, {17}}, {SPV_OPERAND_TYPE_ID, {35}}}),
- MakeInstructionMessage(SpvOpBranch, 0, 0, {{SPV_OPERAND_TYPE_ID, {24}}}),
- MakeInstructionMessage(SpvOpLabel, 0, 24, {}),
- MakeInstructionMessage(SpvOpLoad, 6, 36, {{SPV_OPERAND_TYPE_ID, {19}}}),
+ MakeInstructionMessage(spv::Op::OpBranch, 0, 0,
+ {{SPV_OPERAND_TYPE_ID, {24}}}),
+ MakeInstructionMessage(spv::Op::OpLabel, 0, 24, {}),
+ MakeInstructionMessage(spv::Op::OpLoad, 6, 36,
+ {{SPV_OPERAND_TYPE_ID, {19}}}),
MakeInstructionMessage(
- SpvOpIAdd, 6, 38,
+ spv::Op::OpIAdd, 6, 38,
{{SPV_OPERAND_TYPE_ID, {36}}, {SPV_OPERAND_TYPE_ID, {37}}}),
MakeInstructionMessage(
- SpvOpStore, 0, 0,
+ spv::Op::OpStore, 0, 0,
{{SPV_OPERAND_TYPE_ID, {19}}, {SPV_OPERAND_TYPE_ID, {38}}}),
- MakeInstructionMessage(SpvOpBranch, 0, 0, {{SPV_OPERAND_TYPE_ID, {21}}}),
- MakeInstructionMessage(SpvOpLabel, 0, 23, {}),
- MakeInstructionMessage(SpvOpLoad, 8, 39, {{SPV_OPERAND_TYPE_ID, {17}}}),
- MakeInstructionMessage(SpvOpReturnValue, 0, 0,
+ MakeInstructionMessage(spv::Op::OpBranch, 0, 0,
+ {{SPV_OPERAND_TYPE_ID, {21}}}),
+ MakeInstructionMessage(spv::Op::OpLabel, 0, 23, {}),
+ MakeInstructionMessage(spv::Op::OpLoad, 8, 39,
+ {{SPV_OPERAND_TYPE_ID, {17}}}),
+ MakeInstructionMessage(spv::Op::OpReturnValue, 0, 0,
{{SPV_OPERAND_TYPE_ID, {39}}}),
- MakeInstructionMessage(SpvOpFunctionEnd, 0, 0, {})}));
+ MakeInstructionMessage(spv::Op::OpFunctionEnd, 0, 0, {})}));
ASSERT_TRUE(
transformation1.IsApplicable(context.get(), transformation_context));
@@ -299,51 +310,51 @@ TEST(TransformationAddFunctionTest, BasicTest) {
ASSERT_TRUE(transformation_context.GetFactManager()->BlockIsDead(25));
TransformationAddFunction transformation2(std::vector<protobufs::Instruction>(
- {MakeInstructionMessage(
- SpvOpFunction, 2, 15,
- {{SPV_OPERAND_TYPE_FUNCTION_CONTROL, {SpvFunctionControlMaskNone}},
- {SPV_OPERAND_TYPE_ID, {3}}}),
- MakeInstructionMessage(SpvOpLabel, 0, 16, {}),
- MakeInstructionMessage(
- SpvOpVariable, 7, 44,
- {{SPV_OPERAND_TYPE_STORAGE_CLASS, {SpvStorageClassFunction}}}),
- MakeInstructionMessage(
- SpvOpVariable, 9, 45,
- {{SPV_OPERAND_TYPE_STORAGE_CLASS, {SpvStorageClassFunction}}}),
- MakeInstructionMessage(
- SpvOpVariable, 7, 48,
- {{SPV_OPERAND_TYPE_STORAGE_CLASS, {SpvStorageClassFunction}}}),
- MakeInstructionMessage(
- SpvOpVariable, 9, 49,
- {{SPV_OPERAND_TYPE_STORAGE_CLASS, {SpvStorageClassFunction}}}),
+ {MakeInstructionMessage(spv::Op::OpFunction, 2, 15,
+ {{SPV_OPERAND_TYPE_FUNCTION_CONTROL,
+ {uint32_t(spv::FunctionControlMask::MaskNone)}},
+ {SPV_OPERAND_TYPE_ID, {3}}}),
+ MakeInstructionMessage(spv::Op::OpLabel, 0, 16, {}),
+ MakeInstructionMessage(spv::Op::OpVariable, 7, 44,
+ {{SPV_OPERAND_TYPE_STORAGE_CLASS,
+ {uint32_t(spv::StorageClass::Function)}}}),
+ MakeInstructionMessage(spv::Op::OpVariable, 9, 45,
+ {{SPV_OPERAND_TYPE_STORAGE_CLASS,
+ {uint32_t(spv::StorageClass::Function)}}}),
+ MakeInstructionMessage(spv::Op::OpVariable, 7, 48,
+ {{SPV_OPERAND_TYPE_STORAGE_CLASS,
+ {uint32_t(spv::StorageClass::Function)}}}),
+ MakeInstructionMessage(spv::Op::OpVariable, 9, 49,
+ {{SPV_OPERAND_TYPE_STORAGE_CLASS,
+ {uint32_t(spv::StorageClass::Function)}}}),
MakeInstructionMessage(
- SpvOpStore, 0, 0,
+ spv::Op::OpStore, 0, 0,
{{SPV_OPERAND_TYPE_ID, {44}}, {SPV_OPERAND_TYPE_ID, {20}}}),
MakeInstructionMessage(
- SpvOpStore, 0, 0,
+ spv::Op::OpStore, 0, 0,
{{SPV_OPERAND_TYPE_ID, {45}}, {SPV_OPERAND_TYPE_ID, {18}}}),
- MakeInstructionMessage(SpvOpFunctionCall, 8, 46,
+ MakeInstructionMessage(spv::Op::OpFunctionCall, 8, 46,
{{SPV_OPERAND_TYPE_ID, {13}},
{SPV_OPERAND_TYPE_ID, {44}},
{SPV_OPERAND_TYPE_ID, {45}}}),
MakeInstructionMessage(
- SpvOpStore, 0, 0,
+ spv::Op::OpStore, 0, 0,
{{SPV_OPERAND_TYPE_ID, {48}}, {SPV_OPERAND_TYPE_ID, {37}}}),
MakeInstructionMessage(
- SpvOpStore, 0, 0,
+ spv::Op::OpStore, 0, 0,
{{SPV_OPERAND_TYPE_ID, {49}}, {SPV_OPERAND_TYPE_ID, {47}}}),
- MakeInstructionMessage(SpvOpFunctionCall, 8, 50,
+ MakeInstructionMessage(spv::Op::OpFunctionCall, 8, 50,
{{SPV_OPERAND_TYPE_ID, {13}},
{SPV_OPERAND_TYPE_ID, {48}},
{SPV_OPERAND_TYPE_ID, {49}}}),
MakeInstructionMessage(
- SpvOpFAdd, 8, 51,
+ spv::Op::OpFAdd, 8, 51,
{{SPV_OPERAND_TYPE_ID, {46}}, {SPV_OPERAND_TYPE_ID, {50}}}),
MakeInstructionMessage(
- SpvOpStore, 0, 0,
+ spv::Op::OpStore, 0, 0,
{{SPV_OPERAND_TYPE_ID, {43}}, {SPV_OPERAND_TYPE_ID, {51}}}),
- MakeInstructionMessage(SpvOpReturn, 0, 0, {}),
- MakeInstructionMessage(SpvOpFunctionEnd, 0, 0, {})}));
+ MakeInstructionMessage(spv::Op::OpReturn, 0, 0, {}),
+ MakeInstructionMessage(spv::Op::OpFunctionEnd, 0, 0, {})}));
ASSERT_TRUE(
transformation2.IsApplicable(context.get(), transformation_context));
@@ -513,45 +524,46 @@ TEST(TransformationAddFunctionTest, InapplicableTransformations) {
ASSERT_FALSE(
TransformationAddFunction(
std::vector<protobufs::Instruction>(
- {MakeInstructionMessage(SpvOpFunctionParameter, 7, 11, {}),
- MakeInstructionMessage(SpvOpFunctionParameter, 9, 12, {}),
- MakeInstructionMessage(SpvOpLabel, 0, 14, {})}))
+ {MakeInstructionMessage(spv::Op::OpFunctionParameter, 7, 11, {}),
+ MakeInstructionMessage(spv::Op::OpFunctionParameter, 9, 12, {}),
+ MakeInstructionMessage(spv::Op::OpLabel, 0, 14, {})}))
.IsApplicable(context.get(), transformation_context));
// No OpLabel
ASSERT_FALSE(
TransformationAddFunction(
std::vector<protobufs::Instruction>(
- {MakeInstructionMessage(SpvOpFunction, 8, 13,
- {{SPV_OPERAND_TYPE_FUNCTION_CONTROL,
- {SpvFunctionControlMaskNone}},
- {SPV_OPERAND_TYPE_ID, {10}}}),
- MakeInstructionMessage(SpvOpReturnValue, 0, 0,
+ {MakeInstructionMessage(
+ spv::Op::OpFunction, 8, 13,
+ {{SPV_OPERAND_TYPE_FUNCTION_CONTROL,
+ {uint32_t(spv::FunctionControlMask::MaskNone)}},
+ {SPV_OPERAND_TYPE_ID, {10}}}),
+ MakeInstructionMessage(spv::Op::OpReturnValue, 0, 0,
{{SPV_OPERAND_TYPE_ID, {39}}}),
- MakeInstructionMessage(SpvOpFunctionEnd, 0, 0, {})}))
+ MakeInstructionMessage(spv::Op::OpFunctionEnd, 0, 0, {})}))
.IsApplicable(context.get(), transformation_context));
// Abrupt end of instructions
ASSERT_FALSE(TransformationAddFunction(
std::vector<protobufs::Instruction>({MakeInstructionMessage(
- SpvOpFunction, 8, 13,
+ spv::Op::OpFunction, 8, 13,
{{SPV_OPERAND_TYPE_FUNCTION_CONTROL,
- {SpvFunctionControlMaskNone}},
+ {uint32_t(spv::FunctionControlMask::MaskNone)}},
{SPV_OPERAND_TYPE_ID, {10}}})}))
.IsApplicable(context.get(), transformation_context));
// No function end
- ASSERT_FALSE(
- TransformationAddFunction(
- std::vector<protobufs::Instruction>(
- {MakeInstructionMessage(SpvOpFunction, 8, 13,
- {{SPV_OPERAND_TYPE_FUNCTION_CONTROL,
- {SpvFunctionControlMaskNone}},
- {SPV_OPERAND_TYPE_ID, {10}}}),
- MakeInstructionMessage(SpvOpLabel, 0, 14, {}),
- MakeInstructionMessage(SpvOpReturnValue, 0, 0,
- {{SPV_OPERAND_TYPE_ID, {39}}})}))
- .IsApplicable(context.get(), transformation_context));
+ ASSERT_FALSE(TransformationAddFunction(
+ std::vector<protobufs::Instruction>(
+ {MakeInstructionMessage(
+ spv::Op::OpFunction, 8, 13,
+ {{SPV_OPERAND_TYPE_FUNCTION_CONTROL,
+ {uint32_t(spv::FunctionControlMask::MaskNone)}},
+ {SPV_OPERAND_TYPE_ID, {10}}}),
+ MakeInstructionMessage(spv::Op::OpLabel, 0, 14, {}),
+ MakeInstructionMessage(spv::Op::OpReturnValue, 0, 0,
+ {{SPV_OPERAND_TYPE_ID, {39}}})}))
+ .IsApplicable(context.get(), transformation_context));
}
TEST(TransformationAddFunctionTest, LoopLimiters) {
@@ -581,61 +593,69 @@ TEST(TransformationAddFunctionTest, LoopLimiters) {
const auto consumer = nullptr;
std::vector<protobufs::Instruction> instructions;
- instructions.push_back(MakeInstructionMessage(
- SpvOpFunction, 2, 30,
- {{SPV_OPERAND_TYPE_FUNCTION_CONTROL, {SpvFunctionControlMaskNone}},
- {SPV_OPERAND_TYPE_TYPE_ID, {3}}}));
- instructions.push_back(MakeInstructionMessage(SpvOpLabel, 0, 31, {}));
instructions.push_back(
- MakeInstructionMessage(SpvOpBranch, 0, 0, {{SPV_OPERAND_TYPE_ID, {20}}}));
- instructions.push_back(MakeInstructionMessage(SpvOpLabel, 0, 20, {}));
- instructions.push_back(MakeInstructionMessage(
- SpvOpLoopMerge, 0, 0,
- {{SPV_OPERAND_TYPE_ID, {21}},
- {SPV_OPERAND_TYPE_ID, {22}},
- {SPV_OPERAND_TYPE_LOOP_CONTROL, {SpvLoopControlMaskNone}}}));
- instructions.push_back(MakeInstructionMessage(SpvOpBranchConditional, 0, 0,
+ MakeInstructionMessage(spv::Op::OpFunction, 2, 30,
+ {{SPV_OPERAND_TYPE_FUNCTION_CONTROL,
+ {uint32_t(spv::FunctionControlMask::MaskNone)}},
+ {SPV_OPERAND_TYPE_TYPE_ID, {3}}}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpLabel, 0, 31, {}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpBranch, 0, 0,
+ {{SPV_OPERAND_TYPE_ID, {20}}}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpLabel, 0, 20, {}));
+ instructions.push_back(
+ MakeInstructionMessage(spv::Op::OpLoopMerge, 0, 0,
+ {{SPV_OPERAND_TYPE_ID, {21}},
+ {SPV_OPERAND_TYPE_ID, {22}},
+ {SPV_OPERAND_TYPE_LOOP_CONTROL,
+ {uint32_t(spv::LoopControlMask::MaskNone)}}}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpBranchConditional, 0,
+ 0,
{{SPV_OPERAND_TYPE_ID, {12}},
{SPV_OPERAND_TYPE_ID, {23}},
{SPV_OPERAND_TYPE_ID, {21}}}));
- instructions.push_back(MakeInstructionMessage(SpvOpLabel, 0, 23, {}));
- instructions.push_back(MakeInstructionMessage(
- SpvOpLoopMerge, 0, 0,
- {{SPV_OPERAND_TYPE_ID, {25}},
- {SPV_OPERAND_TYPE_ID, {26}},
- {SPV_OPERAND_TYPE_LOOP_CONTROL, {SpvLoopControlMaskNone}}}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpLabel, 0, 23, {}));
instructions.push_back(
- MakeInstructionMessage(SpvOpBranch, 0, 0, {{SPV_OPERAND_TYPE_ID, {28}}}));
- instructions.push_back(MakeInstructionMessage(SpvOpLabel, 0, 28, {}));
- instructions.push_back(MakeInstructionMessage(SpvOpBranchConditional, 0, 0,
+ MakeInstructionMessage(spv::Op::OpLoopMerge, 0, 0,
+ {{SPV_OPERAND_TYPE_ID, {25}},
+ {SPV_OPERAND_TYPE_ID, {26}},
+ {SPV_OPERAND_TYPE_LOOP_CONTROL,
+ {uint32_t(spv::LoopControlMask::MaskNone)}}}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpBranch, 0, 0,
+ {{SPV_OPERAND_TYPE_ID, {28}}}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpLabel, 0, 28, {}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpBranchConditional, 0,
+ 0,
{{SPV_OPERAND_TYPE_ID, {12}},
{SPV_OPERAND_TYPE_ID, {26}},
{SPV_OPERAND_TYPE_ID, {25}}}));
- instructions.push_back(MakeInstructionMessage(SpvOpLabel, 0, 26, {}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpLabel, 0, 26, {}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpBranch, 0, 0,
+ {{SPV_OPERAND_TYPE_ID, {23}}}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpLabel, 0, 25, {}));
instructions.push_back(
- MakeInstructionMessage(SpvOpBranch, 0, 0, {{SPV_OPERAND_TYPE_ID, {23}}}));
- instructions.push_back(MakeInstructionMessage(SpvOpLabel, 0, 25, {}));
- instructions.push_back(MakeInstructionMessage(
- SpvOpLoopMerge, 0, 0,
- {{SPV_OPERAND_TYPE_ID, {24}},
- {SPV_OPERAND_TYPE_ID, {27}},
- {SPV_OPERAND_TYPE_LOOP_CONTROL, {SpvLoopControlMaskNone}}}));
- instructions.push_back(MakeInstructionMessage(SpvOpBranchConditional, 0, 0,
+ MakeInstructionMessage(spv::Op::OpLoopMerge, 0, 0,
+ {{SPV_OPERAND_TYPE_ID, {24}},
+ {SPV_OPERAND_TYPE_ID, {27}},
+ {SPV_OPERAND_TYPE_LOOP_CONTROL,
+ {uint32_t(spv::LoopControlMask::MaskNone)}}}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpBranchConditional, 0,
+ 0,
{{SPV_OPERAND_TYPE_ID, {12}},
{SPV_OPERAND_TYPE_ID, {24}},
{SPV_OPERAND_TYPE_ID, {27}}}));
- instructions.push_back(MakeInstructionMessage(SpvOpLabel, 0, 27, {}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpLabel, 0, 27, {}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpBranch, 0, 0,
+ {{SPV_OPERAND_TYPE_ID, {25}}}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpLabel, 0, 24, {}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpBranch, 0, 0,
+ {{SPV_OPERAND_TYPE_ID, {22}}}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpLabel, 0, 22, {}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpBranch, 0, 0,
+ {{SPV_OPERAND_TYPE_ID, {20}}}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpLabel, 0, 21, {}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpReturn, 0, 0, {}));
instructions.push_back(
- MakeInstructionMessage(SpvOpBranch, 0, 0, {{SPV_OPERAND_TYPE_ID, {25}}}));
- instructions.push_back(MakeInstructionMessage(SpvOpLabel, 0, 24, {}));
- instructions.push_back(
- MakeInstructionMessage(SpvOpBranch, 0, 0, {{SPV_OPERAND_TYPE_ID, {22}}}));
- instructions.push_back(MakeInstructionMessage(SpvOpLabel, 0, 22, {}));
- instructions.push_back(
- MakeInstructionMessage(SpvOpBranch, 0, 0, {{SPV_OPERAND_TYPE_ID, {20}}}));
- instructions.push_back(MakeInstructionMessage(SpvOpLabel, 0, 21, {}));
- instructions.push_back(MakeInstructionMessage(SpvOpReturn, 0, 0, {}));
- instructions.push_back(MakeInstructionMessage(SpvOpFunctionEnd, 0, 0, {}));
+ MakeInstructionMessage(spv::Op::OpFunctionEnd, 0, 0, {}));
spvtools::ValidatorOptions validator_options;
@@ -837,31 +857,36 @@ TEST(TransformationAddFunctionTest, KillAndUnreachableInVoidFunction) {
std::vector<protobufs::Instruction> instructions;
- instructions.push_back(MakeInstructionMessage(
- SpvOpFunction, 2, 10,
- {{SPV_OPERAND_TYPE_FUNCTION_CONTROL, {SpvFunctionControlMaskNone}},
- {SPV_OPERAND_TYPE_TYPE_ID, {8}}}));
instructions.push_back(
- MakeInstructionMessage(SpvOpFunctionParameter, 7, 9, {}));
- instructions.push_back(MakeInstructionMessage(SpvOpLabel, 0, 11, {}));
+ MakeInstructionMessage(spv::Op::OpFunction, 2, 10,
+ {{SPV_OPERAND_TYPE_FUNCTION_CONTROL,
+ {uint32_t(spv::FunctionControlMask::MaskNone)}},
+ {SPV_OPERAND_TYPE_TYPE_ID, {8}}}));
instructions.push_back(
- MakeInstructionMessage(SpvOpLoad, 6, 12, {{SPV_OPERAND_TYPE_ID, {9}}}));
+ MakeInstructionMessage(spv::Op::OpFunctionParameter, 7, 9, {}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpLabel, 0, 11, {}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpLoad, 6, 12,
+ {{SPV_OPERAND_TYPE_ID, {9}}}));
instructions.push_back(MakeInstructionMessage(
- SpvOpIEqual, 14, 15,
+ spv::Op::OpIEqual, 14, 15,
{{SPV_OPERAND_TYPE_ID, {12}}, {SPV_OPERAND_TYPE_ID, {13}}}));
instructions.push_back(MakeInstructionMessage(
- SpvOpSelectionMerge, 0, 0,
+ spv::Op::OpSelectionMerge, 0, 0,
{{SPV_OPERAND_TYPE_ID, {17}},
- {SPV_OPERAND_TYPE_SELECTION_CONTROL, {SpvSelectionControlMaskNone}}}));
- instructions.push_back(MakeInstructionMessage(SpvOpBranchConditional, 0, 0,
+ {SPV_OPERAND_TYPE_SELECTION_CONTROL,
+ {uint32_t(spv::SelectionControlMask::MaskNone)}}}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpBranchConditional, 0,
+ 0,
{{SPV_OPERAND_TYPE_ID, {15}},
{SPV_OPERAND_TYPE_ID, {16}},
{SPV_OPERAND_TYPE_ID, {17}}}));
- instructions.push_back(MakeInstructionMessage(SpvOpLabel, 0, 16, {}));
- instructions.push_back(MakeInstructionMessage(SpvOpUnreachable, 0, 0, {}));
- instructions.push_back(MakeInstructionMessage(SpvOpLabel, 0, 17, {}));
- instructions.push_back(MakeInstructionMessage(SpvOpKill, 0, 0, {}));
- instructions.push_back(MakeInstructionMessage(SpvOpFunctionEnd, 0, 0, {}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpLabel, 0, 16, {}));
+ instructions.push_back(
+ MakeInstructionMessage(spv::Op::OpUnreachable, 0, 0, {}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpLabel, 0, 17, {}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpKill, 0, 0, {}));
+ instructions.push_back(
+ MakeInstructionMessage(spv::Op::OpFunctionEnd, 0, 0, {}));
spvtools::ValidatorOptions validator_options;
@@ -996,31 +1021,36 @@ TEST(TransformationAddFunctionTest, KillAndUnreachableInNonVoidFunction) {
std::vector<protobufs::Instruction> instructions;
- instructions.push_back(MakeInstructionMessage(
- SpvOpFunction, 6, 10,
- {{SPV_OPERAND_TYPE_FUNCTION_CONTROL, {SpvFunctionControlMaskNone}},
- {SPV_OPERAND_TYPE_TYPE_ID, {50}}}));
instructions.push_back(
- MakeInstructionMessage(SpvOpFunctionParameter, 7, 9, {}));
- instructions.push_back(MakeInstructionMessage(SpvOpLabel, 0, 11, {}));
+ MakeInstructionMessage(spv::Op::OpFunction, 6, 10,
+ {{SPV_OPERAND_TYPE_FUNCTION_CONTROL,
+ {uint32_t(spv::FunctionControlMask::MaskNone)}},
+ {SPV_OPERAND_TYPE_TYPE_ID, {50}}}));
instructions.push_back(
- MakeInstructionMessage(SpvOpLoad, 6, 12, {{SPV_OPERAND_TYPE_ID, {9}}}));
+ MakeInstructionMessage(spv::Op::OpFunctionParameter, 7, 9, {}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpLabel, 0, 11, {}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpLoad, 6, 12,
+ {{SPV_OPERAND_TYPE_ID, {9}}}));
instructions.push_back(MakeInstructionMessage(
- SpvOpIEqual, 14, 15,
+ spv::Op::OpIEqual, 14, 15,
{{SPV_OPERAND_TYPE_ID, {12}}, {SPV_OPERAND_TYPE_ID, {13}}}));
instructions.push_back(MakeInstructionMessage(
- SpvOpSelectionMerge, 0, 0,
+ spv::Op::OpSelectionMerge, 0, 0,
{{SPV_OPERAND_TYPE_ID, {17}},
- {SPV_OPERAND_TYPE_SELECTION_CONTROL, {SpvSelectionControlMaskNone}}}));
- instructions.push_back(MakeInstructionMessage(SpvOpBranchConditional, 0, 0,
+ {SPV_OPERAND_TYPE_SELECTION_CONTROL,
+ {uint32_t(spv::SelectionControlMask::MaskNone)}}}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpBranchConditional, 0,
+ 0,
{{SPV_OPERAND_TYPE_ID, {15}},
{SPV_OPERAND_TYPE_ID, {16}},
{SPV_OPERAND_TYPE_ID, {17}}}));
- instructions.push_back(MakeInstructionMessage(SpvOpLabel, 0, 16, {}));
- instructions.push_back(MakeInstructionMessage(SpvOpUnreachable, 0, 0, {}));
- instructions.push_back(MakeInstructionMessage(SpvOpLabel, 0, 17, {}));
- instructions.push_back(MakeInstructionMessage(SpvOpKill, 0, 0, {}));
- instructions.push_back(MakeInstructionMessage(SpvOpFunctionEnd, 0, 0, {}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpLabel, 0, 16, {}));
+ instructions.push_back(
+ MakeInstructionMessage(spv::Op::OpUnreachable, 0, 0, {}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpLabel, 0, 17, {}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpKill, 0, 0, {}));
+ instructions.push_back(
+ MakeInstructionMessage(spv::Op::OpFunctionEnd, 0, 0, {}));
spvtools::ValidatorOptions validator_options;
@@ -1189,129 +1219,133 @@ TEST(TransformationAddFunctionTest, ClampedAccessChains) {
std::vector<protobufs::Instruction> instructions;
- instructions.push_back(MakeInstructionMessage(
- SpvOpFunction, 2, 12,
- {{SPV_OPERAND_TYPE_FUNCTION_CONTROL, {SpvFunctionControlMaskNone}},
- {SPV_OPERAND_TYPE_TYPE_ID, {8}}}));
instructions.push_back(
- MakeInstructionMessage(SpvOpFunctionParameter, 7, 9, {}));
+ MakeInstructionMessage(spv::Op::OpFunction, 2, 12,
+ {{SPV_OPERAND_TYPE_FUNCTION_CONTROL,
+ {uint32_t(spv::FunctionControlMask::MaskNone)}},
+ {SPV_OPERAND_TYPE_TYPE_ID, {8}}}));
instructions.push_back(
- MakeInstructionMessage(SpvOpFunctionParameter, 102, 10, {}));
+ MakeInstructionMessage(spv::Op::OpFunctionParameter, 7, 9, {}));
instructions.push_back(
- MakeInstructionMessage(SpvOpFunctionParameter, 7, 11, {}));
- instructions.push_back(MakeInstructionMessage(SpvOpLabel, 0, 13, {}));
+ MakeInstructionMessage(spv::Op::OpFunctionParameter, 102, 10, {}));
+ instructions.push_back(
+ MakeInstructionMessage(spv::Op::OpFunctionParameter, 7, 11, {}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpLabel, 0, 13, {}));
- instructions.push_back(MakeInstructionMessage(
- SpvOpVariable, 7, 14,
- {{SPV_OPERAND_TYPE_STORAGE_CLASS, {SpvStorageClassFunction}}}));
- instructions.push_back(MakeInstructionMessage(
- SpvOpVariable, 26, 27,
- {{SPV_OPERAND_TYPE_STORAGE_CLASS, {SpvStorageClassFunction}}}));
instructions.push_back(
- MakeInstructionMessage(SpvOpLoad, 6, 22, {{SPV_OPERAND_TYPE_ID, {11}}}));
- instructions.push_back(MakeInstructionMessage(SpvOpAccessChain, 23, 24,
+ MakeInstructionMessage(spv::Op::OpVariable, 7, 14,
+ {{SPV_OPERAND_TYPE_STORAGE_CLASS,
+ {uint32_t(spv::StorageClass::Function)}}}));
+ instructions.push_back(
+ MakeInstructionMessage(spv::Op::OpVariable, 26, 27,
+ {{SPV_OPERAND_TYPE_STORAGE_CLASS,
+ {uint32_t(spv::StorageClass::Function)}}}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpLoad, 6, 22,
+ {{SPV_OPERAND_TYPE_ID, {11}}}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpAccessChain, 23, 24,
{{SPV_OPERAND_TYPE_ID, {20}},
{SPV_OPERAND_TYPE_ID, {21}},
{SPV_OPERAND_TYPE_ID, {22}}}));
- instructions.push_back(
- MakeInstructionMessage(SpvOpLoad, 6, 25, {{SPV_OPERAND_TYPE_ID, {24}}}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpLoad, 6, 25,
+ {{SPV_OPERAND_TYPE_ID, {24}}}));
instructions.push_back(MakeInstructionMessage(
- SpvOpStore, 0, 0,
+ spv::Op::OpStore, 0, 0,
{{SPV_OPERAND_TYPE_ID, {14}}, {SPV_OPERAND_TYPE_ID, {25}}}));
- instructions.push_back(
- MakeInstructionMessage(SpvOpLoad, 15, 28, {{SPV_OPERAND_TYPE_ID, {10}}}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpLoad, 15, 28,
+ {{SPV_OPERAND_TYPE_ID, {10}}}));
instructions.push_back(MakeInstructionMessage(
- SpvOpAccessChain, 29, 30,
+ spv::Op::OpAccessChain, 29, 30,
{{SPV_OPERAND_TYPE_ID, {20}}, {SPV_OPERAND_TYPE_ID, {28}}}));
- instructions.push_back(
- MakeInstructionMessage(SpvOpLoad, 17, 31, {{SPV_OPERAND_TYPE_ID, {30}}}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpLoad, 17, 31,
+ {{SPV_OPERAND_TYPE_ID, {30}}}));
instructions.push_back(MakeInstructionMessage(
- SpvOpStore, 0, 0,
+ spv::Op::OpStore, 0, 0,
{{SPV_OPERAND_TYPE_ID, {27}}, {SPV_OPERAND_TYPE_ID, {31}}}));
- instructions.push_back(
- MakeInstructionMessage(SpvOpLoad, 6, 32, {{SPV_OPERAND_TYPE_ID, {9}}}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpLoad, 6, 32,
+ {{SPV_OPERAND_TYPE_ID, {9}}}));
instructions.push_back(MakeInstructionMessage(
- SpvOpInBoundsAccessChain, 7, 34,
+ spv::Op::OpInBoundsAccessChain, 7, 34,
{{SPV_OPERAND_TYPE_ID, {27}}, {SPV_OPERAND_TYPE_ID, {32}}}));
instructions.push_back(MakeInstructionMessage(
- SpvOpStore, 0, 0,
+ spv::Op::OpStore, 0, 0,
{{SPV_OPERAND_TYPE_ID, {34}}, {SPV_OPERAND_TYPE_ID, {33}}}));
- instructions.push_back(
- MakeInstructionMessage(SpvOpLoad, 6, 39, {{SPV_OPERAND_TYPE_ID, {9}}}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpLoad, 6, 39,
+ {{SPV_OPERAND_TYPE_ID, {9}}}));
instructions.push_back(MakeInstructionMessage(
- SpvOpAccessChain, 23, 40,
+ spv::Op::OpAccessChain, 23, 40,
{{SPV_OPERAND_TYPE_ID, {38}}, {SPV_OPERAND_TYPE_ID, {33}}}));
- instructions.push_back(
- MakeInstructionMessage(SpvOpLoad, 6, 41, {{SPV_OPERAND_TYPE_ID, {40}}}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpLoad, 6, 41,
+ {{SPV_OPERAND_TYPE_ID, {40}}}));
instructions.push_back(MakeInstructionMessage(
- SpvOpInBoundsAccessChain, 23, 42,
+ spv::Op::OpInBoundsAccessChain, 23, 42,
{{SPV_OPERAND_TYPE_ID, {38}}, {SPV_OPERAND_TYPE_ID, {39}}}));
instructions.push_back(MakeInstructionMessage(
- SpvOpStore, 0, 0,
+ spv::Op::OpStore, 0, 0,
{{SPV_OPERAND_TYPE_ID, {42}}, {SPV_OPERAND_TYPE_ID, {41}}}));
- instructions.push_back(
- MakeInstructionMessage(SpvOpLoad, 15, 43, {{SPV_OPERAND_TYPE_ID, {10}}}));
- instructions.push_back(
- MakeInstructionMessage(SpvOpLoad, 6, 44, {{SPV_OPERAND_TYPE_ID, {11}}}));
- instructions.push_back(
- MakeInstructionMessage(SpvOpLoad, 6, 45, {{SPV_OPERAND_TYPE_ID, {9}}}));
- instructions.push_back(
- MakeInstructionMessage(SpvOpLoad, 15, 46, {{SPV_OPERAND_TYPE_ID, {10}}}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpLoad, 15, 43,
+ {{SPV_OPERAND_TYPE_ID, {10}}}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpLoad, 6, 44,
+ {{SPV_OPERAND_TYPE_ID, {11}}}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpLoad, 6, 45,
+ {{SPV_OPERAND_TYPE_ID, {9}}}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpLoad, 15, 46,
+ {{SPV_OPERAND_TYPE_ID, {10}}}));
instructions.push_back(MakeInstructionMessage(
- SpvOpIAdd, 6, 47,
+ spv::Op::OpIAdd, 6, 47,
{{SPV_OPERAND_TYPE_ID, {45}}, {SPV_OPERAND_TYPE_ID, {46}}}));
instructions.push_back(MakeInstructionMessage(
- SpvOpAccessChain, 23, 48,
+ spv::Op::OpAccessChain, 23, 48,
{{SPV_OPERAND_TYPE_ID, {38}}, {SPV_OPERAND_TYPE_ID, {47}}}));
- instructions.push_back(
- MakeInstructionMessage(SpvOpLoad, 6, 49, {{SPV_OPERAND_TYPE_ID, {48}}}));
- instructions.push_back(MakeInstructionMessage(SpvOpInBoundsAccessChain, 23,
- 50,
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpLoad, 6, 49,
+ {{SPV_OPERAND_TYPE_ID, {48}}}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpInBoundsAccessChain,
+ 23, 50,
{{SPV_OPERAND_TYPE_ID, {20}},
{SPV_OPERAND_TYPE_ID, {43}},
{SPV_OPERAND_TYPE_ID, {44}}}));
- instructions.push_back(
- MakeInstructionMessage(SpvOpLoad, 6, 51, {{SPV_OPERAND_TYPE_ID, {50}}}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpLoad, 6, 51,
+ {{SPV_OPERAND_TYPE_ID, {50}}}));
instructions.push_back(MakeInstructionMessage(
- SpvOpIAdd, 6, 52,
+ spv::Op::OpIAdd, 6, 52,
{{SPV_OPERAND_TYPE_ID, {51}}, {SPV_OPERAND_TYPE_ID, {49}}}));
- instructions.push_back(MakeInstructionMessage(SpvOpAccessChain, 23, 53,
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpAccessChain, 23, 53,
{{SPV_OPERAND_TYPE_ID, {20}},
{SPV_OPERAND_TYPE_ID, {43}},
{SPV_OPERAND_TYPE_ID, {44}}}));
instructions.push_back(MakeInstructionMessage(
- SpvOpStore, 0, 0,
+ spv::Op::OpStore, 0, 0,
{{SPV_OPERAND_TYPE_ID, {53}}, {SPV_OPERAND_TYPE_ID, {52}}}));
- instructions.push_back(
- MakeInstructionMessage(SpvOpLoad, 15, 58, {{SPV_OPERAND_TYPE_ID, {10}}}));
- instructions.push_back(
- MakeInstructionMessage(SpvOpLoad, 6, 63, {{SPV_OPERAND_TYPE_ID, {11}}}));
- instructions.push_back(MakeInstructionMessage(SpvOpAccessChain, 64, 65,
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpLoad, 15, 58,
+ {{SPV_OPERAND_TYPE_ID, {10}}}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpLoad, 6, 63,
+ {{SPV_OPERAND_TYPE_ID, {11}}}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpAccessChain, 64, 65,
{{SPV_OPERAND_TYPE_ID, {62}},
{SPV_OPERAND_TYPE_ID, {21}},
{SPV_OPERAND_TYPE_ID, {63}}}));
- instructions.push_back(MakeInstructionMessage(SpvOpAccessChain, 64, 101,
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpAccessChain, 64, 101,
{{SPV_OPERAND_TYPE_ID, {62}},
{SPV_OPERAND_TYPE_ID, {45}},
{SPV_OPERAND_TYPE_ID, {46}}}));
- instructions.push_back(
- MakeInstructionMessage(SpvOpLoad, 54, 66, {{SPV_OPERAND_TYPE_ID, {65}}}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpLoad, 54, 66,
+ {{SPV_OPERAND_TYPE_ID, {65}}}));
instructions.push_back(MakeInstructionMessage(
- SpvOpAccessChain, 64, 67,
+ spv::Op::OpAccessChain, 64, 67,
{{SPV_OPERAND_TYPE_ID, {57}}, {SPV_OPERAND_TYPE_ID, {58}}}));
instructions.push_back(MakeInstructionMessage(
- SpvOpStore, 0, 0,
+ spv::Op::OpStore, 0, 0,
{{SPV_OPERAND_TYPE_ID, {67}}, {SPV_OPERAND_TYPE_ID, {66}}}));
- instructions.push_back(
- MakeInstructionMessage(SpvOpLoad, 6, 68, {{SPV_OPERAND_TYPE_ID, {9}}}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpLoad, 6, 68,
+ {{SPV_OPERAND_TYPE_ID, {9}}}));
instructions.push_back(MakeInstructionMessage(
- SpvOpInBoundsAccessChain, 64, 70,
+ spv::Op::OpInBoundsAccessChain, 64, 70,
{{SPV_OPERAND_TYPE_ID, {57}}, {SPV_OPERAND_TYPE_ID, {68}}}));
instructions.push_back(MakeInstructionMessage(
- SpvOpStore, 0, 0,
+ spv::Op::OpStore, 0, 0,
{{SPV_OPERAND_TYPE_ID, {70}}, {SPV_OPERAND_TYPE_ID, {69}}}));
- instructions.push_back(MakeInstructionMessage(SpvOpReturn, 0, 0, {}));
- instructions.push_back(MakeInstructionMessage(SpvOpFunctionEnd, 0, 0, {}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpReturn, 0, 0, {}));
+ instructions.push_back(
+ MakeInstructionMessage(spv::Op::OpFunctionEnd, 0, 0, {}));
spvtools::ValidatorOptions validator_options;
@@ -1634,15 +1668,17 @@ TEST(TransformationAddFunctionTest, LivesafeCanCallLivesafe) {
std::vector<protobufs::Instruction> instructions;
- instructions.push_back(MakeInstructionMessage(
- SpvOpFunction, 2, 8,
- {{SPV_OPERAND_TYPE_FUNCTION_CONTROL, {SpvFunctionControlMaskNone}},
- {SPV_OPERAND_TYPE_TYPE_ID, {3}}}));
- instructions.push_back(MakeInstructionMessage(SpvOpLabel, 0, 9, {}));
- instructions.push_back(MakeInstructionMessage(SpvOpFunctionCall, 2, 11,
+ instructions.push_back(
+ MakeInstructionMessage(spv::Op::OpFunction, 2, 8,
+ {{SPV_OPERAND_TYPE_FUNCTION_CONTROL,
+ {uint32_t(spv::FunctionControlMask::MaskNone)}},
+ {SPV_OPERAND_TYPE_TYPE_ID, {3}}}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpLabel, 0, 9, {}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpFunctionCall, 2, 11,
{{SPV_OPERAND_TYPE_ID, {6}}}));
- instructions.push_back(MakeInstructionMessage(SpvOpReturn, 0, 0, {}));
- instructions.push_back(MakeInstructionMessage(SpvOpFunctionEnd, 0, 0, {}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpReturn, 0, 0, {}));
+ instructions.push_back(
+ MakeInstructionMessage(spv::Op::OpFunctionEnd, 0, 0, {}));
spvtools::ValidatorOptions validator_options;
@@ -1738,15 +1774,17 @@ TEST(TransformationAddFunctionTest, LivesafeOnlyCallsLivesafe) {
std::vector<protobufs::Instruction> instructions;
- instructions.push_back(MakeInstructionMessage(
- SpvOpFunction, 2, 8,
- {{SPV_OPERAND_TYPE_FUNCTION_CONTROL, {SpvFunctionControlMaskNone}},
- {SPV_OPERAND_TYPE_TYPE_ID, {3}}}));
- instructions.push_back(MakeInstructionMessage(SpvOpLabel, 0, 9, {}));
- instructions.push_back(MakeInstructionMessage(SpvOpFunctionCall, 2, 11,
+ instructions.push_back(
+ MakeInstructionMessage(spv::Op::OpFunction, 2, 8,
+ {{SPV_OPERAND_TYPE_FUNCTION_CONTROL,
+ {uint32_t(spv::FunctionControlMask::MaskNone)}},
+ {SPV_OPERAND_TYPE_TYPE_ID, {3}}}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpLabel, 0, 9, {}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpFunctionCall, 2, 11,
{{SPV_OPERAND_TYPE_ID, {6}}}));
- instructions.push_back(MakeInstructionMessage(SpvOpReturn, 0, 0, {}));
- instructions.push_back(MakeInstructionMessage(SpvOpFunctionEnd, 0, 0, {}));
+ instructions.push_back(MakeInstructionMessage(spv::Op::OpReturn, 0, 0, {}));
+ instructions.push_back(
+ MakeInstructionMessage(spv::Op::OpFunctionEnd, 0, 0, {}));
spvtools::ValidatorOptions validator_options;