Switch

public struct Switch : IRInstruction

A Switch represents a switch instruction. A switch instruction defines a jump table of values and destination basic blocks to pass the flow of control to if a condition value matches. If no match is made, control flow passes to the default basic block.

  • Inserts a case with the given value and destination basic block in the jump table of this switch instruction.

    Declaration

    Swift

    public func addCase(_ value: IRValue, _ block: BasicBlock)

    Parameters

    value

    The value that acts as the selector for this case.

    block

    The destination block for the flow of control if this case is matched.

  • Retrieves the underlying LLVM value object.

    Declaration

    Swift

    public func asLLVM() -> LLVMValueRef