Skip to content

CIR Dialect Struct Type Recursive Reference #231

@chenghuaWang

Description

@chenghuaWang

In CIRTypes.td. Struct Type is defined. And it's parameters is shown below:

let parameters = (ins
    ArrayRefParameter<"mlir::Type", "members">:$members,
    "mlir::StringAttr":$typeName,
    "bool":$body,
    "bool":$packed,
    "std::optional<::mlir::cir::ASTRecordDeclAttr>":$ast
  );

You used a Array of mlir::Type(ArrayRefParameter<"mlir::Type", "members">) to figure out the content in a struct type.

But how do I represent Recursive Reference using CIR_StructType? The Recursive Reference will lowring to llvm dialect like code below:

!llvm.struct<"a", ptr<struct<"a">>>  // example of recursive reference

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions