Skip to main content

operands

Attribute Macro operands 

Source
#[operands]
Expand description

Derive getter methods and / or operand type interfaces for operation operands.

Note: It is suggested to use the pliron_op macro instead of using this macro directly. The documention here is useful though, because pliron_op’s operands field expands to this macro.

The arguments are a comma-separated list where each entry is:

  • name or name: Type for a named operand getter get_operand_<name>().
  • _ or _: Type to skip getter generation for that position.

When Type is provided, this macro derives OperandNOfType for the corresponding operand index.

The op is allowed to have more operands than those specified in the macro arguments. They just won’t have getters or type interfaces generated for them.

use pliron::derive::{def_op, format_op, operands, verify_succ};
use pliron::builtin::types::{IntegerType, UnitType};

#[verify_succ]
#[def_op("dialect.with_operands")]
#[format_op]
#[operands(lhs: IntegerType, _, rhs, _: UnitType)]
pub struct WithOperandsOp {}