// AUTOMATICALLY GENERATED from the SPIR-V JSON grammar:
//   external/spirv.core.grammar.json.
// DO NOT MODIFY!

impl Parser<'_, '_> {
    fn parse_operand(&mut self, kind: GOpKind) -> Result<Vec<dr::Operand>> {
        Ok(match kind {
            GOpKind::FPFastMathMode => vec![dr::Operand::FPFastMathMode(
                self.decoder.fp_fast_math_mode()?,
            )],
            GOpKind::SelectionControl => vec![dr::Operand::SelectionControl(
                self.decoder.selection_control()?,
            )],
            GOpKind::FunctionControl => vec![dr::Operand::FunctionControl(
                self.decoder.function_control()?,
            )],
            GOpKind::MemorySemantics => vec![dr::Operand::MemorySemantics(
                self.decoder.memory_semantics()?,
            )],
            GOpKind::KernelProfilingInfo => vec![dr::Operand::KernelProfilingInfo(
                self.decoder.kernel_profiling_info()?,
            )],
            GOpKind::RayFlags => vec![dr::Operand::RayFlags(self.decoder.ray_flags()?)],
            GOpKind::FragmentShadingRate => vec![dr::Operand::FragmentShadingRate(
                self.decoder.fragment_shading_rate()?,
            )],
            GOpKind::RawAccessChainOperands => vec![dr::Operand::RawAccessChainOperands(
                self.decoder.raw_access_chain_operands()?,
            )],
            GOpKind::SourceLanguage => {
                vec![dr::Operand::SourceLanguage(self.decoder.source_language()?)]
            }
            GOpKind::ExecutionModel => {
                vec![dr::Operand::ExecutionModel(self.decoder.execution_model()?)]
            }
            GOpKind::AddressingModel => vec![dr::Operand::AddressingModel(
                self.decoder.addressing_model()?,
            )],
            GOpKind::MemoryModel => vec![dr::Operand::MemoryModel(self.decoder.memory_model()?)],
            GOpKind::StorageClass => vec![dr::Operand::StorageClass(self.decoder.storage_class()?)],
            GOpKind::Dim => vec![dr::Operand::Dim(self.decoder.dim()?)],
            GOpKind::SamplerAddressingMode => vec![dr::Operand::SamplerAddressingMode(
                self.decoder.sampler_addressing_mode()?,
            )],
            GOpKind::SamplerFilterMode => vec![dr::Operand::SamplerFilterMode(
                self.decoder.sampler_filter_mode()?,
            )],
            GOpKind::ImageFormat => vec![dr::Operand::ImageFormat(self.decoder.image_format()?)],
            GOpKind::ImageChannelOrder => vec![dr::Operand::ImageChannelOrder(
                self.decoder.image_channel_order()?,
            )],
            GOpKind::ImageChannelDataType => vec![dr::Operand::ImageChannelDataType(
                self.decoder.image_channel_data_type()?,
            )],
            GOpKind::FPRoundingMode => vec![dr::Operand::FPRoundingMode(
                self.decoder.fp_rounding_mode()?,
            )],
            GOpKind::FPDenormMode => {
                vec![dr::Operand::FPDenormMode(self.decoder.fp_denorm_mode()?)]
            }
            GOpKind::QuantizationModes => vec![dr::Operand::QuantizationModes(
                self.decoder.quantization_modes()?,
            )],
            GOpKind::FPOperationMode => vec![dr::Operand::FPOperationMode(
                self.decoder.fp_operation_mode()?,
            )],
            GOpKind::OverflowModes => {
                vec![dr::Operand::OverflowModes(self.decoder.overflow_modes()?)]
            }
            GOpKind::LinkageType => vec![dr::Operand::LinkageType(self.decoder.linkage_type()?)],
            GOpKind::AccessQualifier => vec![dr::Operand::AccessQualifier(
                self.decoder.access_qualifier()?,
            )],
            GOpKind::HostAccessQualifier => vec![dr::Operand::HostAccessQualifier(
                self.decoder.host_access_qualifier()?,
            )],
            GOpKind::FunctionParameterAttribute => vec![dr::Operand::FunctionParameterAttribute(
                self.decoder.function_parameter_attribute()?,
            )],
            GOpKind::BuiltIn => vec![dr::Operand::BuiltIn(self.decoder.built_in()?)],
            GOpKind::Scope => vec![dr::Operand::Scope(self.decoder.scope()?)],
            GOpKind::GroupOperation => {
                vec![dr::Operand::GroupOperation(self.decoder.group_operation()?)]
            }
            GOpKind::KernelEnqueueFlags => vec![dr::Operand::KernelEnqueueFlags(
                self.decoder.kernel_enqueue_flags()?,
            )],
            GOpKind::Capability => vec![dr::Operand::Capability(self.decoder.capability()?)],
            GOpKind::RayQueryIntersection => vec![dr::Operand::RayQueryIntersection(
                self.decoder.ray_query_intersection()?,
            )],
            GOpKind::RayQueryCommittedIntersectionType => {
                vec![dr::Operand::RayQueryCommittedIntersectionType(
                    self.decoder.ray_query_committed_intersection_type()?,
                )]
            }
            GOpKind::RayQueryCandidateIntersectionType => {
                vec![dr::Operand::RayQueryCandidateIntersectionType(
                    self.decoder.ray_query_candidate_intersection_type()?,
                )]
            }
            GOpKind::PackedVectorFormat => vec![dr::Operand::PackedVectorFormat(
                self.decoder.packed_vector_format()?,
            )],
            GOpKind::CooperativeMatrixOperands => vec![dr::Operand::CooperativeMatrixOperands(
                self.decoder.cooperative_matrix_operands()?,
            )],
            GOpKind::CooperativeMatrixLayout => vec![dr::Operand::CooperativeMatrixLayout(
                self.decoder.cooperative_matrix_layout()?,
            )],
            GOpKind::CooperativeMatrixUse => vec![dr::Operand::CooperativeMatrixUse(
                self.decoder.cooperative_matrix_use()?,
            )],
            GOpKind::CooperativeMatrixReduce => vec![dr::Operand::CooperativeMatrixReduce(
                self.decoder.cooperative_matrix_reduce()?,
            )],
            GOpKind::TensorClampMode => vec![dr::Operand::TensorClampMode(
                self.decoder.tensor_clamp_mode()?,
            )],
            GOpKind::InitializationModeQualifier => vec![dr::Operand::InitializationModeQualifier(
                self.decoder.initialization_mode_qualifier()?,
            )],
            GOpKind::LoadCacheControl => vec![dr::Operand::LoadCacheControl(
                self.decoder.load_cache_control()?,
            )],
            GOpKind::StoreCacheControl => vec![dr::Operand::StoreCacheControl(
                self.decoder.store_cache_control()?,
            )],
            GOpKind::NamedMaximumNumberOfRegisters => {
                vec![dr::Operand::NamedMaximumNumberOfRegisters(
                    self.decoder.named_maximum_number_of_registers()?,
                )]
            }
            GOpKind::MatrixMultiplyAccumulateOperands => {
                vec![dr::Operand::MatrixMultiplyAccumulateOperands(
                    self.decoder.matrix_multiply_accumulate_operands()?,
                )]
            }
            GOpKind::FPEncoding => vec![dr::Operand::FPEncoding(self.decoder.fp_encoding()?)],
            GOpKind::CooperativeVectorMatrixLayout => {
                vec![dr::Operand::CooperativeVectorMatrixLayout(
                    self.decoder.cooperative_vector_matrix_layout()?,
                )]
            }
            GOpKind::ComponentType => {
                vec![dr::Operand::ComponentType(self.decoder.component_type()?)]
            }
            GOpKind::IdMemorySemantics => vec![dr::Operand::IdMemorySemantics(self.decoder.id()?)],
            GOpKind::IdScope => vec![dr::Operand::IdScope(self.decoder.id()?)],
            GOpKind::IdRef => vec![dr::Operand::IdRef(self.decoder.id()?)],
            GOpKind::LiteralInteger => vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)],
            GOpKind::LiteralString => vec![dr::Operand::LiteralString(self.decoder.string()?)],
            GOpKind::LiteralFloat => vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)],
            GOpKind::LiteralExtInstInteger => vec![dr::Operand::LiteralExtInstInteger(
                self.decoder.ext_inst_integer()?,
            )],
            GOpKind::PairIdRefLiteralInteger => vec![
                dr::Operand::IdRef(self.decoder.id()?),
                dr::Operand::LiteralBit32(self.decoder.bit32()?),
            ],
            GOpKind::PairIdRefIdRef => vec![
                dr::Operand::IdRef(self.decoder.id()?),
                dr::Operand::IdRef(self.decoder.id()?),
            ],
            GOpKind::ImageOperands => {
                let val = self.decoder.image_operands()?;
                let mut ops = vec![dr::Operand::ImageOperands(val)];
                ops.append(&mut self.parse_image_operands_arguments(val)?);
                ops
            }
            GOpKind::LoopControl => {
                let val = self.decoder.loop_control()?;
                let mut ops = vec![dr::Operand::LoopControl(val)];
                ops.append(&mut self.parse_loop_control_arguments(val)?);
                ops
            }
            GOpKind::MemoryAccess => {
                let val = self.decoder.memory_access()?;
                let mut ops = vec![dr::Operand::MemoryAccess(val)];
                ops.append(&mut self.parse_memory_access_arguments(val)?);
                ops
            }
            GOpKind::ExecutionMode => {
                let val = self.decoder.execution_mode()?;
                let mut ops = vec![dr::Operand::ExecutionMode(val)];
                ops.append(&mut self.parse_execution_mode_arguments(val)?);
                ops
            }
            GOpKind::Decoration => {
                let val = self.decoder.decoration()?;
                let mut ops = vec![dr::Operand::Decoration(val)];
                ops.append(&mut self.parse_decoration_arguments(val)?);
                ops
            }
            GOpKind::TensorAddressingOperands => {
                let val = self.decoder.tensor_addressing_operands()?;
                let mut ops = vec![dr::Operand::TensorAddressingOperands(val)];
                ops.append(&mut self.parse_tensor_addressing_operands_arguments(val)?);
                ops
            }
            GOpKind::TensorOperands => {
                let val = self.decoder.tensor_operands()?;
                let mut ops = vec![dr::Operand::TensorOperands(val)];
                ops.append(&mut self.parse_tensor_operands_arguments(val)?);
                ops
            }
            GOpKind::IdResultType => panic!(),
            GOpKind::IdResult => panic!(),
            GOpKind::LiteralContextDependentNumber => panic!(),
            GOpKind::LiteralSpecConstantOpInteger => panic!(),
            GOpKind::PairLiteralIntegerIdRef => panic!(),
            GOpKind::Debuginfo(_) => {
                todo!("extended instruction operand kind not yet supported for parsing")
            }
            GOpKind::NonsemanticClspvreflection(_) => {
                todo!("extended instruction operand kind not yet supported for parsing")
            }
            GOpKind::NonsemanticShaderDebuginfo100(_) => {
                todo!("extended instruction operand kind not yet supported for parsing")
            }
            GOpKind::OpenclDebuginfo100(_) => {
                todo!("extended instruction operand kind not yet supported for parsing")
            }
        })
    }
    fn parse_image_operands_arguments(
        &mut self,
        image_operands: spirv::ImageOperands,
    ) -> Result<Vec<dr::Operand>> {
        let mut params = vec![];
        if image_operands.contains(spirv::ImageOperands::BIAS) {
            params.append(&mut vec![dr::Operand::IdRef(self.decoder.id()?)]);
        }
        if image_operands.contains(spirv::ImageOperands::LOD) {
            params.append(&mut vec![dr::Operand::IdRef(self.decoder.id()?)]);
        }
        if image_operands.contains(spirv::ImageOperands::GRAD) {
            params.append(&mut vec![
                dr::Operand::IdRef(self.decoder.id()?),
                dr::Operand::IdRef(self.decoder.id()?),
            ]);
        }
        if image_operands.contains(spirv::ImageOperands::CONST_OFFSET) {
            params.append(&mut vec![dr::Operand::IdRef(self.decoder.id()?)]);
        }
        if image_operands.contains(spirv::ImageOperands::OFFSET) {
            params.append(&mut vec![dr::Operand::IdRef(self.decoder.id()?)]);
        }
        if image_operands.contains(spirv::ImageOperands::CONST_OFFSETS) {
            params.append(&mut vec![dr::Operand::IdRef(self.decoder.id()?)]);
        }
        if image_operands.contains(spirv::ImageOperands::SAMPLE) {
            params.append(&mut vec![dr::Operand::IdRef(self.decoder.id()?)]);
        }
        if image_operands.contains(spirv::ImageOperands::MIN_LOD) {
            params.append(&mut vec![dr::Operand::IdRef(self.decoder.id()?)]);
        }
        if image_operands.contains(spirv::ImageOperands::MAKE_TEXEL_AVAILABLE) {
            params.append(&mut vec![dr::Operand::IdScope(self.decoder.id()?)]);
        }
        if image_operands.contains(spirv::ImageOperands::MAKE_TEXEL_VISIBLE) {
            params.append(&mut vec![dr::Operand::IdScope(self.decoder.id()?)]);
        }
        if image_operands.contains(spirv::ImageOperands::OFFSETS) {
            params.append(&mut vec![dr::Operand::IdRef(self.decoder.id()?)]);
        }
        Ok(params)
    }
    fn parse_loop_control_arguments(
        &mut self,
        loop_control: spirv::LoopControl,
    ) -> Result<Vec<dr::Operand>> {
        let mut params = vec![];
        if loop_control.contains(spirv::LoopControl::DEPENDENCY_LENGTH) {
            params.append(&mut vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]);
        }
        if loop_control.contains(spirv::LoopControl::MIN_ITERATIONS) {
            params.append(&mut vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]);
        }
        if loop_control.contains(spirv::LoopControl::MAX_ITERATIONS) {
            params.append(&mut vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]);
        }
        if loop_control.contains(spirv::LoopControl::ITERATION_MULTIPLE) {
            params.append(&mut vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]);
        }
        if loop_control.contains(spirv::LoopControl::PEEL_COUNT) {
            params.append(&mut vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]);
        }
        if loop_control.contains(spirv::LoopControl::PARTIAL_COUNT) {
            params.append(&mut vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]);
        }
        if loop_control.contains(spirv::LoopControl::INITIATION_INTERVAL_ALTERA) {
            params.append(&mut vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]);
        }
        if loop_control.contains(spirv::LoopControl::MAX_CONCURRENCY_ALTERA) {
            params.append(&mut vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]);
        }
        if loop_control.contains(spirv::LoopControl::DEPENDENCY_ARRAY_ALTERA) {
            params.append(&mut vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]);
        }
        if loop_control.contains(spirv::LoopControl::PIPELINE_ENABLE_ALTERA) {
            params.append(&mut vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]);
        }
        if loop_control.contains(spirv::LoopControl::LOOP_COALESCE_ALTERA) {
            params.append(&mut vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]);
        }
        if loop_control.contains(spirv::LoopControl::MAX_INTERLEAVING_ALTERA) {
            params.append(&mut vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]);
        }
        if loop_control.contains(spirv::LoopControl::SPECULATED_ITERATIONS_ALTERA) {
            params.append(&mut vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]);
        }
        if loop_control.contains(spirv::LoopControl::LOOP_COUNT_ALTERA) {
            params.append(&mut vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]);
        }
        if loop_control.contains(spirv::LoopControl::MAX_REINVOCATION_DELAY_ALTERA) {
            params.append(&mut vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]);
        }
        Ok(params)
    }
    fn parse_memory_access_arguments(
        &mut self,
        memory_access: spirv::MemoryAccess,
    ) -> Result<Vec<dr::Operand>> {
        let mut params = vec![];
        if memory_access.contains(spirv::MemoryAccess::ALIGNED) {
            params.append(&mut vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]);
        }
        if memory_access.contains(spirv::MemoryAccess::MAKE_POINTER_AVAILABLE) {
            params.append(&mut vec![dr::Operand::IdScope(self.decoder.id()?)]);
        }
        if memory_access.contains(spirv::MemoryAccess::MAKE_POINTER_VISIBLE) {
            params.append(&mut vec![dr::Operand::IdScope(self.decoder.id()?)]);
        }
        if memory_access.contains(spirv::MemoryAccess::ALIAS_SCOPE_INTEL_MASK) {
            params.append(&mut vec![dr::Operand::IdRef(self.decoder.id()?)]);
        }
        if memory_access.contains(spirv::MemoryAccess::NO_ALIAS_INTEL_MASK) {
            params.append(&mut vec![dr::Operand::IdRef(self.decoder.id()?)]);
        }
        Ok(params)
    }
    fn parse_execution_mode_arguments(
        &mut self,
        execution_mode: spirv::ExecutionMode,
    ) -> Result<Vec<dr::Operand>> {
        Ok(match execution_mode {
            spirv::ExecutionMode::Invocations => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::ExecutionMode::LocalSize => vec![
                dr::Operand::LiteralBit32(self.decoder.bit32()?),
                dr::Operand::LiteralBit32(self.decoder.bit32()?),
                dr::Operand::LiteralBit32(self.decoder.bit32()?),
            ],
            spirv::ExecutionMode::LocalSizeHint => vec![
                dr::Operand::LiteralBit32(self.decoder.bit32()?),
                dr::Operand::LiteralBit32(self.decoder.bit32()?),
                dr::Operand::LiteralBit32(self.decoder.bit32()?),
            ],
            spirv::ExecutionMode::OutputVertices => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::ExecutionMode::VecTypeHint => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::ExecutionMode::SubgroupSize => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::ExecutionMode::SubgroupsPerWorkgroup => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::ExecutionMode::SubgroupsPerWorkgroupId => {
                vec![dr::Operand::IdRef(self.decoder.id()?)]
            }
            spirv::ExecutionMode::LocalSizeId => vec![
                dr::Operand::IdRef(self.decoder.id()?),
                dr::Operand::IdRef(self.decoder.id()?),
                dr::Operand::IdRef(self.decoder.id()?),
            ],
            spirv::ExecutionMode::LocalSizeHintId => vec![
                dr::Operand::IdRef(self.decoder.id()?),
                dr::Operand::IdRef(self.decoder.id()?),
                dr::Operand::IdRef(self.decoder.id()?),
            ],
            spirv::ExecutionMode::DenormPreserve => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::ExecutionMode::DenormFlushToZero => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::ExecutionMode::SignedZeroInfNanPreserve => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::ExecutionMode::RoundingModeRTE => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::ExecutionMode::RoundingModeRTZ => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::ExecutionMode::TileShadingRateQCOM => vec![
                dr::Operand::LiteralBit32(self.decoder.bit32()?),
                dr::Operand::LiteralBit32(self.decoder.bit32()?),
                dr::Operand::LiteralBit32(self.decoder.bit32()?),
            ],
            spirv::ExecutionMode::IsApiEntryAMDX => vec![dr::Operand::IdRef(self.decoder.id()?)],
            spirv::ExecutionMode::MaxNodeRecursionAMDX => {
                vec![dr::Operand::IdRef(self.decoder.id()?)]
            }
            spirv::ExecutionMode::StaticNumWorkgroupsAMDX => vec![
                dr::Operand::IdRef(self.decoder.id()?),
                dr::Operand::IdRef(self.decoder.id()?),
                dr::Operand::IdRef(self.decoder.id()?),
            ],
            spirv::ExecutionMode::ShaderIndexAMDX => vec![dr::Operand::IdRef(self.decoder.id()?)],
            spirv::ExecutionMode::MaxNumWorkgroupsAMDX => vec![
                dr::Operand::IdRef(self.decoder.id()?),
                dr::Operand::IdRef(self.decoder.id()?),
                dr::Operand::IdRef(self.decoder.id()?),
            ],
            spirv::ExecutionMode::SharesInputWithAMDX => vec![
                dr::Operand::IdRef(self.decoder.id()?),
                dr::Operand::IdRef(self.decoder.id()?),
            ],
            spirv::ExecutionMode::OutputPrimitivesEXT => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::ExecutionMode::SharedLocalMemorySizeINTEL => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::ExecutionMode::RoundingModeRTPINTEL => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::ExecutionMode::RoundingModeRTNINTEL => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::ExecutionMode::FloatingPointModeALTINTEL => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::ExecutionMode::FloatingPointModeIEEEINTEL => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::ExecutionMode::MaxWorkgroupSizeINTEL => vec![
                dr::Operand::LiteralBit32(self.decoder.bit32()?),
                dr::Operand::LiteralBit32(self.decoder.bit32()?),
                dr::Operand::LiteralBit32(self.decoder.bit32()?),
            ],
            spirv::ExecutionMode::MaxWorkDimINTEL => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::ExecutionMode::NumSIMDWorkitemsINTEL => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::ExecutionMode::SchedulerTargetFmaxMhzINTEL => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::ExecutionMode::FPFastMathDefault => vec![
                dr::Operand::IdRef(self.decoder.id()?),
                dr::Operand::IdRef(self.decoder.id()?),
            ],
            spirv::ExecutionMode::StreamingInterfaceINTEL => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::ExecutionMode::RegisterMapInterfaceINTEL => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::ExecutionMode::NamedBarrierCountINTEL => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::ExecutionMode::MaximumRegistersINTEL => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::ExecutionMode::MaximumRegistersIdINTEL => {
                vec![dr::Operand::IdRef(self.decoder.id()?)]
            }
            spirv::ExecutionMode::NamedMaximumRegistersINTEL => {
                vec![dr::Operand::NamedMaximumNumberOfRegisters(
                    self.decoder.named_maximum_number_of_registers()?,
                )]
            }
            _ => vec![],
        })
    }
    fn parse_decoration_arguments(
        &mut self,
        decoration: spirv::Decoration,
    ) -> Result<Vec<dr::Operand>> {
        Ok(match decoration {
            spirv::Decoration::SpecId => vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)],
            spirv::Decoration::ArrayStride => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::Decoration::MatrixStride => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::Decoration::BuiltIn => vec![dr::Operand::BuiltIn(self.decoder.built_in()?)],
            spirv::Decoration::UniformId => vec![dr::Operand::IdScope(self.decoder.id()?)],
            spirv::Decoration::Stream => vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)],
            spirv::Decoration::Location => vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)],
            spirv::Decoration::Component => vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)],
            spirv::Decoration::Index => vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)],
            spirv::Decoration::Binding => vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)],
            spirv::Decoration::DescriptorSet => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::Decoration::Offset => vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)],
            spirv::Decoration::XfbBuffer => vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)],
            spirv::Decoration::XfbStride => vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)],
            spirv::Decoration::FuncParamAttr => vec![dr::Operand::FunctionParameterAttribute(
                self.decoder.function_parameter_attribute()?,
            )],
            spirv::Decoration::FPRoundingMode => vec![dr::Operand::FPRoundingMode(
                self.decoder.fp_rounding_mode()?,
            )],
            spirv::Decoration::FPFastMathMode => vec![dr::Operand::FPFastMathMode(
                self.decoder.fp_fast_math_mode()?,
            )],
            spirv::Decoration::LinkageAttributes => vec![
                dr::Operand::LiteralString(self.decoder.string()?),
                dr::Operand::LinkageType(self.decoder.linkage_type()?),
            ],
            spirv::Decoration::InputAttachmentIndex => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::Decoration::Alignment => vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)],
            spirv::Decoration::MaxByteOffset => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::Decoration::AlignmentId => vec![dr::Operand::IdRef(self.decoder.id()?)],
            spirv::Decoration::MaxByteOffsetId => vec![dr::Operand::IdRef(self.decoder.id()?)],
            spirv::Decoration::NodeSharesPayloadLimitsWithAMDX => {
                vec![dr::Operand::IdRef(self.decoder.id()?)]
            }
            spirv::Decoration::NodeMaxPayloadsAMDX => vec![dr::Operand::IdRef(self.decoder.id()?)],
            spirv::Decoration::PayloadNodeNameAMDX => vec![dr::Operand::IdRef(self.decoder.id()?)],
            spirv::Decoration::PayloadNodeBaseIndexAMDX => {
                vec![dr::Operand::IdRef(self.decoder.id()?)]
            }
            spirv::Decoration::PayloadNodeArraySizeAMDX => {
                vec![dr::Operand::IdRef(self.decoder.id()?)]
            }
            spirv::Decoration::ArrayStrideIdEXT => vec![dr::Operand::IdRef(self.decoder.id()?)],
            spirv::Decoration::OffsetIdEXT => vec![dr::Operand::IdRef(self.decoder.id()?)],
            spirv::Decoration::SecondaryViewportRelativeNV => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::Decoration::MemberOffsetNV => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::Decoration::BankNV => vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)],
            spirv::Decoration::SIMTCallINTEL => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::Decoration::ClobberINTEL => {
                vec![dr::Operand::LiteralString(self.decoder.string()?)]
            }
            spirv::Decoration::FuncParamIOKindINTEL => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::Decoration::GlobalVariableOffsetINTEL => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::Decoration::CounterBuffer => vec![dr::Operand::IdRef(self.decoder.id()?)],
            spirv::Decoration::UserSemantic => {
                vec![dr::Operand::LiteralString(self.decoder.string()?)]
            }
            spirv::Decoration::UserTypeGOOGLE => {
                vec![dr::Operand::LiteralString(self.decoder.string()?)]
            }
            spirv::Decoration::FunctionRoundingModeINTEL => vec![
                dr::Operand::LiteralBit32(self.decoder.bit32()?),
                dr::Operand::FPRoundingMode(self.decoder.fp_rounding_mode()?),
            ],
            spirv::Decoration::FunctionDenormModeINTEL => vec![
                dr::Operand::LiteralBit32(self.decoder.bit32()?),
                dr::Operand::FPDenormMode(self.decoder.fp_denorm_mode()?),
            ],
            spirv::Decoration::MemoryALTERA => {
                vec![dr::Operand::LiteralString(self.decoder.string()?)]
            }
            spirv::Decoration::NumbanksALTERA => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::Decoration::BankwidthALTERA => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::Decoration::MaxPrivateCopiesALTERA => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::Decoration::MaxReplicatesALTERA => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::Decoration::MergeALTERA => vec![
                dr::Operand::LiteralString(self.decoder.string()?),
                dr::Operand::LiteralString(self.decoder.string()?),
            ],
            spirv::Decoration::BankBitsALTERA => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::Decoration::ForcePow2DepthALTERA => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::Decoration::StridesizeALTERA => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::Decoration::WordsizeALTERA => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::Decoration::CacheSizeALTERA => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::Decoration::PrefetchALTERA => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::Decoration::MathOpDSPModeALTERA => vec![
                dr::Operand::LiteralBit32(self.decoder.bit32()?),
                dr::Operand::LiteralBit32(self.decoder.bit32()?),
            ],
            spirv::Decoration::AliasScopeINTEL => vec![dr::Operand::IdRef(self.decoder.id()?)],
            spirv::Decoration::NoAliasINTEL => vec![dr::Operand::IdRef(self.decoder.id()?)],
            spirv::Decoration::InitiationIntervalALTERA => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::Decoration::MaxConcurrencyALTERA => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::Decoration::PipelineEnableALTERA => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::Decoration::BufferLocationALTERA => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::Decoration::IOPipeStorageALTERA => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::Decoration::FunctionFloatingPointModeINTEL => vec![
                dr::Operand::LiteralBit32(self.decoder.bit32()?),
                dr::Operand::FPOperationMode(self.decoder.fp_operation_mode()?),
            ],
            spirv::Decoration::FPMaxErrorDecorationINTEL => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::Decoration::LatencyControlLabelALTERA => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::Decoration::LatencyControlConstraintALTERA => vec![
                dr::Operand::LiteralBit32(self.decoder.bit32()?),
                dr::Operand::LiteralBit32(self.decoder.bit32()?),
                dr::Operand::LiteralBit32(self.decoder.bit32()?),
            ],
            spirv::Decoration::MMHostInterfaceAddressWidthALTERA => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::Decoration::MMHostInterfaceDataWidthALTERA => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::Decoration::MMHostInterfaceLatencyALTERA => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::Decoration::MMHostInterfaceReadWriteModeALTERA => {
                vec![dr::Operand::AccessQualifier(
                    self.decoder.access_qualifier()?,
                )]
            }
            spirv::Decoration::MMHostInterfaceMaxBurstALTERA => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::Decoration::MMHostInterfaceWaitRequestALTERA => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::Decoration::HostAccessINTEL => vec![
                dr::Operand::HostAccessQualifier(self.decoder.host_access_qualifier()?),
                dr::Operand::LiteralString(self.decoder.string()?),
            ],
            spirv::Decoration::InitModeALTERA => vec![dr::Operand::InitializationModeQualifier(
                self.decoder.initialization_mode_qualifier()?,
            )],
            spirv::Decoration::ImplementInRegisterMapALTERA => {
                vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
            }
            spirv::Decoration::ConditionalINTEL => vec![dr::Operand::IdRef(self.decoder.id()?)],
            spirv::Decoration::CacheControlLoadINTEL => vec![
                dr::Operand::LiteralBit32(self.decoder.bit32()?),
                dr::Operand::LoadCacheControl(self.decoder.load_cache_control()?),
            ],
            spirv::Decoration::CacheControlStoreINTEL => vec![
                dr::Operand::LiteralBit32(self.decoder.bit32()?),
                dr::Operand::StoreCacheControl(self.decoder.store_cache_control()?),
            ],
            _ => vec![],
        })
    }
    fn parse_tensor_addressing_operands_arguments(
        &mut self,
        tensor_addressing_operands: spirv::TensorAddressingOperands,
    ) -> Result<Vec<dr::Operand>> {
        let mut params = vec![];
        if tensor_addressing_operands.contains(spirv::TensorAddressingOperands::TENSOR_VIEW) {
            params.append(&mut vec![dr::Operand::IdRef(self.decoder.id()?)]);
        }
        if tensor_addressing_operands.contains(spirv::TensorAddressingOperands::DECODE_FUNC) {
            params.append(&mut vec![dr::Operand::IdRef(self.decoder.id()?)]);
        }
        Ok(params)
    }
    fn parse_tensor_operands_arguments(
        &mut self,
        tensor_operands: spirv::TensorOperands,
    ) -> Result<Vec<dr::Operand>> {
        let mut params = vec![];
        if tensor_operands.contains(spirv::TensorOperands::OUT_OF_BOUNDS_VALUE_ARM) {
            params.append(&mut vec![dr::Operand::IdRef(self.decoder.id()?)]);
        }
        if tensor_operands.contains(spirv::TensorOperands::MAKE_ELEMENT_AVAILABLE_ARM) {
            params.append(&mut vec![dr::Operand::IdRef(self.decoder.id()?)]);
        }
        if tensor_operands.contains(spirv::TensorOperands::MAKE_ELEMENT_VISIBLE_ARM) {
            params.append(&mut vec![dr::Operand::IdRef(self.decoder.id()?)]);
        }
        Ok(params)
    }
}
