Attributes


ASTCXXConstructorDeclAttr

Wraps a ‘const clang::CXXConstructorDecl *' AST node.

Operations optionally refer to this node, they could be available depending on the CIR lowering stage. Whether it's attached to the appropriated CIR operation is delegated to the operation verifier.

This always implies a non-null AST reference (verified).

Parameters:

Parameter C++ type Description
ast const clang::CXXConstructorDecl *  

ASTCXXConversionDeclAttr

Wraps a ‘const clang::CXXConversionDecl *' AST node.

Operations optionally refer to this node, they could be available depending on the CIR lowering stage. Whether it's attached to the appropriated CIR operation is delegated to the operation verifier.

This always implies a non-null AST reference (verified).

Parameters:

Parameter C++ type Description
ast const clang::CXXConversionDecl *  

ASTCXXDestructorDeclAttr

Wraps a ‘const clang::CXXDestructorDecl *' AST node.

Operations optionally refer to this node, they could be available depending on the CIR lowering stage. Whether it's attached to the appropriated CIR operation is delegated to the operation verifier.

This always implies a non-null AST reference (verified).

Parameters:

Parameter C++ type Description
ast const clang::CXXDestructorDecl *  

ASTCXXMethodDeclAttr

Wraps a ‘const clang::CXXMethodDecl *' AST node.

Operations optionally refer to this node, they could be available depending on the CIR lowering stage. Whether it's attached to the appropriated CIR operation is delegated to the operation verifier.

This always implies a non-null AST reference (verified).

Parameters:

Parameter C++ type Description
ast const clang::CXXMethodDecl *  

ASTCallExprAttr

Wraps a ‘const clang::CallExpr *' AST node.

Operations optionally refer to this node, they could be available depending on the CIR lowering stage. Whether it's attached to the appropriated CIR operation is delegated to the operation verifier.

This always implies a non-null AST reference (verified).

Parameters:

Parameter C++ type Description
ast const clang::CallExpr *  

ASTDeclAttr

Wraps a ‘const clang::Decl *' AST node.

Operations optionally refer to this node, they could be available depending on the CIR lowering stage. Whether it's attached to the appropriated CIR operation is delegated to the operation verifier.

This always implies a non-null AST reference (verified).

Parameters:

Parameter C++ type Description
ast const clang::Decl *  

ASTExprAttr

Wraps a ‘const clang::Expr *' AST node.

Operations optionally refer to this node, they could be available depending on the CIR lowering stage. Whether it's attached to the appropriated CIR operation is delegated to the operation verifier.

This always implies a non-null AST reference (verified).

Parameters:

Parameter C++ type Description
ast const clang::Expr *  

ASTFunctionDeclAttr

Wraps a ‘const clang::FunctionDecl *' AST node.

Operations optionally refer to this node, they could be available depending on the CIR lowering stage. Whether it's attached to the appropriated CIR operation is delegated to the operation verifier.

This always implies a non-null AST reference (verified).

Parameters:

Parameter C++ type Description
ast const clang::FunctionDecl *  

ASTRecordDeclAttr

Wraps a ‘const clang::RecordDecl *' AST node.

Operations optionally refer to this node, they could be available depending on the CIR lowering stage. Whether it's attached to the appropriated CIR operation is delegated to the operation verifier.

This always implies a non-null AST reference (verified).

Parameters:

Parameter C++ type Description
ast const clang::RecordDecl *  

ASTTagDeclAttr

Wraps a ‘const clang::TagDecl *' AST node.

Operations optionally refer to this node, they could be available depending on the CIR lowering stage. Whether it's attached to the appropriated CIR operation is delegated to the operation verifier.

This always implies a non-null AST reference (verified).

Parameters:

Parameter C++ type Description
ast const clang::TagDecl *  

ASTTypeDeclAttr

Wraps a ‘const clang::TypeDecl *' AST node.

