CIR array type
Syntax:
!cir.array<
mlir::Type, # elementType
uint64_t # size
>
CIR.array
represents C/C++ constant arrays.
Parameter | C++ type | Description |
---|---|---|
elementType | mlir::Type | |
size | uint64_t |
CIR type that represents
Syntax: !cir.bf16
Floating-point type that represents the bfloat16 format.
CIR bool type
Syntax: !cir.bool
cir.bool
represent's C++ bool type.
CIR complex type
Syntax:
!cir.complex<
::mlir::Type # elementType
>
CIR type that represents a C complex number. cir.complex
models the C type T _Complex
.
The type models complex values, per C99 6.2.5p11. It supports the C99 complex float types as well as the GCC integer complex extensions.
The parameter elementType
gives the type of the real and imaginary part of the complex number. elementType
must be either a CIR integer type or a CIR floating-point type.
Parameter | C++ type | Description |
---|---|---|
elementType | ::mlir::Type | integer or floating point type |
CIR type that represents pointer-to-data-member type in C++
Syntax:
!cir.data_member<
mlir::Type, # memberTy
cir::RecordType # clsTy
>
cir.member_ptr
models the pointer-to-data-member type in C++. Values of this type are essentially offsets of the pointed-to member within one of its containing record.
Parameter | C++ type | Description |
---|---|---|
memberTy | mlir::Type | |
clsTy | cir::RecordType |
CIR double-precision float type
Syntax: !cir.double
Floating-point type that represents the double
type in C/C++. Its underlying floating-point format is the IEEE-754 binary64 format.
CIR exception info
Syntax: !cir.exception
In presence of an inflight exception, this type holds all specific information for an exception: the associated type id, and the exception object pointer. These are materialzed from this type through other specific operations.
CIR type that represents IEEE-754 binary16 format
Syntax: !cir.f16
Floating-point type that represents the IEEE-754 binary16 format.
CIR type that represents x87 80-bit floating-point format
Syntax: !cir.f80
Floating-point type that represents the x87 80-bit floating-point format.
CIR type that represents IEEEquad 128-bit floating-point format
Syntax: !cir.f128
Floating-point type that represents the IEEEquad 128-bit floating-point format.
CIR function type
Syntax:
!cir.func<
::llvm::ArrayRef<mlir::Type>, # inputs
mlir::Type, # optionalReturnType
bool # varArg
>
The !cir.func
is a function type. It consists of an optional return type, a list of parameter types and can optionally be variadic.
Example:
!cir.func<()>
!cir.func<() -> !bool>
!cir.func<(!s8i, !s8i)>
!cir.func<(!s8i, !s8i) -> !s32i>
!cir.func<(!s32i, ...) -> !s32i>
Parameter | C++ type | Description |
---|---|---|
inputs | ::llvm::ArrayRef<mlir::Type> | |
optionalReturnType | mlir::Type | |
varArg | bool |
Integer type with arbitrary precision up to a fixed limit
CIR type that represents integer types with arbitrary precision.
Those integer types that are directly available in C/C++ standard are called fundamental integer types. Said types are: signed char
, short
, int
, long
, long long
, and their unsigned variations.
Parameter | C++ type | Description |
---|---|---|
width | unsigned | |
isSigned | bool |
CIR extended-precision float type
Syntax:
!cir.long_double<
::mlir::Type # underlying
>
Floating-point type that represents the long double
type in C/C++.
The underlying floating-point format of a long double value depends on the implementation. The underlying
parameter specifies the CIR floating-point type that corresponds to this format.
Parameter | C++ type | Description |
---|---|---|
underlying | ::mlir::Type | expects !cir.double, !cir.fp80 or !cir.fp128 |
CIR type that represents C++ pointer-to-member-function type
Syntax:
!cir.method<
cir::FuncType, # memberFuncTy
cir::RecordType # clsTy
>
cir.method
models the pointer-to-member-function type in C++. The layout of this type is ABI-dependent.
Parameter | C++ type | Description |
---|---|---|
memberFuncTy | cir::FuncType | |
clsTy | cir::RecordType |
CIR pointer type
Syntax:
!cir.ptr<
mlir::Type, # pointee
mlir::Attribute # addrSpace
>
CIR.ptr
is a type returned by any op generating a pointer in C++.
Parameter | C++ type | Description |
---|---|---|
pointee | mlir::Type | |
addrSpace | mlir::Attribute |
CIR record type
Each unique clang::RecordDecl is mapped to a cir.record
and any object in C/C++ that has a struct or class type will have a cir.record
in CIR.
There are three possible formats for this type:
Identified records are uniqued by their name, and anonymous records are uniqued by their body. This means that two anonymous records with the same body will be the same type, and two identified records with the same name will be the same type. Attempting to build a record with an existing name, but a different body will result in an error.
A few examples:
!complete = !cir.record<struct {!cir.int<u, 8>}>
!incomplete = !cir.record<struct "incomplete" incomplete>
!anonymous = !cir.record<struct {!cir.int<u, 8>}>
Incomplete records are mutable, meaning they can be later completed with a body automatically updating in place every type in the code that uses the incomplete record. Mutability allows for recursive types to be represented, meaning the record can have members that refer to itself. This is useful for representing recursive records and is implemented through a special syntax. In the example below, the Node
record has a member that is a pointer to a Node
record:
!s = !cir.record<struct "Node" {!cir.ptr<!cir.record<struct "Node">>}>
Parameter | C++ type | Description |
---|---|---|
members | ::llvm::ArrayRef<mlir::Type> | |
name | mlir::StringAttr | |
complete | bool | |
packed | bool | |
padded | bool | |
kind | RecordType::RecordKind | |
ast | ASTRecordDeclInterface |
CIR single-precision float type
Syntax: !cir.float
Floating-point type that represents the float
type in C/C++. Its underlying floating-point format is the IEEE-754 binary32 format.
CIR vector type
Syntax:
!cir.vector<
mlir::Type, # elementType
uint64_t # size
>
`cir.vector' represents fixed-size vector types. The parameters are the element type and the number of elements.
Parameter | C++ type | Description |
---|---|---|
elementType | mlir::Type | |
size | uint64_t |
CIR void type
Syntax: !cir.void
The !cir.void
type represents the C/C++ void
type.