Instruction

public struct Instruction : IRValue

An Instruction represents an instruction residing in a basic block.

  • Creates an Intruction from an LLVMValueRef object.

    Declaration

    Swift

    public init(llvm: LLVMValueRef)
  • Retrieves the underlying LLVM value object.

    Declaration

    Swift

    public func asLLVM() -> LLVMValueRef
  • Retrieves the opcode associated with this Instruction.

    Declaration

    Swift

    public var opCode: OpCode { get }
  • Obtain the instruction that occurs before this one, if it exists.

    Declaration

    Swift

    public func previous() -> Instruction?
  • Obtain the instruction that occurs after this one, if it exists.

    Declaration

    Swift

    public func next() -> Instruction?
  • Retrieves the parent basic block that contains this instruction, if it exists.

    Declaration

    Swift

    public var parentBlock: BasicBlock? { get }
  • Retrieves the first use of this instruction.

    Declaration

    Swift

    public var firstUse: Use? { get }
  • Retrieves the sequence of instructions that use the value from this instruction.

    Declaration

    Swift

    public var uses: AnySequence<Use> { get }
  • Removes this instruction from a basic block but keeps it alive.

    Note

    To ensure correct removal of the instruction, you must invalidate any references to its result values, if any.

    Declaration

    Swift

    public func removeFromParent()
  • Create a copy of ‘this’ instruction that is identical in all ways except the following:

    • The instruction has no parent
    • The instruction has no name

    Declaration

    Swift

    public func clone() -> Instruction