Operations optionally refer to this node, they could be available depending on the CIR lowering stage. Whether it's attached to the appropriated CIR operation is delegated to the operation verifier.

This always implies a non-null AST reference (verified).

Parameters:

Parameter C++ type Description
ast const clang::TypeDecl *  

ASTVarDeclAttr

Wraps a ‘const clang::VarDecl *' AST node.

Operations optionally refer to this node, they could be available depending on the CIR lowering stage. Whether it's attached to the appropriated CIR operation is delegated to the operation verifier.

This always implies a non-null AST reference (verified).

Parameters:

Parameter C++ type Description
ast const clang::VarDecl *  

BitfieldInfoAttr

Represents a bit field info

Syntax:

#cir.bitfield_info<
  StringAttr,   # name
  Type,   # storage_type
  uint64_t,   # size
  uint64_t,   # offset
  bool   # is_signed
>

Holds the next information about bitfields: name, storage type, a bitfield size and position in the storage, if the bitfield is signed or not.

Parameters:

Parameter C++ type Description
name StringAttr  
storage_type Type  
size uint64_t  
offset uint64_t  
is_signed bool  

BoolAttr

Represent true/false for !cir.bool types

Syntax:

#cir.bool<
  mlir::cir::BoolType,   # type
  bool   # value
>

The BoolAttr represents a ‘true' or ‘false' value.

Parameters:

Parameter C++ type Description
type mlir::cir::BoolType  
value bool  

ConstArrayAttr

A constant array from ArrayAttr or StringRefAttr

An CIR array attribute is an array of literals of the specified attr types.

Parameters:

Parameter C++ type Description
type ::mlir::Type  
elts Attribute  
trailingZerosNum int  

ConstPtrAttr

Holds a constant pointer value

A pointer attribute is a literal attribute that represents an integral value of a pointer type.

Parameters:

Parameter C++ type Description
type ::mlir::Type  
value uint64_t  

ConstStructAttr

Represents a constant struct

Syntax:

#cir.const_struct<
  ::mlir::Type,   # type
  ArrayAttr   # members
>

Effectively supports "struct-like" constants. It's must be built from an mlir::ArrayAttr instance where each elements is a typed attribute (mlir::TypedAttribute).

Example:

cir.global external @rgb2 = #cir.const_struct<{0 : i8,
                                               5 : i64, #cir.null : !cir.ptr<i8>
                                              }> : !cir.struct<"", i8, i64, !cir.ptr<i8>>

Parameters:

Parameter C++ type Description
type ::mlir::Type  
members ArrayAttr  

ExtraFuncAttributesAttr

Represents aggregated attributes for a function

Syntax:

#cir.extra<
  DictionaryAttr   # elements
>

This is a wrapper of dictionary attrbiute that contains extra attributes of a function.

Parameters:

Parameter C++ type Description
elements DictionaryAttr  

GlobalCtorAttr

Indicates a function is a global constructor.

Syntax:

#cir.globalCtor<
  StringAttr,   # name
  std::optional<int>   # priority
>

Describing a global constructor with an optional priority.

Parameters:

Parameter C++ type Description
name StringAttr  
priority std::optional<int>  

GlobalViewAttr

Provides constant access to a global address

Syntax:

#cir.global_view<
  ::mlir::Type,   # type
  FlatSymbolRefAttr,   # symbol
  ArrayAttr   # indices
>

Get constant address of global symbol and optionally apply offsets to access existing subelements. It provides a way to access globals from other global and always produces a pointer.

The type of the input symbol can be different from #cir.global_view output type, since a given view of the global might require a static cast for initializing other globals.

A list of indices can be optionally passed and each element subsequently indexes underlying types. For symbol types like !cir.array and !cir.struct, it leads to the constant address of sub-elements, while for !cir.ptr, an offset is applied. The first index is relative to the original symbol type, not the produced one.

