#[pliron_type]Expand description
#[pliron_type(...)]: Unified macro for defining IR types.
This macro provides a simplified, unified syntax for defining IR types by expanding into the existing type definition macros. It supports the following configuration options:
name = "dialect.type_name": The fully qualified name of the type (required).
Expands to def_type.format = "format_string": Custom format string for printing/parsing (optional).
Expands to format_type.verifier = "succ": Verifier implementation, currently only “succ” is supported (optional).
Expands to verify_succ.generate_get = true/false: Whether to generate a get method for the type (optional, default: false).
Expands to derive_type_get.
§Examples
§Basic type definition:
use pliron::derive::pliron_type;
#[pliron_type(name = "test.unit_type", format, verifier = "succ")]
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct UnitType;§Type with custom format:
use pliron::derive::pliron_type;
#[pliron_type(
name = "test.flags_type",
format = "`type` `{` $flags `}`",
verifier = "succ"
)]
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
struct FlagsType {
flags: u32,
}§Type with get method generation:
use pliron::derive::pliron_type;
#[pliron_type(
name = "test.vector_type",
generate_get = true,
format,
verifier = "succ"
)]
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
struct VectorType {
elem_ty: u32,
num_elems: u32,
}