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/fuzz/transformation_propagate_instruction_up.cpp')
-rw-r--r--source/fuzz/transformation_propagate_instruction_up.cpp222
1 files changed, 111 insertions, 111 deletions
diff --git a/source/fuzz/transformation_propagate_instruction_up.cpp b/source/fuzz/transformation_propagate_instruction_up.cpp
index bf0e66307..f9674fa9b 100644
--- a/source/fuzz/transformation_propagate_instruction_up.cpp
+++ b/source/fuzz/transformation_propagate_instruction_up.cpp
@@ -23,7 +23,7 @@ namespace {
uint32_t GetResultIdFromLabelId(const opt::Instruction& phi_inst,
uint32_t label_id) {
- assert(phi_inst.opcode() == SpvOpPhi && "|phi_inst| is not an OpPhi");
+ assert(phi_inst.opcode() == spv::Op::OpPhi && "|phi_inst| is not an OpPhi");
for (uint32_t i = 1; i < phi_inst.NumInOperands(); i += 2) {
if (phi_inst.GetSingleWordInOperand(i) == label_id) {
@@ -66,7 +66,7 @@ bool HasValidDependencies(opt::IRContext* ir_context, opt::Instruction* inst) {
assert(dependency && "Operand has invalid id");
if (ir_context->get_instr_block(dependency) == inst_block &&
- dependency->opcode() != SpvOpPhi) {
+ dependency->opcode() != spv::Op::OpPhi) {
// |dependency| is "valid" if it's an OpPhi from the same basic block or
// an instruction from a different basic block.
return false;
@@ -173,7 +173,7 @@ void TransformationPropagateInstructionUp::Apply(
continue;
}
- assert(dependency_inst->opcode() == SpvOpPhi &&
+ assert(dependency_inst->opcode() == spv::Op::OpPhi &&
"Propagated instruction can depend only on OpPhis from the same "
"basic block or instructions from different basic blocks");
@@ -191,7 +191,7 @@ void TransformationPropagateInstructionUp::Apply(
// Insert an OpPhi instruction into the basic block of |inst|.
ir_context->get_instr_block(inst)->begin()->InsertBefore(
- MakeUnique<opt::Instruction>(ir_context, SpvOpPhi, inst->type_id(),
+ MakeUnique<opt::Instruction>(ir_context, spv::Op::OpPhi, inst->type_id(),
inst->result_id(),
std::move(op_phi_operands)));
@@ -210,115 +210,115 @@ protobufs::Transformation TransformationPropagateInstructionUp::ToMessage()
return result;
}
-bool TransformationPropagateInstructionUp::IsOpcodeSupported(SpvOp opcode) {
+bool TransformationPropagateInstructionUp::IsOpcodeSupported(spv::Op opcode) {
// TODO(https://github.com/KhronosGroup/SPIRV-Tools/issues/3605):
// We only support "simple" instructions that don't work with memory.
// We should extend this so that we support the ones that modify the memory
// too.
switch (opcode) {
- case SpvOpUndef:
- case SpvOpAccessChain:
- case SpvOpInBoundsAccessChain:
- case SpvOpArrayLength:
- case SpvOpVectorExtractDynamic:
- case SpvOpVectorInsertDynamic:
- case SpvOpVectorShuffle:
- case SpvOpCompositeConstruct:
- case SpvOpCompositeExtract:
- case SpvOpCompositeInsert:
- case SpvOpCopyObject:
- case SpvOpTranspose:
- case SpvOpConvertFToU:
- case SpvOpConvertFToS:
- case SpvOpConvertSToF:
- case SpvOpConvertUToF:
- case SpvOpUConvert:
- case SpvOpSConvert:
- case SpvOpFConvert:
- case SpvOpQuantizeToF16:
- case SpvOpSatConvertSToU:
- case SpvOpSatConvertUToS:
- case SpvOpBitcast:
- case SpvOpSNegate:
- case SpvOpFNegate:
- case SpvOpIAdd:
- case SpvOpFAdd:
- case SpvOpISub:
- case SpvOpFSub:
- case SpvOpIMul:
- case SpvOpFMul:
- case SpvOpUDiv:
- case SpvOpSDiv:
- case SpvOpFDiv:
- case SpvOpUMod:
- case SpvOpSRem:
- case SpvOpSMod:
- case SpvOpFRem:
- case SpvOpFMod:
- case SpvOpVectorTimesScalar:
- case SpvOpMatrixTimesScalar:
- case SpvOpVectorTimesMatrix:
- case SpvOpMatrixTimesVector:
- case SpvOpMatrixTimesMatrix:
- case SpvOpOuterProduct:
- case SpvOpDot:
- case SpvOpIAddCarry:
- case SpvOpISubBorrow:
- case SpvOpUMulExtended:
- case SpvOpSMulExtended:
- case SpvOpAny:
- case SpvOpAll:
- case SpvOpIsNan:
- case SpvOpIsInf:
- case SpvOpIsFinite:
- case SpvOpIsNormal:
- case SpvOpSignBitSet:
- case SpvOpLessOrGreater:
- case SpvOpOrdered:
- case SpvOpUnordered:
- case SpvOpLogicalEqual:
- case SpvOpLogicalNotEqual:
- case SpvOpLogicalOr:
- case SpvOpLogicalAnd:
- case SpvOpLogicalNot:
- case SpvOpSelect:
- case SpvOpIEqual:
- case SpvOpINotEqual:
- case SpvOpUGreaterThan:
- case SpvOpSGreaterThan:
- case SpvOpUGreaterThanEqual:
- case SpvOpSGreaterThanEqual:
- case SpvOpULessThan:
- case SpvOpSLessThan:
- case SpvOpULessThanEqual:
- case SpvOpSLessThanEqual:
- case SpvOpFOrdEqual:
- case SpvOpFUnordEqual:
- case SpvOpFOrdNotEqual:
- case SpvOpFUnordNotEqual:
- case SpvOpFOrdLessThan:
- case SpvOpFUnordLessThan:
- case SpvOpFOrdGreaterThan:
- case SpvOpFUnordGreaterThan:
- case SpvOpFOrdLessThanEqual:
- case SpvOpFUnordLessThanEqual:
- case SpvOpFOrdGreaterThanEqual:
- case SpvOpFUnordGreaterThanEqual:
- case SpvOpShiftRightLogical:
- case SpvOpShiftRightArithmetic:
- case SpvOpShiftLeftLogical:
- case SpvOpBitwiseOr:
- case SpvOpBitwiseXor:
- case SpvOpBitwiseAnd:
- case SpvOpNot:
- case SpvOpBitFieldInsert:
- case SpvOpBitFieldSExtract:
- case SpvOpBitFieldUExtract:
- case SpvOpBitReverse:
- case SpvOpBitCount:
- case SpvOpCopyLogical:
- case SpvOpPtrEqual:
- case SpvOpPtrNotEqual:
+ case spv::Op::OpUndef:
+ case spv::Op::OpAccessChain:
+ case spv::Op::OpInBoundsAccessChain:
+ case spv::Op::OpArrayLength:
+ case spv::Op::OpVectorExtractDynamic:
+ case spv::Op::OpVectorInsertDynamic:
+ case spv::Op::OpVectorShuffle:
+ case spv::Op::OpCompositeConstruct:
+ case spv::Op::OpCompositeExtract:
+ case spv::Op::OpCompositeInsert:
+ case spv::Op::OpCopyObject:
+ case spv::Op::OpTranspose:
+ case spv::Op::OpConvertFToU:
+ case spv::Op::OpConvertFToS:
+ case spv::Op::OpConvertSToF:
+ case spv::Op::OpConvertUToF:
+ case spv::Op::OpUConvert:
+ case spv::Op::OpSConvert:
+ case spv::Op::OpFConvert:
+ case spv::Op::OpQuantizeToF16:
+ case spv::Op::OpSatConvertSToU:
+ case spv::Op::OpSatConvertUToS:
+ case spv::Op::OpBitcast:
+ case spv::Op::OpSNegate:
+ case spv::Op::OpFNegate:
+ case spv::Op::OpIAdd:
+ case spv::Op::OpFAdd:
+ case spv::Op::OpISub:
+ case spv::Op::OpFSub:
+ case spv::Op::OpIMul:
+ case spv::Op::OpFMul:
+ case spv::Op::OpUDiv:
+ case spv::Op::OpSDiv:
+ case spv::Op::OpFDiv:
+ case spv::Op::OpUMod:
+ case spv::Op::OpSRem:
+ case spv::Op::OpSMod:
+ case spv::Op::OpFRem:
+ case spv::Op::OpFMod:
+ case spv::Op::OpVectorTimesScalar:
+ case spv::Op::OpMatrixTimesScalar:
+ case spv::Op::OpVectorTimesMatrix:
+ case spv::Op::OpMatrixTimesVector:
+ case spv::Op::OpMatrixTimesMatrix:
+ case spv::Op::OpOuterProduct:
+ case spv::Op::OpDot:
+ case spv::Op::OpIAddCarry:
+ case spv::Op::OpISubBorrow:
+ case spv::Op::OpUMulExtended:
+ case spv::Op::OpSMulExtended:
+ case spv::Op::OpAny:
+ case spv::Op::OpAll:
+ case spv::Op::OpIsNan:
+ case spv::Op::OpIsInf:
+ case spv::Op::OpIsFinite:
+ case spv::Op::OpIsNormal:
+ case spv::Op::OpSignBitSet:
+ case spv::Op::OpLessOrGreater:
+ case spv::Op::OpOrdered:
+ case spv::Op::OpUnordered:
+ case spv::Op::OpLogicalEqual:
+ case spv::Op::OpLogicalNotEqual:
+ case spv::Op::OpLogicalOr:
+ case spv::Op::OpLogicalAnd:
+ case spv::Op::OpLogicalNot:
+ case spv::Op::OpSelect:
+ case spv::Op::OpIEqual:
+ case spv::Op::OpINotEqual:
+ case spv::Op::OpUGreaterThan:
+ case spv::Op::OpSGreaterThan:
+ case spv::Op::OpUGreaterThanEqual:
+ case spv::Op::OpSGreaterThanEqual:
+ case spv::Op::OpULessThan:
+ case spv::Op::OpSLessThan:
+ case spv::Op::OpULessThanEqual:
+ case spv::Op::OpSLessThanEqual:
+ case spv::Op::OpFOrdEqual:
+ case spv::Op::OpFUnordEqual:
+ case spv::Op::OpFOrdNotEqual:
+ case spv::Op::OpFUnordNotEqual:
+ case spv::Op::OpFOrdLessThan:
+ case spv::Op::OpFUnordLessThan:
+ case spv::Op::OpFOrdGreaterThan:
+ case spv::Op::OpFUnordGreaterThan:
+ case spv::Op::OpFOrdLessThanEqual:
+ case spv::Op::OpFUnordLessThanEqual:
+ case spv::Op::OpFOrdGreaterThanEqual:
+ case spv::Op::OpFUnordGreaterThanEqual:
+ case spv::Op::OpShiftRightLogical:
+ case spv::Op::OpShiftRightArithmetic:
+ case spv::Op::OpShiftLeftLogical:
+ case spv::Op::OpBitwiseOr:
+ case spv::Op::OpBitwiseXor:
+ case spv::Op::OpBitwiseAnd:
+ case spv::Op::OpNot:
+ case spv::Op::OpBitFieldInsert:
+ case spv::Op::OpBitFieldSExtract:
+ case spv::Op::OpBitFieldUExtract:
+ case spv::Op::OpBitReverse:
+ case spv::Op::OpBitCount:
+ case spv::Op::OpCopyLogical:
+ case spv::Op::OpPtrEqual:
+ case spv::Op::OpPtrNotEqual:
return true;
default:
return false;
@@ -338,7 +338,7 @@ TransformationPropagateInstructionUp::GetInstructionToPropagate(
// - it must be supported by this transformation
// - it may depend only on instructions from different basic blocks or on
// OpPhi instructions from the same basic block.
- if (inst.opcode() == SpvOpPhi || !IsOpcodeSupported(inst.opcode()) ||
+ if (inst.opcode() == spv::Op::OpPhi || !IsOpcodeSupported(inst.opcode()) ||
!inst.type_id() || !inst.result_id()) {
continue;
}
@@ -353,7 +353,7 @@ TransformationPropagateInstructionUp::GetInstructionToPropagate(
}
if (!ir_context->get_feature_mgr()->HasCapability(
- SpvCapabilityVariablePointersStorageBuffer) &&
+ spv::Capability::VariablePointersStorageBuffer) &&
ContainsPointers(*inst_type)) {
// OpPhi supports pointer operands only with VariablePointers or
// VariablePointersStorageBuffer capabilities.
@@ -377,7 +377,7 @@ bool TransformationPropagateInstructionUp::IsApplicableToBlock(
opt::IRContext* ir_context, uint32_t block_id) {
// Check that |block_id| is valid.
const auto* label_inst = ir_context->get_def_use_mgr()->GetDef(block_id);
- if (!label_inst || label_inst->opcode() != SpvOpLabel) {
+ if (!label_inst || label_inst->opcode() != spv::Op::OpLabel) {
return false;
}