Example:

  cir.global external @s = @".str2": !cir.ptr<i8>
  cir.global external @x = #cir.global_view<@s> : !cir.ptr<i8>

  cir.global external @rgb = #cir.const_array<[0 : i8, -23 : i8, 33 : i8] : !cir.array<i8 x 3>>
  cir.global external @elt_ptr = #cir.global_view<@rgb, [1]> : !cir.ptr<i8>
  cir.global external @table_of_ptrs = #cir.const_array<[#cir.global_view<@rgb, [1]> : !cir.ptr<i8>] : !cir.array<!cir.ptr<i8> x 1>>

Parameters:

Parameter C++ type Description
type ::mlir::Type  
symbol FlatSymbolRefAttr  
indices ArrayAttr  

InlineAttr

Inline attribute

Syntax:

#cir.inline<
  InlineKind   # value
>

Inline attributes represents user directives.

Parameters:

Parameter C++ type Description
value InlineKind  

IntAttr

An Attribute containing a integer value

An integer attribute is a literal attribute that represents an integral value of the specified integer type.

Parameters:

Parameter C++ type Description
type ::mlir::Type  
value APInt  

LangAttr

Module source language

Represents the source language used to generate the module.

Example:

// Module compiled from C.
module attributes {cir.lang = cir.lang<c>} {}
// Module compiled from C++.
module attributes {cir.lang = cir.lang<cxx>} {}

Parameters:

Parameter C++ type Description
lang ::mlir::cir::SourceLanguage Source language

OptNoneAttr

Syntax: #cir.optnone

SignedOverflowBehaviorAttr

Parameters:

Parameter C++ type Description
behavior sob::SignedOverflowBehavior  

TypeInfoAttr

Represents a typeinfo used for RTTI

Syntax:

#cir.typeinfo<
  ::mlir::Type,   # type
  mlir::ArrayAttr   # data
>

The typeinfo data for a given class is stored into an ArrayAttr. The layout is determined by the C++ ABI used (clang only implements itanium on CIRGen).

The verifier enforces that the output type is always a !cir.struct, and that the ArrayAttr element types match the equivalent member type for the resulting struct, i.e, a GlobalViewAttr for symbol reference or an IntAttr for flags.

Example:

cir.global "private" external @_ZTVN10__cxxabiv120__si_class_type_infoE : !cir.ptr<i32>

cir.global external @type_info_B = #cir.typeinfo<<
  {#cir.global_view<@_ZTVN10__cxxabiv120__si_class_type_infoE, [2]> : !cir.ptr<i8>}
>> : !cir.struct<"", !cir.ptr<i8>>

Parameters:

Parameter C++ type Description
type ::mlir::Type  
data mlir::ArrayAttr  

VTableAttr

Represents a C++ vtable

Syntax:

#cir.vtable<
  ::mlir::Type,   # type
  ArrayAttr   # vtable_data
>

Wraps a #cir.const_struct containing vtable data.

Example:

cir.global linkonce_odr @_ZTV1B = #cir.vtable<<
    {#cir.const_array<[#cir.null : !cir.ptr<i8>,
     #cir.global_view<@_ZTI1B> : !cir.ptr<i8>,
     #cir.global_view<@_ZN1BD1Ev> : !cir.ptr<i8>,
     #cir.global_view<@_ZN1BD0Ev> : !cir.ptr<i8>,
     #cir.global_view<@_ZNK1A5quackEv> : !cir.ptr<i8>]>
     : !cir.array<!cir.ptr<i8> x 5>}>>
  : !cir.struct<"", !cir.array<!cir.ptr<i8> x 5>>

Parameters:

Parameter C++ type Description
type ::mlir::Type  
vtable_data ArrayAttr  

ZeroAttr

Attribute to represent zero initialization

Syntax:

#cir.zero<
  ::mlir::Type   # type
>

The ZeroAttr is used to indicate zero initialization on structs.

Parameters:

Parameter C++ type Description
type ::mlir::Type