MLIR

Multi-Level IR Compiler Framework

'ptr' Dialect

Pointer dialect

Attributes 

SpecAttr 

ptr data layout spec

Syntax:

#ptr.spec<
  uint32_t,   # size
  uint32_t,   # abi
  uint32_t,   # preferred
  uint32_t   # index
>

Defines the data layout spec for a pointer type. This attribute has 4 fields:

  • [Required] size: size of the pointer in bits.
  • [Required] abi: ABI-required alignment for the pointer in bits.
  • [Required] preferred: preferred alignment for the pointer in bits.
  • [Optional] index: bitwidth that should be used when performing index computations for the type. Setting the field to kOptionalSpecValue, means the field is optional.

Furthermore, the attribute will verify that all present values are divisible by 8 (number of bits in a byte), and that preferred > abi.

Example:

// Spec for a 64 bit ptr, with a required alignment of 64 bits, but with
// a preferred alignment of 128 bits and an index bitwidth of 64 bits.
#ptr.spec<size = 64, abi = 64, preferred = 128, index = 64>

Parameters: 

ParameterC++ typeDescription
sizeuint32_t
abiuint32_t
preferreduint32_t
indexuint32_t

Types 

PtrType 

pointer type

Syntax:

!ptr.ptr<
  Attribute   # memorySpace
>

The ptr type is an opaque pointer type. This type typically represents a handle to an object in memory or target-dependent values like nullptr. Pointers are optionally parameterized by a memory space.

Syntax:

pointer ::= `ptr` (`<` memory-space `>`)?
memory-space ::= attribute-value

Parameters: 

ParameterC++ typeDescription
memorySpaceAttribute