IntType

public struct IntType: IRType

The IntType represents an integral value of a specified bit width.

The IntType is a very simple type that simply specifies an arbitrary bit width for the integer type desired. Any bit width from 1 bit to (2^23)-1 (about 8 million) can be specified.

  • Retrieves the bit width of this integer type.

    Declaration

    Swift

    public let width: Int
  • Creates an integer type with the specified bit width.

    Declaration

    Swift

    public init(width: Int)
  • Retrieves the i1 type.

    Declaration

    Swift

    public static let int1 = IntType(width: 1)
  • Retrieves the i8 type.

    Declaration

    Swift

    public static let int8 = IntType(width: 8)
  • Retrieves the i16 type.

    Declaration

    Swift

    public static let int16 = IntType(width: 16)
  • Retrieves the i32 type.

    Declaration

    Swift

    public static let int32 = IntType(width: 32)
  • Retrieves the i64 type.

    Declaration

    Swift

    public static let int64 = IntType(width: 64)
  • Retrieves the i128 type.

    Declaration

    Swift

    public static let int128 = IntType(width: 128)
  • Retrieves an integer value of this type’s bit width consisting of all zero-bits.

    Declaration

    Swift

    public func zero() -> IRValue

    Return Value

    A value consisting of all zero-bits of this type’s bit width.

  • Creates an unsigned integer constant value with the given Swift integer value.

    Declaration

    Swift

    public func constant<IntTy: UnsignedInteger>(_ value: IntTy, signExtend: Bool = false) -> Constant<Unsigned>

    Parameters

    value

    A Swift integer value.

    signExtend

    Whether to sign-extend this value to fit this type’s bit width. Defaults to false.

  • Creates a signed integer constant value with the given Swift integer value.

    Declaration

    Swift

    public func constant<IntTy: SignedInteger>(_ value: IntTy, signExtend: Bool = false) -> Constant<Signed>

    Parameters

    value

    A Swift integer value.

    signExtend

    Whether to sign-extend this value to fit this type’s bit width. Defaults to false.

  • Retrieves an integer value of this type’s bit width consisting of all one-bits.

    Declaration

    Swift

    public func allOnes() -> IRValue

    Return Value

    A value consisting of all one-bits of this type’s bit width.

  • Retrieves the underlying LLVM type object.

    Declaration

    Swift

    public func asLLVM() -> LLVMTypeRef