Skip to content

Warning

This page is under construction. The content may be incomplete or incorrect. Submit an issue on GitHub if you need help or want to contribute.

Core Python Dialects

This page contains the core Python dialects that are used most frequently when designing an embedded DSL in Python.

Reference

Base

kirin.dialects.py.base

Base dialect for Python.

This dialect does not contain statements. It only contains lowering rules for ast.Name and ast.Expr.

dialect module-attribute

dialect = Dialect('py.base')

PyAttrMethod

Bases: MethodTable


              flowchart TD
              kirin.dialects.py.base.PyAttrMethod[PyAttrMethod]
              kirin.interp.table.MethodTable[MethodTable]

                              kirin.interp.table.MethodTable --> kirin.dialects.py.base.PyAttrMethod
                


              click kirin.dialects.py.base.PyAttrMethod href "" "kirin.dialects.py.base.PyAttrMethod"
              click kirin.interp.table.MethodTable href "" "kirin.interp.table.MethodTable"
            

py_attr

py_attr(interp, frame: Frame, node: PyAttr)
Source code in src/kirin/dialects/py/base.py
38
39
40
@interp.impl(ir.PyAttr)
def py_attr(self, interp, frame: interp.Frame, node: ir.PyAttr):
    return repr(node.data)

PythonLowering dataclass

PythonLowering()

Bases: FromPythonAST


              flowchart TD
              kirin.dialects.py.base.PythonLowering[PythonLowering]
              kirin.lowering.python.dialect.FromPythonAST[FromPythonAST]

                              kirin.lowering.python.dialect.FromPythonAST --> kirin.dialects.py.base.PythonLowering
                


              click kirin.dialects.py.base.PythonLowering href "" "kirin.dialects.py.base.PythonLowering"
              click kirin.lowering.python.dialect.FromPythonAST href "" "kirin.lowering.python.dialect.FromPythonAST"
            

lower_Expr

lower_Expr(state: State, node: Expr) -> lowering.Result
Source code in src/kirin/dialects/py/base.py
31
32
def lower_Expr(self, state: lowering.State, node: ast.Expr) -> lowering.Result:
    return cast(Result, state.parent.visit(state, node.value))

lower_Name

lower_Name(state: State, node: Name) -> lowering.Result
Source code in src/kirin/dialects/py/base.py
19
20
21
22
23
24
25
26
27
28
29
def lower_Name(self, state: lowering.State, node: ast.Name) -> lowering.Result:
    name = node.id
    if isinstance(node.ctx, ast.Load):
        value = state.current_frame.get(name)
        if value is None:
            raise lowering.BuildError(f"{name} is not defined")
        return value
    elif isinstance(node.ctx, ast.Store):
        raise lowering.BuildError("unhandled store operation")
    else:  # Del
        raise lowering.BuildError("unhandled del operation")

Constant

kirin.dialects.py.constant

Constant statement for Python dialect.

This module contains the dialect for the Python constant statement, including:

  • The Constant statement class.
  • The lowering pass for the constant statement.
  • The concrete implementation of the constant statement.
  • The Julia emitter for the constant statement.

This dialect maps ast.Constant nodes to the Constant statement.

T module-attribute

T = TypeVar('T', covariant=True)

dialect module-attribute

dialect = Dialect('py.constant')

Concrete

Bases: MethodTable


              flowchart TD
              kirin.dialects.py.constant.Concrete[Concrete]
              kirin.interp.table.MethodTable[MethodTable]

                              kirin.interp.table.MethodTable --> kirin.dialects.py.constant.Concrete
                


              click kirin.dialects.py.constant.Concrete href "" "kirin.dialects.py.constant.Concrete"
              click kirin.interp.table.MethodTable href "" "kirin.interp.table.MethodTable"
            

constant

constant(interp, frame: Frame, stmt: Constant)
Source code in src/kirin/dialects/py/constant.py
83
84
85
@interp.impl(Constant)
def constant(self, interp, frame: interp.Frame, stmt: Constant):
    return (stmt.value.unwrap(),)

Constant

Constant(value: T | Data[T])

Bases: Statement, Generic[T]


              flowchart TD
              kirin.dialects.py.constant.Constant[Constant]
              kirin.ir.nodes.stmt.Statement[Statement]
              kirin.ir.nodes.base.IRNode[IRNode]
              kirin.print.printable.Printable[Printable]

                              kirin.ir.nodes.stmt.Statement --> kirin.dialects.py.constant.Constant
                                kirin.ir.nodes.base.IRNode --> kirin.ir.nodes.stmt.Statement
                                kirin.print.printable.Printable --> kirin.ir.nodes.base.IRNode
                




              click kirin.dialects.py.constant.Constant href "" "kirin.dialects.py.constant.Constant"
              click kirin.ir.nodes.stmt.Statement href "" "kirin.ir.nodes.stmt.Statement"
              click kirin.ir.nodes.base.IRNode href "" "kirin.ir.nodes.base.IRNode"
              click kirin.print.printable.Printable href "" "kirin.print.printable.Printable"
            
Source code in src/kirin/dialects/py/constant.py
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
def __init__(self, value: T | ir.Data[T]) -> None:
    data: ir.Data[Any]
    if isinstance(value, ir.Method):
        arg_types = cast(tuple[types.TypeAttribute, ...], value.arg_types)
        return_type = cast(types.TypeAttribute, value.return_type)
        data = ir.PyAttr(value, pytype=types.FunctionType(arg_types, return_type))
    elif isinstance(value, ir.Data):
        data = value
    else:
        data = ir.PyAttr(value)

    super().__init__(
        attributes={"value": data},
        result_types=(data.type,),
    )

name class-attribute instance-attribute

name = 'constant'

result class-attribute instance-attribute

result: ResultValue = result()

traits class-attribute instance-attribute

traits = frozenset(
    {Pure(), ConstantLike(), FromPythonCall()}
)

value class-attribute instance-attribute

value: Data[T] = attribute()

check_type

check_type() -> None

Check the types of the Block. Raises Exception if the types are not correct. This method is called by the verify_type method, which will detect the source of the error in the IR. One should always call the verify_type method to verify the types of the IR.

Note

This method is generated by the @statement decorator. But can be overridden if needed.

Source code in src/kirin/dialects/py/constant.py
62
63
64
65
66
def check_type(self) -> None:
    if not isinstance(self.result.type, types.TypeAttribute):
        raise TypeError(
            f"Expected result type to be PyType, got {self.result.type}"
        )

print_impl

print_impl(printer: Printer) -> None
Source code in src/kirin/dialects/py/constant.py
51
52
53
54
55
56
57
58
59
60
def print_impl(self, printer: Printer) -> None:
    printer.print_name(self)
    printer.plain_print(" ")
    if isinstance(self.value, ir.PyAttr):
        printer.plain_print(repr(self.value.data))
    else:  # other attributes
        printer.plain_print(repr(self.value))
    with printer.rich(style="comment"):
        printer.plain_print(" : ")
        printer.print(self.result.type)

Julia

Bases: MethodTable


              flowchart TD
              kirin.dialects.py.constant.Julia[Julia]
              kirin.interp.table.MethodTable[MethodTable]

                              kirin.interp.table.MethodTable --> kirin.dialects.py.constant.Julia
                


              click kirin.dialects.py.constant.Julia href "" "kirin.dialects.py.constant.Julia"
              click kirin.interp.table.MethodTable href "" "kirin.interp.table.MethodTable"
            

constant

constant(emit: Julia, frame: JuliaFrame, stmt: Constant)
Source code in src/kirin/dialects/py/constant.py
91
92
93
@interp.impl(Constant)
def constant(self, emit: emit.Julia, frame: emit.JuliaFrame, stmt: Constant):
    return (emit.get_attribute(frame, stmt.value),)

Lowering dataclass

Lowering()

Bases: FromPythonAST


              flowchart TD
              kirin.dialects.py.constant.Lowering[Lowering]
              kirin.lowering.python.dialect.FromPythonAST[FromPythonAST]

                              kirin.lowering.python.dialect.FromPythonAST --> kirin.dialects.py.constant.Lowering
                


              click kirin.dialects.py.constant.Lowering href "" "kirin.dialects.py.constant.Lowering"
              click kirin.lowering.python.dialect.FromPythonAST href "" "kirin.lowering.python.dialect.FromPythonAST"
            

lower_Constant

lower_Constant(
    state: State, node: Constant
) -> lowering.Result
Source code in src/kirin/dialects/py/constant.py
72
73
74
75
76
77
def lower_Constant(
    self, state: lowering.State, node: ast.Constant
) -> lowering.Result:
    return state.current_frame.push(
        Constant(node.value),
    )

UnaryOp

kirin.dialects.py.unary.stmts

T module-attribute

T = TypeVar('T')

Invert dataclass

Invert(
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None
)

Bases: UnaryOp


              flowchart TD
              kirin.dialects.py.unary.stmts.Invert[Invert]
              kirin.dialects.py.unary.stmts.UnaryOp[UnaryOp]
              kirin.ir.nodes.stmt.Statement[Statement]
              kirin.ir.nodes.base.IRNode[IRNode]
              kirin.print.printable.Printable[Printable]

                              kirin.dialects.py.unary.stmts.UnaryOp --> kirin.dialects.py.unary.stmts.Invert
                                kirin.ir.nodes.stmt.Statement --> kirin.dialects.py.unary.stmts.UnaryOp
                                kirin.ir.nodes.base.IRNode --> kirin.ir.nodes.stmt.Statement
                                kirin.print.printable.Printable --> kirin.ir.nodes.base.IRNode
                





              click kirin.dialects.py.unary.stmts.Invert href "" "kirin.dialects.py.unary.stmts.Invert"
              click kirin.dialects.py.unary.stmts.UnaryOp href "" "kirin.dialects.py.unary.stmts.UnaryOp"
              click kirin.ir.nodes.stmt.Statement href "" "kirin.ir.nodes.stmt.Statement"
              click kirin.ir.nodes.base.IRNode href "" "kirin.ir.nodes.base.IRNode"
              click kirin.print.printable.Printable href "" "kirin.print.printable.Printable"
            
Source code in src/kirin/ir/nodes/stmt.py
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
def __init__(
    self,
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None,
) -> None:
    super().__init__()
    """Initialize the Statement.

    Args:
        arsg (Sequence[SSAValue], optional): The arguments of the Statement. Defaults to ().
        regions (Sequence[Region], optional): The regions where the Statement belong to. Defaults to ().
        successors (Sequence[Block], optional): The successors of the Statement. Defaults to ().
        attributes (Mapping[str, Attribute], optional): The attributes of the Statement. Defaults to {}.
        results (Sequence[ResultValue], optional): The result values of the Statement. Defaults to ().
        result_types (Sequence[TypeAttribute], optional): The result types of the Statement. Defaults to ().
        args_slice (Mapping[str, int | slice], optional): The arguments slice of the Statement. Defaults to {}.
        source (SourceInfo | None, optional): The source information of the Statement for debugging/stacktracing. Defaults to None.

    """
    self._args = ()
    self._regions = []
    self._name_args_slice = dict(args_slice)
    self.source = source
    self.args = args

    if results:
        self._results = list(results)
        assert (
            len(result_types) == 0
        ), "expect either results or result_types specified, got both"

    if result_types:
        self._results = [
            ResultValue(self, idx, type=type)
            for idx, type in enumerate(result_types)
        ]

    if not results and not result_types:
        self._results = list(results)

    self.successors = list(successors)
    self.attributes = dict(attributes)
    self.regions = list(regions)

    self.parent = None
    self._next_stmt = None
    self._prev_stmt = None
    self.__post_init__()

name class-attribute instance-attribute

name = 'invert'

Not dataclass

Not(
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None
)

Bases: UnaryOp


              flowchart TD
              kirin.dialects.py.unary.stmts.Not[Not]
              kirin.dialects.py.unary.stmts.UnaryOp[UnaryOp]
              kirin.ir.nodes.stmt.Statement[Statement]
              kirin.ir.nodes.base.IRNode[IRNode]
              kirin.print.printable.Printable[Printable]

                              kirin.dialects.py.unary.stmts.UnaryOp --> kirin.dialects.py.unary.stmts.Not
                                kirin.ir.nodes.stmt.Statement --> kirin.dialects.py.unary.stmts.UnaryOp
                                kirin.ir.nodes.base.IRNode --> kirin.ir.nodes.stmt.Statement
                                kirin.print.printable.Printable --> kirin.ir.nodes.base.IRNode
                





              click kirin.dialects.py.unary.stmts.Not href "" "kirin.dialects.py.unary.stmts.Not"
              click kirin.dialects.py.unary.stmts.UnaryOp href "" "kirin.dialects.py.unary.stmts.UnaryOp"
              click kirin.ir.nodes.stmt.Statement href "" "kirin.ir.nodes.stmt.Statement"
              click kirin.ir.nodes.base.IRNode href "" "kirin.ir.nodes.base.IRNode"
              click kirin.print.printable.Printable href "" "kirin.print.printable.Printable"
            
Source code in src/kirin/ir/nodes/stmt.py
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
def __init__(
    self,
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None,
) -> None:
    super().__init__()
    """Initialize the Statement.

    Args:
        arsg (Sequence[SSAValue], optional): The arguments of the Statement. Defaults to ().
        regions (Sequence[Region], optional): The regions where the Statement belong to. Defaults to ().
        successors (Sequence[Block], optional): The successors of the Statement. Defaults to ().
        attributes (Mapping[str, Attribute], optional): The attributes of the Statement. Defaults to {}.
        results (Sequence[ResultValue], optional): The result values of the Statement. Defaults to ().
        result_types (Sequence[TypeAttribute], optional): The result types of the Statement. Defaults to ().
        args_slice (Mapping[str, int | slice], optional): The arguments slice of the Statement. Defaults to {}.
        source (SourceInfo | None, optional): The source information of the Statement for debugging/stacktracing. Defaults to None.

    """
    self._args = ()
    self._regions = []
    self._name_args_slice = dict(args_slice)
    self.source = source
    self.args = args

    if results:
        self._results = list(results)
        assert (
            len(result_types) == 0
        ), "expect either results or result_types specified, got both"

    if result_types:
        self._results = [
            ResultValue(self, idx, type=type)
            for idx, type in enumerate(result_types)
        ]

    if not results and not result_types:
        self._results = list(results)

    self.successors = list(successors)
    self.attributes = dict(attributes)
    self.regions = list(regions)

    self.parent = None
    self._next_stmt = None
    self._prev_stmt = None
    self.__post_init__()

name class-attribute instance-attribute

name = 'not'

UAdd dataclass

UAdd(
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None
)

Bases: UnaryOp


              flowchart TD
              kirin.dialects.py.unary.stmts.UAdd[UAdd]
              kirin.dialects.py.unary.stmts.UnaryOp[UnaryOp]
              kirin.ir.nodes.stmt.Statement[Statement]
              kirin.ir.nodes.base.IRNode[IRNode]
              kirin.print.printable.Printable[Printable]

                              kirin.dialects.py.unary.stmts.UnaryOp --> kirin.dialects.py.unary.stmts.UAdd
                                kirin.ir.nodes.stmt.Statement --> kirin.dialects.py.unary.stmts.UnaryOp
                                kirin.ir.nodes.base.IRNode --> kirin.ir.nodes.stmt.Statement
                                kirin.print.printable.Printable --> kirin.ir.nodes.base.IRNode
                





              click kirin.dialects.py.unary.stmts.UAdd href "" "kirin.dialects.py.unary.stmts.UAdd"
              click kirin.dialects.py.unary.stmts.UnaryOp href "" "kirin.dialects.py.unary.stmts.UnaryOp"
              click kirin.ir.nodes.stmt.Statement href "" "kirin.ir.nodes.stmt.Statement"
              click kirin.ir.nodes.base.IRNode href "" "kirin.ir.nodes.base.IRNode"
              click kirin.print.printable.Printable href "" "kirin.print.printable.Printable"
            
Source code in src/kirin/ir/nodes/stmt.py
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
def __init__(
    self,
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None,
) -> None:
    super().__init__()
    """Initialize the Statement.

    Args:
        arsg (Sequence[SSAValue], optional): The arguments of the Statement. Defaults to ().
        regions (Sequence[Region], optional): The regions where the Statement belong to. Defaults to ().
        successors (Sequence[Block], optional): The successors of the Statement. Defaults to ().
        attributes (Mapping[str, Attribute], optional): The attributes of the Statement. Defaults to {}.
        results (Sequence[ResultValue], optional): The result values of the Statement. Defaults to ().
        result_types (Sequence[TypeAttribute], optional): The result types of the Statement. Defaults to ().
        args_slice (Mapping[str, int | slice], optional): The arguments slice of the Statement. Defaults to {}.
        source (SourceInfo | None, optional): The source information of the Statement for debugging/stacktracing. Defaults to None.

    """
    self._args = ()
    self._regions = []
    self._name_args_slice = dict(args_slice)
    self.source = source
    self.args = args

    if results:
        self._results = list(results)
        assert (
            len(result_types) == 0
        ), "expect either results or result_types specified, got both"

    if result_types:
        self._results = [
            ResultValue(self, idx, type=type)
            for idx, type in enumerate(result_types)
        ]

    if not results and not result_types:
        self._results = list(results)

    self.successors = list(successors)
    self.attributes = dict(attributes)
    self.regions = list(regions)

    self.parent = None
    self._next_stmt = None
    self._prev_stmt = None
    self.__post_init__()

name class-attribute instance-attribute

name = 'uadd'

USub dataclass

USub(
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None
)

Bases: UnaryOp


              flowchart TD
              kirin.dialects.py.unary.stmts.USub[USub]
              kirin.dialects.py.unary.stmts.UnaryOp[UnaryOp]
              kirin.ir.nodes.stmt.Statement[Statement]
              kirin.ir.nodes.base.IRNode[IRNode]
              kirin.print.printable.Printable[Printable]

                              kirin.dialects.py.unary.stmts.UnaryOp --> kirin.dialects.py.unary.stmts.USub
                                kirin.ir.nodes.stmt.Statement --> kirin.dialects.py.unary.stmts.UnaryOp
                                kirin.ir.nodes.base.IRNode --> kirin.ir.nodes.stmt.Statement
                                kirin.print.printable.Printable --> kirin.ir.nodes.base.IRNode
                





              click kirin.dialects.py.unary.stmts.USub href "" "kirin.dialects.py.unary.stmts.USub"
              click kirin.dialects.py.unary.stmts.UnaryOp href "" "kirin.dialects.py.unary.stmts.UnaryOp"
              click kirin.ir.nodes.stmt.Statement href "" "kirin.ir.nodes.stmt.Statement"
              click kirin.ir.nodes.base.IRNode href "" "kirin.ir.nodes.base.IRNode"
              click kirin.print.printable.Printable href "" "kirin.print.printable.Printable"
            
Source code in src/kirin/ir/nodes/stmt.py
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
def __init__(
    self,
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None,
) -> None:
    super().__init__()
    """Initialize the Statement.

    Args:
        arsg (Sequence[SSAValue], optional): The arguments of the Statement. Defaults to ().
        regions (Sequence[Region], optional): The regions where the Statement belong to. Defaults to ().
        successors (Sequence[Block], optional): The successors of the Statement. Defaults to ().
        attributes (Mapping[str, Attribute], optional): The attributes of the Statement. Defaults to {}.
        results (Sequence[ResultValue], optional): The result values of the Statement. Defaults to ().
        result_types (Sequence[TypeAttribute], optional): The result types of the Statement. Defaults to ().
        args_slice (Mapping[str, int | slice], optional): The arguments slice of the Statement. Defaults to {}.
        source (SourceInfo | None, optional): The source information of the Statement for debugging/stacktracing. Defaults to None.

    """
    self._args = ()
    self._regions = []
    self._name_args_slice = dict(args_slice)
    self.source = source
    self.args = args

    if results:
        self._results = list(results)
        assert (
            len(result_types) == 0
        ), "expect either results or result_types specified, got both"

    if result_types:
        self._results = [
            ResultValue(self, idx, type=type)
            for idx, type in enumerate(result_types)
        ]

    if not results and not result_types:
        self._results = list(results)

    self.successors = list(successors)
    self.attributes = dict(attributes)
    self.regions = list(regions)

    self.parent = None
    self._next_stmt = None
    self._prev_stmt = None
    self.__post_init__()

name class-attribute instance-attribute

name = 'usub'

UnaryOp dataclass

UnaryOp(
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None
)

Bases: Statement


              flowchart TD
              kirin.dialects.py.unary.stmts.UnaryOp[UnaryOp]
              kirin.ir.nodes.stmt.Statement[Statement]
              kirin.ir.nodes.base.IRNode[IRNode]
              kirin.print.printable.Printable[Printable]

                              kirin.ir.nodes.stmt.Statement --> kirin.dialects.py.unary.stmts.UnaryOp
                                kirin.ir.nodes.base.IRNode --> kirin.ir.nodes.stmt.Statement
                                kirin.print.printable.Printable --> kirin.ir.nodes.base.IRNode
                




              click kirin.dialects.py.unary.stmts.UnaryOp href "" "kirin.dialects.py.unary.stmts.UnaryOp"
              click kirin.ir.nodes.stmt.Statement href "" "kirin.ir.nodes.stmt.Statement"
              click kirin.ir.nodes.base.IRNode href "" "kirin.ir.nodes.base.IRNode"
              click kirin.print.printable.Printable href "" "kirin.print.printable.Printable"
            
Source code in src/kirin/ir/nodes/stmt.py
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
def __init__(
    self,
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None,
) -> None:
    super().__init__()
    """Initialize the Statement.

    Args:
        arsg (Sequence[SSAValue], optional): The arguments of the Statement. Defaults to ().
        regions (Sequence[Region], optional): The regions where the Statement belong to. Defaults to ().
        successors (Sequence[Block], optional): The successors of the Statement. Defaults to ().
        attributes (Mapping[str, Attribute], optional): The attributes of the Statement. Defaults to {}.
        results (Sequence[ResultValue], optional): The result values of the Statement. Defaults to ().
        result_types (Sequence[TypeAttribute], optional): The result types of the Statement. Defaults to ().
        args_slice (Mapping[str, int | slice], optional): The arguments slice of the Statement. Defaults to {}.
        source (SourceInfo | None, optional): The source information of the Statement for debugging/stacktracing. Defaults to None.

    """
    self._args = ()
    self._regions = []
    self._name_args_slice = dict(args_slice)
    self.source = source
    self.args = args

    if results:
        self._results = list(results)
        assert (
            len(result_types) == 0
        ), "expect either results or result_types specified, got both"

    if result_types:
        self._results = [
            ResultValue(self, idx, type=type)
            for idx, type in enumerate(result_types)
        ]

    if not results and not result_types:
        self._results = list(results)

    self.successors = list(successors)
    self.attributes = dict(attributes)
    self.regions = list(regions)

    self.parent = None
    self._next_stmt = None
    self._prev_stmt = None
    self.__post_init__()

result class-attribute instance-attribute

result: ResultValue = result(T)

traits class-attribute instance-attribute

traits = frozenset({Pure(), FromPythonCall()})

value class-attribute instance-attribute

value: SSAValue = argument(T, print=False)

BinOp

kirin.dialects.py.binop.stmts

T module-attribute

T = TypeVar('T')

Add dataclass

Add(
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None
)

Bases: BinOp


              flowchart TD
              kirin.dialects.py.binop.stmts.Add[Add]
              kirin.dialects.py.binop.stmts.BinOp[BinOp]
              kirin.ir.nodes.stmt.Statement[Statement]
              kirin.ir.nodes.base.IRNode[IRNode]
              kirin.print.printable.Printable[Printable]

                              kirin.dialects.py.binop.stmts.BinOp --> kirin.dialects.py.binop.stmts.Add
                                kirin.ir.nodes.stmt.Statement --> kirin.dialects.py.binop.stmts.BinOp
                                kirin.ir.nodes.base.IRNode --> kirin.ir.nodes.stmt.Statement
                                kirin.print.printable.Printable --> kirin.ir.nodes.base.IRNode
                





              click kirin.dialects.py.binop.stmts.Add href "" "kirin.dialects.py.binop.stmts.Add"
              click kirin.dialects.py.binop.stmts.BinOp href "" "kirin.dialects.py.binop.stmts.BinOp"
              click kirin.ir.nodes.stmt.Statement href "" "kirin.ir.nodes.stmt.Statement"
              click kirin.ir.nodes.base.IRNode href "" "kirin.ir.nodes.base.IRNode"
              click kirin.print.printable.Printable href "" "kirin.print.printable.Printable"
            
Source code in src/kirin/ir/nodes/stmt.py
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
def __init__(
    self,
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None,
) -> None:
    super().__init__()
    """Initialize the Statement.

    Args:
        arsg (Sequence[SSAValue], optional): The arguments of the Statement. Defaults to ().
        regions (Sequence[Region], optional): The regions where the Statement belong to. Defaults to ().
        successors (Sequence[Block], optional): The successors of the Statement. Defaults to ().
        attributes (Mapping[str, Attribute], optional): The attributes of the Statement. Defaults to {}.
        results (Sequence[ResultValue], optional): The result values of the Statement. Defaults to ().
        result_types (Sequence[TypeAttribute], optional): The result types of the Statement. Defaults to ().
        args_slice (Mapping[str, int | slice], optional): The arguments slice of the Statement. Defaults to {}.
        source (SourceInfo | None, optional): The source information of the Statement for debugging/stacktracing. Defaults to None.

    """
    self._args = ()
    self._regions = []
    self._name_args_slice = dict(args_slice)
    self.source = source
    self.args = args

    if results:
        self._results = list(results)
        assert (
            len(result_types) == 0
        ), "expect either results or result_types specified, got both"

    if result_types:
        self._results = [
            ResultValue(self, idx, type=type)
            for idx, type in enumerate(result_types)
        ]

    if not results and not result_types:
        self._results = list(results)

    self.successors = list(successors)
    self.attributes = dict(attributes)
    self.regions = list(regions)

    self.parent = None
    self._next_stmt = None
    self._prev_stmt = None
    self.__post_init__()

name class-attribute instance-attribute

name = 'add'

BinOp dataclass

BinOp(
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None
)

Bases: Statement


              flowchart TD
              kirin.dialects.py.binop.stmts.BinOp[BinOp]
              kirin.ir.nodes.stmt.Statement[Statement]
              kirin.ir.nodes.base.IRNode[IRNode]
              kirin.print.printable.Printable[Printable]

                              kirin.ir.nodes.stmt.Statement --> kirin.dialects.py.binop.stmts.BinOp
                                kirin.ir.nodes.base.IRNode --> kirin.ir.nodes.stmt.Statement
                                kirin.print.printable.Printable --> kirin.ir.nodes.base.IRNode
                




              click kirin.dialects.py.binop.stmts.BinOp href "" "kirin.dialects.py.binop.stmts.BinOp"
              click kirin.ir.nodes.stmt.Statement href "" "kirin.ir.nodes.stmt.Statement"
              click kirin.ir.nodes.base.IRNode href "" "kirin.ir.nodes.base.IRNode"
              click kirin.print.printable.Printable href "" "kirin.print.printable.Printable"
            
Source code in src/kirin/ir/nodes/stmt.py
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
def __init__(
    self,
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None,
) -> None:
    super().__init__()
    """Initialize the Statement.

    Args:
        arsg (Sequence[SSAValue], optional): The arguments of the Statement. Defaults to ().
        regions (Sequence[Region], optional): The regions where the Statement belong to. Defaults to ().
        successors (Sequence[Block], optional): The successors of the Statement. Defaults to ().
        attributes (Mapping[str, Attribute], optional): The attributes of the Statement. Defaults to {}.
        results (Sequence[ResultValue], optional): The result values of the Statement. Defaults to ().
        result_types (Sequence[TypeAttribute], optional): The result types of the Statement. Defaults to ().
        args_slice (Mapping[str, int | slice], optional): The arguments slice of the Statement. Defaults to {}.
        source (SourceInfo | None, optional): The source information of the Statement for debugging/stacktracing. Defaults to None.

    """
    self._args = ()
    self._regions = []
    self._name_args_slice = dict(args_slice)
    self.source = source
    self.args = args

    if results:
        self._results = list(results)
        assert (
            len(result_types) == 0
        ), "expect either results or result_types specified, got both"

    if result_types:
        self._results = [
            ResultValue(self, idx, type=type)
            for idx, type in enumerate(result_types)
        ]

    if not results and not result_types:
        self._results = list(results)

    self.successors = list(successors)
    self.attributes = dict(attributes)
    self.regions = list(regions)

    self.parent = None
    self._next_stmt = None
    self._prev_stmt = None
    self.__post_init__()

lhs class-attribute instance-attribute

lhs: SSAValue = argument(T, print=False)

result class-attribute instance-attribute

result: ResultValue = result(T)

rhs class-attribute instance-attribute

rhs: SSAValue = argument(T, print=False)

traits class-attribute instance-attribute

traits = frozenset({Pure(), FromPythonCall()})

BitAnd dataclass

BitAnd(
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None
)

Bases: BinOp


              flowchart TD
              kirin.dialects.py.binop.stmts.BitAnd[BitAnd]
              kirin.dialects.py.binop.stmts.BinOp[BinOp]
              kirin.ir.nodes.stmt.Statement[Statement]
              kirin.ir.nodes.base.IRNode[IRNode]
              kirin.print.printable.Printable[Printable]

                              kirin.dialects.py.binop.stmts.BinOp --> kirin.dialects.py.binop.stmts.BitAnd
                                kirin.ir.nodes.stmt.Statement --> kirin.dialects.py.binop.stmts.BinOp
                                kirin.ir.nodes.base.IRNode --> kirin.ir.nodes.stmt.Statement
                                kirin.print.printable.Printable --> kirin.ir.nodes.base.IRNode
                





              click kirin.dialects.py.binop.stmts.BitAnd href "" "kirin.dialects.py.binop.stmts.BitAnd"
              click kirin.dialects.py.binop.stmts.BinOp href "" "kirin.dialects.py.binop.stmts.BinOp"
              click kirin.ir.nodes.stmt.Statement href "" "kirin.ir.nodes.stmt.Statement"
              click kirin.ir.nodes.base.IRNode href "" "kirin.ir.nodes.base.IRNode"
              click kirin.print.printable.Printable href "" "kirin.print.printable.Printable"
            
Source code in src/kirin/ir/nodes/stmt.py
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
def __init__(
    self,
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None,
) -> None:
    super().__init__()
    """Initialize the Statement.

    Args:
        arsg (Sequence[SSAValue], optional): The arguments of the Statement. Defaults to ().
        regions (Sequence[Region], optional): The regions where the Statement belong to. Defaults to ().
        successors (Sequence[Block], optional): The successors of the Statement. Defaults to ().
        attributes (Mapping[str, Attribute], optional): The attributes of the Statement. Defaults to {}.
        results (Sequence[ResultValue], optional): The result values of the Statement. Defaults to ().
        result_types (Sequence[TypeAttribute], optional): The result types of the Statement. Defaults to ().
        args_slice (Mapping[str, int | slice], optional): The arguments slice of the Statement. Defaults to {}.
        source (SourceInfo | None, optional): The source information of the Statement for debugging/stacktracing. Defaults to None.

    """
    self._args = ()
    self._regions = []
    self._name_args_slice = dict(args_slice)
    self.source = source
    self.args = args

    if results:
        self._results = list(results)
        assert (
            len(result_types) == 0
        ), "expect either results or result_types specified, got both"

    if result_types:
        self._results = [
            ResultValue(self, idx, type=type)
            for idx, type in enumerate(result_types)
        ]

    if not results and not result_types:
        self._results = list(results)

    self.successors = list(successors)
    self.attributes = dict(attributes)
    self.regions = list(regions)

    self.parent = None
    self._next_stmt = None
    self._prev_stmt = None
    self.__post_init__()

name class-attribute instance-attribute

name = 'bitand'

BitOr dataclass

BitOr(
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None
)

Bases: BinOp


              flowchart TD
              kirin.dialects.py.binop.stmts.BitOr[BitOr]
              kirin.dialects.py.binop.stmts.BinOp[BinOp]
              kirin.ir.nodes.stmt.Statement[Statement]
              kirin.ir.nodes.base.IRNode[IRNode]
              kirin.print.printable.Printable[Printable]

                              kirin.dialects.py.binop.stmts.BinOp --> kirin.dialects.py.binop.stmts.BitOr
                                kirin.ir.nodes.stmt.Statement --> kirin.dialects.py.binop.stmts.BinOp
                                kirin.ir.nodes.base.IRNode --> kirin.ir.nodes.stmt.Statement
                                kirin.print.printable.Printable --> kirin.ir.nodes.base.IRNode
                





              click kirin.dialects.py.binop.stmts.BitOr href "" "kirin.dialects.py.binop.stmts.BitOr"
              click kirin.dialects.py.binop.stmts.BinOp href "" "kirin.dialects.py.binop.stmts.BinOp"
              click kirin.ir.nodes.stmt.Statement href "" "kirin.ir.nodes.stmt.Statement"
              click kirin.ir.nodes.base.IRNode href "" "kirin.ir.nodes.base.IRNode"
              click kirin.print.printable.Printable href "" "kirin.print.printable.Printable"
            
Source code in src/kirin/ir/nodes/stmt.py
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
def __init__(
    self,
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None,
) -> None:
    super().__init__()
    """Initialize the Statement.

    Args:
        arsg (Sequence[SSAValue], optional): The arguments of the Statement. Defaults to ().
        regions (Sequence[Region], optional): The regions where the Statement belong to. Defaults to ().
        successors (Sequence[Block], optional): The successors of the Statement. Defaults to ().
        attributes (Mapping[str, Attribute], optional): The attributes of the Statement. Defaults to {}.
        results (Sequence[ResultValue], optional): The result values of the Statement. Defaults to ().
        result_types (Sequence[TypeAttribute], optional): The result types of the Statement. Defaults to ().
        args_slice (Mapping[str, int | slice], optional): The arguments slice of the Statement. Defaults to {}.
        source (SourceInfo | None, optional): The source information of the Statement for debugging/stacktracing. Defaults to None.

    """
    self._args = ()
    self._regions = []
    self._name_args_slice = dict(args_slice)
    self.source = source
    self.args = args

    if results:
        self._results = list(results)
        assert (
            len(result_types) == 0
        ), "expect either results or result_types specified, got both"

    if result_types:
        self._results = [
            ResultValue(self, idx, type=type)
            for idx, type in enumerate(result_types)
        ]

    if not results and not result_types:
        self._results = list(results)

    self.successors = list(successors)
    self.attributes = dict(attributes)
    self.regions = list(regions)

    self.parent = None
    self._next_stmt = None
    self._prev_stmt = None
    self.__post_init__()

name class-attribute instance-attribute

name = 'bitor'

BitXor dataclass

BitXor(
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None
)

Bases: BinOp


              flowchart TD
              kirin.dialects.py.binop.stmts.BitXor[BitXor]
              kirin.dialects.py.binop.stmts.BinOp[BinOp]
              kirin.ir.nodes.stmt.Statement[Statement]
              kirin.ir.nodes.base.IRNode[IRNode]
              kirin.print.printable.Printable[Printable]

                              kirin.dialects.py.binop.stmts.BinOp --> kirin.dialects.py.binop.stmts.BitXor
                                kirin.ir.nodes.stmt.Statement --> kirin.dialects.py.binop.stmts.BinOp
                                kirin.ir.nodes.base.IRNode --> kirin.ir.nodes.stmt.Statement
                                kirin.print.printable.Printable --> kirin.ir.nodes.base.IRNode
                





              click kirin.dialects.py.binop.stmts.BitXor href "" "kirin.dialects.py.binop.stmts.BitXor"
              click kirin.dialects.py.binop.stmts.BinOp href "" "kirin.dialects.py.binop.stmts.BinOp"
              click kirin.ir.nodes.stmt.Statement href "" "kirin.ir.nodes.stmt.Statement"
              click kirin.ir.nodes.base.IRNode href "" "kirin.ir.nodes.base.IRNode"
              click kirin.print.printable.Printable href "" "kirin.print.printable.Printable"
            
Source code in src/kirin/ir/nodes/stmt.py
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
def __init__(
    self,
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None,
) -> None:
    super().__init__()
    """Initialize the Statement.

    Args:
        arsg (Sequence[SSAValue], optional): The arguments of the Statement. Defaults to ().
        regions (Sequence[Region], optional): The regions where the Statement belong to. Defaults to ().
        successors (Sequence[Block], optional): The successors of the Statement. Defaults to ().
        attributes (Mapping[str, Attribute], optional): The attributes of the Statement. Defaults to {}.
        results (Sequence[ResultValue], optional): The result values of the Statement. Defaults to ().
        result_types (Sequence[TypeAttribute], optional): The result types of the Statement. Defaults to ().
        args_slice (Mapping[str, int | slice], optional): The arguments slice of the Statement. Defaults to {}.
        source (SourceInfo | None, optional): The source information of the Statement for debugging/stacktracing. Defaults to None.

    """
    self._args = ()
    self._regions = []
    self._name_args_slice = dict(args_slice)
    self.source = source
    self.args = args

    if results:
        self._results = list(results)
        assert (
            len(result_types) == 0
        ), "expect either results or result_types specified, got both"

    if result_types:
        self._results = [
            ResultValue(self, idx, type=type)
            for idx, type in enumerate(result_types)
        ]

    if not results and not result_types:
        self._results = list(results)

    self.successors = list(successors)
    self.attributes = dict(attributes)
    self.regions = list(regions)

    self.parent = None
    self._next_stmt = None
    self._prev_stmt = None
    self.__post_init__()

name class-attribute instance-attribute

name = 'bitxor'

Div dataclass

Div(
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None
)

Bases: BinOp


              flowchart TD
              kirin.dialects.py.binop.stmts.Div[Div]
              kirin.dialects.py.binop.stmts.BinOp[BinOp]
              kirin.ir.nodes.stmt.Statement[Statement]
              kirin.ir.nodes.base.IRNode[IRNode]
              kirin.print.printable.Printable[Printable]

                              kirin.dialects.py.binop.stmts.BinOp --> kirin.dialects.py.binop.stmts.Div
                                kirin.ir.nodes.stmt.Statement --> kirin.dialects.py.binop.stmts.BinOp
                                kirin.ir.nodes.base.IRNode --> kirin.ir.nodes.stmt.Statement
                                kirin.print.printable.Printable --> kirin.ir.nodes.base.IRNode
                





              click kirin.dialects.py.binop.stmts.Div href "" "kirin.dialects.py.binop.stmts.Div"
              click kirin.dialects.py.binop.stmts.BinOp href "" "kirin.dialects.py.binop.stmts.BinOp"
              click kirin.ir.nodes.stmt.Statement href "" "kirin.ir.nodes.stmt.Statement"
              click kirin.ir.nodes.base.IRNode href "" "kirin.ir.nodes.base.IRNode"
              click kirin.print.printable.Printable href "" "kirin.print.printable.Printable"
            
Source code in src/kirin/ir/nodes/stmt.py
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
def __init__(
    self,
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None,
) -> None:
    super().__init__()
    """Initialize the Statement.

    Args:
        arsg (Sequence[SSAValue], optional): The arguments of the Statement. Defaults to ().
        regions (Sequence[Region], optional): The regions where the Statement belong to. Defaults to ().
        successors (Sequence[Block], optional): The successors of the Statement. Defaults to ().
        attributes (Mapping[str, Attribute], optional): The attributes of the Statement. Defaults to {}.
        results (Sequence[ResultValue], optional): The result values of the Statement. Defaults to ().
        result_types (Sequence[TypeAttribute], optional): The result types of the Statement. Defaults to ().
        args_slice (Mapping[str, int | slice], optional): The arguments slice of the Statement. Defaults to {}.
        source (SourceInfo | None, optional): The source information of the Statement for debugging/stacktracing. Defaults to None.

    """
    self._args = ()
    self._regions = []
    self._name_args_slice = dict(args_slice)
    self.source = source
    self.args = args

    if results:
        self._results = list(results)
        assert (
            len(result_types) == 0
        ), "expect either results or result_types specified, got both"

    if result_types:
        self._results = [
            ResultValue(self, idx, type=type)
            for idx, type in enumerate(result_types)
        ]

    if not results and not result_types:
        self._results = list(results)

    self.successors = list(successors)
    self.attributes = dict(attributes)
    self.regions = list(regions)

    self.parent = None
    self._next_stmt = None
    self._prev_stmt = None
    self.__post_init__()

name class-attribute instance-attribute

name = 'div'

FloorDiv dataclass

FloorDiv(
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None
)

Bases: BinOp


              flowchart TD
              kirin.dialects.py.binop.stmts.FloorDiv[FloorDiv]
              kirin.dialects.py.binop.stmts.BinOp[BinOp]
              kirin.ir.nodes.stmt.Statement[Statement]
              kirin.ir.nodes.base.IRNode[IRNode]
              kirin.print.printable.Printable[Printable]

                              kirin.dialects.py.binop.stmts.BinOp --> kirin.dialects.py.binop.stmts.FloorDiv
                                kirin.ir.nodes.stmt.Statement --> kirin.dialects.py.binop.stmts.BinOp
                                kirin.ir.nodes.base.IRNode --> kirin.ir.nodes.stmt.Statement
                                kirin.print.printable.Printable --> kirin.ir.nodes.base.IRNode
                





              click kirin.dialects.py.binop.stmts.FloorDiv href "" "kirin.dialects.py.binop.stmts.FloorDiv"
              click kirin.dialects.py.binop.stmts.BinOp href "" "kirin.dialects.py.binop.stmts.BinOp"
              click kirin.ir.nodes.stmt.Statement href "" "kirin.ir.nodes.stmt.Statement"
              click kirin.ir.nodes.base.IRNode href "" "kirin.ir.nodes.base.IRNode"
              click kirin.print.printable.Printable href "" "kirin.print.printable.Printable"
            
Source code in src/kirin/ir/nodes/stmt.py
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
def __init__(
    self,
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None,
) -> None:
    super().__init__()
    """Initialize the Statement.

    Args:
        arsg (Sequence[SSAValue], optional): The arguments of the Statement. Defaults to ().
        regions (Sequence[Region], optional): The regions where the Statement belong to. Defaults to ().
        successors (Sequence[Block], optional): The successors of the Statement. Defaults to ().
        attributes (Mapping[str, Attribute], optional): The attributes of the Statement. Defaults to {}.
        results (Sequence[ResultValue], optional): The result values of the Statement. Defaults to ().
        result_types (Sequence[TypeAttribute], optional): The result types of the Statement. Defaults to ().
        args_slice (Mapping[str, int | slice], optional): The arguments slice of the Statement. Defaults to {}.
        source (SourceInfo | None, optional): The source information of the Statement for debugging/stacktracing. Defaults to None.

    """
    self._args = ()
    self._regions = []
    self._name_args_slice = dict(args_slice)
    self.source = source
    self.args = args

    if results:
        self._results = list(results)
        assert (
            len(result_types) == 0
        ), "expect either results or result_types specified, got both"

    if result_types:
        self._results = [
            ResultValue(self, idx, type=type)
            for idx, type in enumerate(result_types)
        ]

    if not results and not result_types:
        self._results = list(results)

    self.successors = list(successors)
    self.attributes = dict(attributes)
    self.regions = list(regions)

    self.parent = None
    self._next_stmt = None
    self._prev_stmt = None
    self.__post_init__()

name class-attribute instance-attribute

name = 'floordiv'

LShift dataclass

LShift(
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None
)

Bases: BinOp


              flowchart TD
              kirin.dialects.py.binop.stmts.LShift[LShift]
              kirin.dialects.py.binop.stmts.BinOp[BinOp]
              kirin.ir.nodes.stmt.Statement[Statement]
              kirin.ir.nodes.base.IRNode[IRNode]
              kirin.print.printable.Printable[Printable]

                              kirin.dialects.py.binop.stmts.BinOp --> kirin.dialects.py.binop.stmts.LShift
                                kirin.ir.nodes.stmt.Statement --> kirin.dialects.py.binop.stmts.BinOp
                                kirin.ir.nodes.base.IRNode --> kirin.ir.nodes.stmt.Statement
                                kirin.print.printable.Printable --> kirin.ir.nodes.base.IRNode
                





              click kirin.dialects.py.binop.stmts.LShift href "" "kirin.dialects.py.binop.stmts.LShift"
              click kirin.dialects.py.binop.stmts.BinOp href "" "kirin.dialects.py.binop.stmts.BinOp"
              click kirin.ir.nodes.stmt.Statement href "" "kirin.ir.nodes.stmt.Statement"
              click kirin.ir.nodes.base.IRNode href "" "kirin.ir.nodes.base.IRNode"
              click kirin.print.printable.Printable href "" "kirin.print.printable.Printable"
            
Source code in src/kirin/ir/nodes/stmt.py
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
def __init__(
    self,
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None,
) -> None:
    super().__init__()
    """Initialize the Statement.

    Args:
        arsg (Sequence[SSAValue], optional): The arguments of the Statement. Defaults to ().
        regions (Sequence[Region], optional): The regions where the Statement belong to. Defaults to ().
        successors (Sequence[Block], optional): The successors of the Statement. Defaults to ().
        attributes (Mapping[str, Attribute], optional): The attributes of the Statement. Defaults to {}.
        results (Sequence[ResultValue], optional): The result values of the Statement. Defaults to ().
        result_types (Sequence[TypeAttribute], optional): The result types of the Statement. Defaults to ().
        args_slice (Mapping[str, int | slice], optional): The arguments slice of the Statement. Defaults to {}.
        source (SourceInfo | None, optional): The source information of the Statement for debugging/stacktracing. Defaults to None.

    """
    self._args = ()
    self._regions = []
    self._name_args_slice = dict(args_slice)
    self.source = source
    self.args = args

    if results:
        self._results = list(results)
        assert (
            len(result_types) == 0
        ), "expect either results or result_types specified, got both"

    if result_types:
        self._results = [
            ResultValue(self, idx, type=type)
            for idx, type in enumerate(result_types)
        ]

    if not results and not result_types:
        self._results = list(results)

    self.successors = list(successors)
    self.attributes = dict(attributes)
    self.regions = list(regions)

    self.parent = None
    self._next_stmt = None
    self._prev_stmt = None
    self.__post_init__()

name class-attribute instance-attribute

name = 'lshift'

MatMult dataclass

MatMult(
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None
)

Bases: BinOp


              flowchart TD
              kirin.dialects.py.binop.stmts.MatMult[MatMult]
              kirin.dialects.py.binop.stmts.BinOp[BinOp]
              kirin.ir.nodes.stmt.Statement[Statement]
              kirin.ir.nodes.base.IRNode[IRNode]
              kirin.print.printable.Printable[Printable]

                              kirin.dialects.py.binop.stmts.BinOp --> kirin.dialects.py.binop.stmts.MatMult
                                kirin.ir.nodes.stmt.Statement --> kirin.dialects.py.binop.stmts.BinOp
                                kirin.ir.nodes.base.IRNode --> kirin.ir.nodes.stmt.Statement
                                kirin.print.printable.Printable --> kirin.ir.nodes.base.IRNode
                





              click kirin.dialects.py.binop.stmts.MatMult href "" "kirin.dialects.py.binop.stmts.MatMult"
              click kirin.dialects.py.binop.stmts.BinOp href "" "kirin.dialects.py.binop.stmts.BinOp"
              click kirin.ir.nodes.stmt.Statement href "" "kirin.ir.nodes.stmt.Statement"
              click kirin.ir.nodes.base.IRNode href "" "kirin.ir.nodes.base.IRNode"
              click kirin.print.printable.Printable href "" "kirin.print.printable.Printable"
            
Source code in src/kirin/ir/nodes/stmt.py
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
def __init__(
    self,
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None,
) -> None:
    super().__init__()
    """Initialize the Statement.

    Args:
        arsg (Sequence[SSAValue], optional): The arguments of the Statement. Defaults to ().
        regions (Sequence[Region], optional): The regions where the Statement belong to. Defaults to ().
        successors (Sequence[Block], optional): The successors of the Statement. Defaults to ().
        attributes (Mapping[str, Attribute], optional): The attributes of the Statement. Defaults to {}.
        results (Sequence[ResultValue], optional): The result values of the Statement. Defaults to ().
        result_types (Sequence[TypeAttribute], optional): The result types of the Statement. Defaults to ().
        args_slice (Mapping[str, int | slice], optional): The arguments slice of the Statement. Defaults to {}.
        source (SourceInfo | None, optional): The source information of the Statement for debugging/stacktracing. Defaults to None.

    """
    self._args = ()
    self._regions = []
    self._name_args_slice = dict(args_slice)
    self.source = source
    self.args = args

    if results:
        self._results = list(results)
        assert (
            len(result_types) == 0
        ), "expect either results or result_types specified, got both"

    if result_types:
        self._results = [
            ResultValue(self, idx, type=type)
            for idx, type in enumerate(result_types)
        ]

    if not results and not result_types:
        self._results = list(results)

    self.successors = list(successors)
    self.attributes = dict(attributes)
    self.regions = list(regions)

    self.parent = None
    self._next_stmt = None
    self._prev_stmt = None
    self.__post_init__()

name class-attribute instance-attribute

name = 'matmult'

Mod dataclass

Mod(
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None
)

Bases: BinOp


              flowchart TD
              kirin.dialects.py.binop.stmts.Mod[Mod]
              kirin.dialects.py.binop.stmts.BinOp[BinOp]
              kirin.ir.nodes.stmt.Statement[Statement]
              kirin.ir.nodes.base.IRNode[IRNode]
              kirin.print.printable.Printable[Printable]

                              kirin.dialects.py.binop.stmts.BinOp --> kirin.dialects.py.binop.stmts.Mod
                                kirin.ir.nodes.stmt.Statement --> kirin.dialects.py.binop.stmts.BinOp
                                kirin.ir.nodes.base.IRNode --> kirin.ir.nodes.stmt.Statement
                                kirin.print.printable.Printable --> kirin.ir.nodes.base.IRNode
                





              click kirin.dialects.py.binop.stmts.Mod href "" "kirin.dialects.py.binop.stmts.Mod"
              click kirin.dialects.py.binop.stmts.BinOp href "" "kirin.dialects.py.binop.stmts.BinOp"
              click kirin.ir.nodes.stmt.Statement href "" "kirin.ir.nodes.stmt.Statement"
              click kirin.ir.nodes.base.IRNode href "" "kirin.ir.nodes.base.IRNode"
              click kirin.print.printable.Printable href "" "kirin.print.printable.Printable"
            
Source code in src/kirin/ir/nodes/stmt.py
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
def __init__(
    self,
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None,
) -> None:
    super().__init__()
    """Initialize the Statement.

    Args:
        arsg (Sequence[SSAValue], optional): The arguments of the Statement. Defaults to ().
        regions (Sequence[Region], optional): The regions where the Statement belong to. Defaults to ().
        successors (Sequence[Block], optional): The successors of the Statement. Defaults to ().
        attributes (Mapping[str, Attribute], optional): The attributes of the Statement. Defaults to {}.
        results (Sequence[ResultValue], optional): The result values of the Statement. Defaults to ().
        result_types (Sequence[TypeAttribute], optional): The result types of the Statement. Defaults to ().
        args_slice (Mapping[str, int | slice], optional): The arguments slice of the Statement. Defaults to {}.
        source (SourceInfo | None, optional): The source information of the Statement for debugging/stacktracing. Defaults to None.

    """
    self._args = ()
    self._regions = []
    self._name_args_slice = dict(args_slice)
    self.source = source
    self.args = args

    if results:
        self._results = list(results)
        assert (
            len(result_types) == 0
        ), "expect either results or result_types specified, got both"

    if result_types:
        self._results = [
            ResultValue(self, idx, type=type)
            for idx, type in enumerate(result_types)
        ]

    if not results and not result_types:
        self._results = list(results)

    self.successors = list(successors)
    self.attributes = dict(attributes)
    self.regions = list(regions)

    self.parent = None
    self._next_stmt = None
    self._prev_stmt = None
    self.__post_init__()

name class-attribute instance-attribute

name = 'mod'

Mult dataclass

Mult(
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None
)

Bases: BinOp


              flowchart TD
              kirin.dialects.py.binop.stmts.Mult[Mult]
              kirin.dialects.py.binop.stmts.BinOp[BinOp]
              kirin.ir.nodes.stmt.Statement[Statement]
              kirin.ir.nodes.base.IRNode[IRNode]
              kirin.print.printable.Printable[Printable]

                              kirin.dialects.py.binop.stmts.BinOp --> kirin.dialects.py.binop.stmts.Mult
                                kirin.ir.nodes.stmt.Statement --> kirin.dialects.py.binop.stmts.BinOp
                                kirin.ir.nodes.base.IRNode --> kirin.ir.nodes.stmt.Statement
                                kirin.print.printable.Printable --> kirin.ir.nodes.base.IRNode
                





              click kirin.dialects.py.binop.stmts.Mult href "" "kirin.dialects.py.binop.stmts.Mult"
              click kirin.dialects.py.binop.stmts.BinOp href "" "kirin.dialects.py.binop.stmts.BinOp"
              click kirin.ir.nodes.stmt.Statement href "" "kirin.ir.nodes.stmt.Statement"
              click kirin.ir.nodes.base.IRNode href "" "kirin.ir.nodes.base.IRNode"
              click kirin.print.printable.Printable href "" "kirin.print.printable.Printable"
            
Source code in src/kirin/ir/nodes/stmt.py
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
def __init__(
    self,
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None,
) -> None:
    super().__init__()
    """Initialize the Statement.

    Args:
        arsg (Sequence[SSAValue], optional): The arguments of the Statement. Defaults to ().
        regions (Sequence[Region], optional): The regions where the Statement belong to. Defaults to ().
        successors (Sequence[Block], optional): The successors of the Statement. Defaults to ().
        attributes (Mapping[str, Attribute], optional): The attributes of the Statement. Defaults to {}.
        results (Sequence[ResultValue], optional): The result values of the Statement. Defaults to ().
        result_types (Sequence[TypeAttribute], optional): The result types of the Statement. Defaults to ().
        args_slice (Mapping[str, int | slice], optional): The arguments slice of the Statement. Defaults to {}.
        source (SourceInfo | None, optional): The source information of the Statement for debugging/stacktracing. Defaults to None.

    """
    self._args = ()
    self._regions = []
    self._name_args_slice = dict(args_slice)
    self.source = source
    self.args = args

    if results:
        self._results = list(results)
        assert (
            len(result_types) == 0
        ), "expect either results or result_types specified, got both"

    if result_types:
        self._results = [
            ResultValue(self, idx, type=type)
            for idx, type in enumerate(result_types)
        ]

    if not results and not result_types:
        self._results = list(results)

    self.successors = list(successors)
    self.attributes = dict(attributes)
    self.regions = list(regions)

    self.parent = None
    self._next_stmt = None
    self._prev_stmt = None
    self.__post_init__()

name class-attribute instance-attribute

name = 'mult'

Pow dataclass

Pow(
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None
)

Bases: BinOp


              flowchart TD
              kirin.dialects.py.binop.stmts.Pow[Pow]
              kirin.dialects.py.binop.stmts.BinOp[BinOp]
              kirin.ir.nodes.stmt.Statement[Statement]
              kirin.ir.nodes.base.IRNode[IRNode]
              kirin.print.printable.Printable[Printable]

                              kirin.dialects.py.binop.stmts.BinOp --> kirin.dialects.py.binop.stmts.Pow
                                kirin.ir.nodes.stmt.Statement --> kirin.dialects.py.binop.stmts.BinOp
                                kirin.ir.nodes.base.IRNode --> kirin.ir.nodes.stmt.Statement
                                kirin.print.printable.Printable --> kirin.ir.nodes.base.IRNode
                





              click kirin.dialects.py.binop.stmts.Pow href "" "kirin.dialects.py.binop.stmts.Pow"
              click kirin.dialects.py.binop.stmts.BinOp href "" "kirin.dialects.py.binop.stmts.BinOp"
              click kirin.ir.nodes.stmt.Statement href "" "kirin.ir.nodes.stmt.Statement"
              click kirin.ir.nodes.base.IRNode href "" "kirin.ir.nodes.base.IRNode"
              click kirin.print.printable.Printable href "" "kirin.print.printable.Printable"
            
Source code in src/kirin/ir/nodes/stmt.py
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
def __init__(
    self,
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None,
) -> None:
    super().__init__()
    """Initialize the Statement.

    Args:
        arsg (Sequence[SSAValue], optional): The arguments of the Statement. Defaults to ().
        regions (Sequence[Region], optional): The regions where the Statement belong to. Defaults to ().
        successors (Sequence[Block], optional): The successors of the Statement. Defaults to ().
        attributes (Mapping[str, Attribute], optional): The attributes of the Statement. Defaults to {}.
        results (Sequence[ResultValue], optional): The result values of the Statement. Defaults to ().
        result_types (Sequence[TypeAttribute], optional): The result types of the Statement. Defaults to ().
        args_slice (Mapping[str, int | slice], optional): The arguments slice of the Statement. Defaults to {}.
        source (SourceInfo | None, optional): The source information of the Statement for debugging/stacktracing. Defaults to None.

    """
    self._args = ()
    self._regions = []
    self._name_args_slice = dict(args_slice)
    self.source = source
    self.args = args

    if results:
        self._results = list(results)
        assert (
            len(result_types) == 0
        ), "expect either results or result_types specified, got both"

    if result_types:
        self._results = [
            ResultValue(self, idx, type=type)
            for idx, type in enumerate(result_types)
        ]

    if not results and not result_types:
        self._results = list(results)

    self.successors = list(successors)
    self.attributes = dict(attributes)
    self.regions = list(regions)

    self.parent = None
    self._next_stmt = None
    self._prev_stmt = None
    self.__post_init__()

name class-attribute instance-attribute

name = 'pow'

RShift dataclass

RShift(
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None
)

Bases: BinOp


              flowchart TD
              kirin.dialects.py.binop.stmts.RShift[RShift]
              kirin.dialects.py.binop.stmts.BinOp[BinOp]
              kirin.ir.nodes.stmt.Statement[Statement]
              kirin.ir.nodes.base.IRNode[IRNode]
              kirin.print.printable.Printable[Printable]

                              kirin.dialects.py.binop.stmts.BinOp --> kirin.dialects.py.binop.stmts.RShift
                                kirin.ir.nodes.stmt.Statement --> kirin.dialects.py.binop.stmts.BinOp
                                kirin.ir.nodes.base.IRNode --> kirin.ir.nodes.stmt.Statement
                                kirin.print.printable.Printable --> kirin.ir.nodes.base.IRNode
                





              click kirin.dialects.py.binop.stmts.RShift href "" "kirin.dialects.py.binop.stmts.RShift"
              click kirin.dialects.py.binop.stmts.BinOp href "" "kirin.dialects.py.binop.stmts.BinOp"
              click kirin.ir.nodes.stmt.Statement href "" "kirin.ir.nodes.stmt.Statement"
              click kirin.ir.nodes.base.IRNode href "" "kirin.ir.nodes.base.IRNode"
              click kirin.print.printable.Printable href "" "kirin.print.printable.Printable"
            
Source code in src/kirin/ir/nodes/stmt.py
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
def __init__(
    self,
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None,
) -> None:
    super().__init__()
    """Initialize the Statement.

    Args:
        arsg (Sequence[SSAValue], optional): The arguments of the Statement. Defaults to ().
        regions (Sequence[Region], optional): The regions where the Statement belong to. Defaults to ().
        successors (Sequence[Block], optional): The successors of the Statement. Defaults to ().
        attributes (Mapping[str, Attribute], optional): The attributes of the Statement. Defaults to {}.
        results (Sequence[ResultValue], optional): The result values of the Statement. Defaults to ().
        result_types (Sequence[TypeAttribute], optional): The result types of the Statement. Defaults to ().
        args_slice (Mapping[str, int | slice], optional): The arguments slice of the Statement. Defaults to {}.
        source (SourceInfo | None, optional): The source information of the Statement for debugging/stacktracing. Defaults to None.

    """
    self._args = ()
    self._regions = []
    self._name_args_slice = dict(args_slice)
    self.source = source
    self.args = args

    if results:
        self._results = list(results)
        assert (
            len(result_types) == 0
        ), "expect either results or result_types specified, got both"

    if result_types:
        self._results = [
            ResultValue(self, idx, type=type)
            for idx, type in enumerate(result_types)
        ]

    if not results and not result_types:
        self._results = list(results)

    self.successors = list(successors)
    self.attributes = dict(attributes)
    self.regions = list(regions)

    self.parent = None
    self._next_stmt = None
    self._prev_stmt = None
    self.__post_init__()

name class-attribute instance-attribute

name = 'rshift'

Sub dataclass

Sub(
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None
)

Bases: BinOp


              flowchart TD
              kirin.dialects.py.binop.stmts.Sub[Sub]
              kirin.dialects.py.binop.stmts.BinOp[BinOp]
              kirin.ir.nodes.stmt.Statement[Statement]
              kirin.ir.nodes.base.IRNode[IRNode]
              kirin.print.printable.Printable[Printable]

                              kirin.dialects.py.binop.stmts.BinOp --> kirin.dialects.py.binop.stmts.Sub
                                kirin.ir.nodes.stmt.Statement --> kirin.dialects.py.binop.stmts.BinOp
                                kirin.ir.nodes.base.IRNode --> kirin.ir.nodes.stmt.Statement
                                kirin.print.printable.Printable --> kirin.ir.nodes.base.IRNode
                





              click kirin.dialects.py.binop.stmts.Sub href "" "kirin.dialects.py.binop.stmts.Sub"
              click kirin.dialects.py.binop.stmts.BinOp href "" "kirin.dialects.py.binop.stmts.BinOp"
              click kirin.ir.nodes.stmt.Statement href "" "kirin.ir.nodes.stmt.Statement"
              click kirin.ir.nodes.base.IRNode href "" "kirin.ir.nodes.base.IRNode"
              click kirin.print.printable.Printable href "" "kirin.print.printable.Printable"
            
Source code in src/kirin/ir/nodes/stmt.py
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
def __init__(
    self,
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None,
) -> None:
    super().__init__()
    """Initialize the Statement.

    Args:
        arsg (Sequence[SSAValue], optional): The arguments of the Statement. Defaults to ().
        regions (Sequence[Region], optional): The regions where the Statement belong to. Defaults to ().
        successors (Sequence[Block], optional): The successors of the Statement. Defaults to ().
        attributes (Mapping[str, Attribute], optional): The attributes of the Statement. Defaults to {}.
        results (Sequence[ResultValue], optional): The result values of the Statement. Defaults to ().
        result_types (Sequence[TypeAttribute], optional): The result types of the Statement. Defaults to ().
        args_slice (Mapping[str, int | slice], optional): The arguments slice of the Statement. Defaults to {}.
        source (SourceInfo | None, optional): The source information of the Statement for debugging/stacktracing. Defaults to None.

    """
    self._args = ()
    self._regions = []
    self._name_args_slice = dict(args_slice)
    self.source = source
    self.args = args

    if results:
        self._results = list(results)
        assert (
            len(result_types) == 0
        ), "expect either results or result_types specified, got both"

    if result_types:
        self._results = [
            ResultValue(self, idx, type=type)
            for idx, type in enumerate(result_types)
        ]

    if not results and not result_types:
        self._results = list(results)

    self.successors = list(successors)
    self.attributes = dict(attributes)
    self.regions = list(regions)

    self.parent = None
    self._next_stmt = None
    self._prev_stmt = None
    self.__post_init__()

name class-attribute instance-attribute

name = 'sub'

Assertion

kirin.dialects.py.assertion

Assertion dialect for Python.

This module contains the dialect for the Python assert statement, including:

  • The Assert statement class.
  • The lowering pass for the assert statement.
  • The concrete implementation of the assert statement.
  • The type inference implementation of the assert statement.
  • The Julia emitter for the assert statement.

This dialect maps ast.Assert nodes to the Assert statement.

dialect module-attribute

dialect = Dialect('py.assert')

Assert dataclass

Assert(
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None
)

Bases: Statement


              flowchart TD
              kirin.dialects.py.assertion.Assert[Assert]
              kirin.ir.nodes.stmt.Statement[Statement]
              kirin.ir.nodes.base.IRNode[IRNode]
              kirin.print.printable.Printable[Printable]

                              kirin.ir.nodes.stmt.Statement --> kirin.dialects.py.assertion.Assert
                                kirin.ir.nodes.base.IRNode --> kirin.ir.nodes.stmt.Statement
                                kirin.print.printable.Printable --> kirin.ir.nodes.base.IRNode
                




              click kirin.dialects.py.assertion.Assert href "" "kirin.dialects.py.assertion.Assert"
              click kirin.ir.nodes.stmt.Statement href "" "kirin.ir.nodes.stmt.Statement"
              click kirin.ir.nodes.base.IRNode href "" "kirin.ir.nodes.base.IRNode"
              click kirin.print.printable.Printable href "" "kirin.print.printable.Printable"
            
Source code in src/kirin/ir/nodes/stmt.py
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
def __init__(
    self,
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None,
) -> None:
    super().__init__()
    """Initialize the Statement.

    Args:
        arsg (Sequence[SSAValue], optional): The arguments of the Statement. Defaults to ().
        regions (Sequence[Region], optional): The regions where the Statement belong to. Defaults to ().
        successors (Sequence[Block], optional): The successors of the Statement. Defaults to ().
        attributes (Mapping[str, Attribute], optional): The attributes of the Statement. Defaults to {}.
        results (Sequence[ResultValue], optional): The result values of the Statement. Defaults to ().
        result_types (Sequence[TypeAttribute], optional): The result types of the Statement. Defaults to ().
        args_slice (Mapping[str, int | slice], optional): The arguments slice of the Statement. Defaults to {}.
        source (SourceInfo | None, optional): The source information of the Statement for debugging/stacktracing. Defaults to None.

    """
    self._args = ()
    self._regions = []
    self._name_args_slice = dict(args_slice)
    self.source = source
    self.args = args

    if results:
        self._results = list(results)
        assert (
            len(result_types) == 0
        ), "expect either results or result_types specified, got both"

    if result_types:
        self._results = [
            ResultValue(self, idx, type=type)
            for idx, type in enumerate(result_types)
        ]

    if not results and not result_types:
        self._results = list(results)

    self.successors = list(successors)
    self.attributes = dict(attributes)
    self.regions = list(regions)

    self.parent = None
    self._next_stmt = None
    self._prev_stmt = None
    self.__post_init__()

condition instance-attribute

condition: SSAValue

message class-attribute instance-attribute

message: SSAValue = argument(String)

print_impl

print_impl(printer: Printer) -> None
Source code in src/kirin/dialects/py/assertion.py
28
29
30
31
32
33
34
35
36
37
def print_impl(self, printer: Printer) -> None:
    with printer.rich(style="keyword"):
        printer.print_name(self)

    printer.plain_print(" ")
    printer.print(self.condition)

    if self.message:
        printer.plain_print(", ")
        printer.print(self.message)

Concrete

Bases: MethodTable


              flowchart TD
              kirin.dialects.py.assertion.Concrete[Concrete]
              kirin.interp.table.MethodTable[MethodTable]

                              kirin.interp.table.MethodTable --> kirin.dialects.py.assertion.Concrete
                


              click kirin.dialects.py.assertion.Concrete href "" "kirin.dialects.py.assertion.Concrete"
              click kirin.interp.table.MethodTable href "" "kirin.interp.table.MethodTable"
            

assert_stmt

assert_stmt(
    interp_: Interpreter, frame: Frame, stmt: Assert
)
Source code in src/kirin/dialects/py/assertion.py
60
61
62
63
64
65
66
67
68
69
70
@interp.impl(Assert)
def assert_stmt(
    self, interp_: interp.Interpreter, frame: interp.Frame, stmt: Assert
):
    if frame.get(stmt.condition) is True:
        return ()

    if stmt.message:
        raise AssertionError(frame.get(stmt.message))
    else:
        raise AssertionError("Assertion failed")

Lowering dataclass

Lowering()

Bases: FromPythonAST


              flowchart TD
              kirin.dialects.py.assertion.Lowering[Lowering]
              kirin.lowering.python.dialect.FromPythonAST[FromPythonAST]

                              kirin.lowering.python.dialect.FromPythonAST --> kirin.dialects.py.assertion.Lowering
                


              click kirin.dialects.py.assertion.Lowering href "" "kirin.dialects.py.assertion.Lowering"
              click kirin.lowering.python.dialect.FromPythonAST href "" "kirin.lowering.python.dialect.FromPythonAST"
            

lower_Assert

lower_Assert(state: State, node: Assert) -> lowering.Result
Source code in src/kirin/dialects/py/assertion.py
43
44
45
46
47
48
49
50
51
52
53
54
def lower_Assert(self, state: lowering.State, node: ast.Assert) -> lowering.Result:
    from kirin.dialects.py.constant import Constant

    cond = state.lower(node.test).expect_one()
    if node.msg:
        message = state.lower(node.msg).expect_one()
        state.current_frame.push(Assert(condition=cond, message=message))
    else:
        message_stmt = state.current_frame.push(Constant(""))
        state.current_frame.push(
            Assert(condition=cond, message=message_stmt.result)
        )

TypeInfer

Bases: MethodTable


              flowchart TD
              kirin.dialects.py.assertion.TypeInfer[TypeInfer]
              kirin.interp.table.MethodTable[MethodTable]

                              kirin.interp.table.MethodTable --> kirin.dialects.py.assertion.TypeInfer
                


              click kirin.dialects.py.assertion.TypeInfer href "" "kirin.dialects.py.assertion.TypeInfer"
              click kirin.interp.table.MethodTable href "" "kirin.interp.table.MethodTable"
            

assert_stmt

assert_stmt(interp, frame, stmt: Assert)
Source code in src/kirin/dialects/py/assertion.py
76
77
78
@interp.impl(Assert)
def assert_stmt(self, interp, frame, stmt: Assert):
    return (types.Bottom,)

Assignment

kirin.dialects.py.assign

Assignment dialect for Python.

This module contains the dialect for the Python assignment statement, including:

  • Statements: Alias, SetItem.
  • The lowering pass for the assignments.
  • The concrete implementation of the assignment statements.

This dialects maps Python assignment syntax.

T module-attribute

T = TypeVar('T')

dialect module-attribute

dialect = Dialect('py.assign')

Alias dataclass

Alias(
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None
)

Bases: Statement


              flowchart TD
              kirin.dialects.py.assign.Alias[Alias]
              kirin.ir.nodes.stmt.Statement[Statement]
              kirin.ir.nodes.base.IRNode[IRNode]
              kirin.print.printable.Printable[Printable]

                              kirin.ir.nodes.stmt.Statement --> kirin.dialects.py.assign.Alias
                                kirin.ir.nodes.base.IRNode --> kirin.ir.nodes.stmt.Statement
                                kirin.print.printable.Printable --> kirin.ir.nodes.base.IRNode
                




              click kirin.dialects.py.assign.Alias href "" "kirin.dialects.py.assign.Alias"
              click kirin.ir.nodes.stmt.Statement href "" "kirin.ir.nodes.stmt.Statement"
              click kirin.ir.nodes.base.IRNode href "" "kirin.ir.nodes.base.IRNode"
              click kirin.print.printable.Printable href "" "kirin.print.printable.Printable"
            
Source code in src/kirin/ir/nodes/stmt.py
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
def __init__(
    self,
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None,
) -> None:
    super().__init__()
    """Initialize the Statement.

    Args:
        arsg (Sequence[SSAValue], optional): The arguments of the Statement. Defaults to ().
        regions (Sequence[Region], optional): The regions where the Statement belong to. Defaults to ().
        successors (Sequence[Block], optional): The successors of the Statement. Defaults to ().
        attributes (Mapping[str, Attribute], optional): The attributes of the Statement. Defaults to {}.
        results (Sequence[ResultValue], optional): The result values of the Statement. Defaults to ().
        result_types (Sequence[TypeAttribute], optional): The result types of the Statement. Defaults to ().
        args_slice (Mapping[str, int | slice], optional): The arguments slice of the Statement. Defaults to {}.
        source (SourceInfo | None, optional): The source information of the Statement for debugging/stacktracing. Defaults to None.

    """
    self._args = ()
    self._regions = []
    self._name_args_slice = dict(args_slice)
    self.source = source
    self.args = args

    if results:
        self._results = list(results)
        assert (
            len(result_types) == 0
        ), "expect either results or result_types specified, got both"

    if result_types:
        self._results = [
            ResultValue(self, idx, type=type)
            for idx, type in enumerate(result_types)
        ]

    if not results and not result_types:
        self._results = list(results)

    self.successors = list(successors)
    self.attributes = dict(attributes)
    self.regions = list(regions)

    self.parent = None
    self._next_stmt = None
    self._prev_stmt = None
    self.__post_init__()

name class-attribute instance-attribute

name = 'alias'

result class-attribute instance-attribute

result: ResultValue = result(T)

target class-attribute instance-attribute

target: PyAttr[str] = attribute()

traits class-attribute instance-attribute

traits = frozenset({Pure(), FromPythonCall()})

value class-attribute instance-attribute

value: SSAValue = argument(T)

print_impl

print_impl(printer: Printer) -> None
Source code in src/kirin/dialects/py/assign.py
31
32
33
34
35
36
37
38
39
40
def print_impl(self, printer: Printer) -> None:
    printer.print_name(self)
    printer.plain_print(" ")
    with printer.rich(style="symbol"):
        printer.plain_print(self.target.data)

    with printer.rich(style="keyword"):
        printer.plain_print(" = ")

    printer.print(self.value)

Concrete

Bases: MethodTable


              flowchart TD
              kirin.dialects.py.assign.Concrete[Concrete]
              kirin.interp.table.MethodTable[MethodTable]

                              kirin.interp.table.MethodTable --> kirin.dialects.py.assign.Concrete
                


              click kirin.dialects.py.assign.Concrete href "" "kirin.dialects.py.assign.Concrete"
              click kirin.interp.table.MethodTable href "" "kirin.interp.table.MethodTable"
            

alias

alias(interp, frame: Frame, stmt: Alias)
Source code in src/kirin/dialects/py/assign.py
80
81
82
@interp.impl(Alias)
def alias(self, interp, frame: interp.Frame, stmt: Alias):
    return (frame.get(stmt.value),)

set_attribute

set_attribute(interp, frame: Frame, stmt: SetAttribute)
Source code in src/kirin/dialects/py/assign.py
88
89
90
91
92
@interp.impl(SetAttribute)
def set_attribute(self, interp, frame: interp.Frame, stmt: SetAttribute):
    obj = frame.get(stmt.obj)
    value = frame.get(stmt.value)
    setattr(obj, stmt.attr, value)

setindex

setindex(interp, frame: Frame, stmt: SetItem)
Source code in src/kirin/dialects/py/assign.py
84
85
86
@interp.impl(SetItem)
def setindex(self, interp, frame: interp.Frame, stmt: SetItem):
    frame.get(stmt.obj)[frame.get(stmt.index)] = frame.get(stmt.value)

type_assert

type_assert(interp_, frame: Frame, stmt: TypeAssert)
Source code in src/kirin/dialects/py/assign.py
 97
 98
 99
100
101
102
103
@interp.impl(TypeAssert)
def type_assert(self, interp_, frame: interp.Frame, stmt: TypeAssert):
    got = frame.get(stmt.got)
    got_type = types.PyClass(type(got))
    if not got_type.is_subseteq(stmt.expected):
        raise TypeError(f"Expected {stmt.expected}, got {got_type}")
    return (frame.get(stmt.got),)

Lowering dataclass

Lowering()

Bases: FromPythonAST


              flowchart TD
              kirin.dialects.py.assign.Lowering[Lowering]
              kirin.lowering.python.dialect.FromPythonAST[FromPythonAST]

                              kirin.lowering.python.dialect.FromPythonAST --> kirin.dialects.py.assign.Lowering
                


              click kirin.dialects.py.assign.Lowering href "" "kirin.dialects.py.assign.Lowering"
              click kirin.lowering.python.dialect.FromPythonAST href "" "kirin.lowering.python.dialect.FromPythonAST"
            

assign_item classmethod

assign_item(state: State, target, result: Result)
Source code in src/kirin/dialects/py/assign.py
191
192
193
194
195
196
197
198
199
200
201
202
@classmethod
def assign_item(cls, state: lowering.State, target, result: lowering.State.Result):
    match target:
        case ast.Tuple(elts, ast.Store()):
            if len(elts) != len(result.data):
                raise lowering.BuildError(
                    f"tuple assignment length mismatch: {len(elts)} != {len(result.data)}"
                )
            for target, value in zip(elts, result.data):
                cls.assign_item_value(state, target, value)
        case _:
            cls.assign_item_value(state, target, result.expect_one())

assign_item_value classmethod

assign_item_value(state: State, target, value: SSAValue)
Source code in src/kirin/dialects/py/assign.py
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
@classmethod
def assign_item_value(cls, state: lowering.State, target, value: ir.SSAValue):
    current_frame = state.current_frame
    match target:
        case ast.Name(name, ast.Store()):
            value.name = name
            current_frame.defs[name] = value
        case ast.Attribute(obj, attr, ast.Store()):
            obj = state.lower(obj).expect_one()
            stmt = SetAttribute(obj, value, attr=attr)
            current_frame.push(stmt)
        case ast.Subscript(obj, slice, ast.Store()):
            obj = state.lower(obj).expect_one()
            slice = state.lower(slice).expect_one()
            stmt = SetItem(obj=obj, index=slice, value=value)
            current_frame.push(stmt)
        case _:
            raise lowering.BuildError(f"unsupported target {target}")

lower_AnnAssign

lower_AnnAssign(
    state: State, node: AnnAssign
) -> lowering.Result
Source code in src/kirin/dialects/py/assign.py
139
140
141
142
143
144
145
def lower_AnnAssign(
    self, state: lowering.State, node: ast.AnnAssign
) -> lowering.Result:
    type_hint = self.get_hint(state, node.annotation)
    value = state.lower(node.value).expect_one()
    stmt = state.current_frame.push(TypeAssert(got=value, expected=type_hint))
    self.assign_item_value(state, node.target, stmt.result)

lower_Assign

lower_Assign(state: State, node: Assign) -> lowering.Result
Source code in src/kirin/dialects/py/assign.py
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
def lower_Assign(self, state: lowering.State, node: ast.Assign) -> lowering.Result:
    result = state.lower(node.value)
    current_frame = state.current_frame
    match node:
        case ast.Assign(
            targets=[ast.Name(lhs_name, ast.Store())], value=ast.Name(_, ast.Load())
        ):

            stmt = Alias(
                value=result.data[0], target=ir.PyAttr(lhs_name)
            )  # NOTE: this is guaranteed to be one result

            stmt.result.name = lhs_name
            current_frame.defs[lhs_name] = current_frame.push(stmt).result
        case _:
            for target in node.targets:
                self.assign_item(state, target, result)

lower_AugAssign

lower_AugAssign(
    state: State, node: AugAssign
) -> lowering.Result
Source code in src/kirin/dialects/py/assign.py
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
def lower_AugAssign(
    self, state: lowering.State, node: ast.AugAssign
) -> lowering.Result:
    match node.target:
        case ast.Name(name, ast.Store()):
            rhs = ast.Name(name, ast.Load())
        case ast.Attribute(obj, attr, ast.Store()):
            rhs = ast.Attribute(obj, attr, ast.Load())
        case ast.Subscript(obj, slice, ast.Store()):
            rhs = ast.Subscript(obj, slice, ast.Load())
        case _:
            raise lowering.BuildError(f"unsupported target {node.target}")
    self.assign_item_value(
        state,
        node.target,
        state.lower(ast.BinOp(rhs, node.op, node.value)).expect_one(),
    )

lower_NamedExpr

lower_NamedExpr(
    state: State, node: NamedExpr
) -> lowering.Result
Source code in src/kirin/dialects/py/assign.py
165
166
167
168
169
170
def lower_NamedExpr(
    self, state: lowering.State, node: ast.NamedExpr
) -> lowering.Result:
    value = state.lower(node.value).expect_one()
    self.assign_item_value(state, node.target, value)
    return value

SetAttribute dataclass

SetAttribute(
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None
)

Bases: Statement


              flowchart TD
              kirin.dialects.py.assign.SetAttribute[SetAttribute]
              kirin.ir.nodes.stmt.Statement[Statement]
              kirin.ir.nodes.base.IRNode[IRNode]
              kirin.print.printable.Printable[Printable]

                              kirin.ir.nodes.stmt.Statement --> kirin.dialects.py.assign.SetAttribute
                                kirin.ir.nodes.base.IRNode --> kirin.ir.nodes.stmt.Statement
                                kirin.print.printable.Printable --> kirin.ir.nodes.base.IRNode
                




              click kirin.dialects.py.assign.SetAttribute href "" "kirin.dialects.py.assign.SetAttribute"
              click kirin.ir.nodes.stmt.Statement href "" "kirin.ir.nodes.stmt.Statement"
              click kirin.ir.nodes.base.IRNode href "" "kirin.ir.nodes.base.IRNode"
              click kirin.print.printable.Printable href "" "kirin.print.printable.Printable"
            
Source code in src/kirin/ir/nodes/stmt.py
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
def __init__(
    self,
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None,
) -> None:
    super().__init__()
    """Initialize the Statement.

    Args:
        arsg (Sequence[SSAValue], optional): The arguments of the Statement. Defaults to ().
        regions (Sequence[Region], optional): The regions where the Statement belong to. Defaults to ().
        successors (Sequence[Block], optional): The successors of the Statement. Defaults to ().
        attributes (Mapping[str, Attribute], optional): The attributes of the Statement. Defaults to {}.
        results (Sequence[ResultValue], optional): The result values of the Statement. Defaults to ().
        result_types (Sequence[TypeAttribute], optional): The result types of the Statement. Defaults to ().
        args_slice (Mapping[str, int | slice], optional): The arguments slice of the Statement. Defaults to {}.
        source (SourceInfo | None, optional): The source information of the Statement for debugging/stacktracing. Defaults to None.

    """
    self._args = ()
    self._regions = []
    self._name_args_slice = dict(args_slice)
    self.source = source
    self.args = args

    if results:
        self._results = list(results)
        assert (
            len(result_types) == 0
        ), "expect either results or result_types specified, got both"

    if result_types:
        self._results = [
            ResultValue(self, idx, type=type)
            for idx, type in enumerate(result_types)
        ]

    if not results and not result_types:
        self._results = list(results)

    self.successors = list(successors)
    self.attributes = dict(attributes)
    self.regions = list(regions)

    self.parent = None
    self._next_stmt = None
    self._prev_stmt = None
    self.__post_init__()

attr class-attribute instance-attribute

attr: str = attribute()

name class-attribute instance-attribute

name = 'setattr'

obj class-attribute instance-attribute

obj: SSAValue = argument(print=False)

traits class-attribute instance-attribute

traits = frozenset({FromPythonCall()})

value class-attribute instance-attribute

value: SSAValue = argument(print=False)

SetItem dataclass

SetItem(
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None
)

Bases: Statement


              flowchart TD
              kirin.dialects.py.assign.SetItem[SetItem]
              kirin.ir.nodes.stmt.Statement[Statement]
              kirin.ir.nodes.base.IRNode[IRNode]
              kirin.print.printable.Printable[Printable]

                              kirin.ir.nodes.stmt.Statement --> kirin.dialects.py.assign.SetItem
                                kirin.ir.nodes.base.IRNode --> kirin.ir.nodes.stmt.Statement
                                kirin.print.printable.Printable --> kirin.ir.nodes.base.IRNode
                




              click kirin.dialects.py.assign.SetItem href "" "kirin.dialects.py.assign.SetItem"
              click kirin.ir.nodes.stmt.Statement href "" "kirin.ir.nodes.stmt.Statement"
              click kirin.ir.nodes.base.IRNode href "" "kirin.ir.nodes.base.IRNode"
              click kirin.print.printable.Printable href "" "kirin.print.printable.Printable"
            
Source code in src/kirin/ir/nodes/stmt.py
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
def __init__(
    self,
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None,
) -> None:
    super().__init__()
    """Initialize the Statement.

    Args:
        arsg (Sequence[SSAValue], optional): The arguments of the Statement. Defaults to ().
        regions (Sequence[Region], optional): The regions where the Statement belong to. Defaults to ().
        successors (Sequence[Block], optional): The successors of the Statement. Defaults to ().
        attributes (Mapping[str, Attribute], optional): The attributes of the Statement. Defaults to {}.
        results (Sequence[ResultValue], optional): The result values of the Statement. Defaults to ().
        result_types (Sequence[TypeAttribute], optional): The result types of the Statement. Defaults to ().
        args_slice (Mapping[str, int | slice], optional): The arguments slice of the Statement. Defaults to {}.
        source (SourceInfo | None, optional): The source information of the Statement for debugging/stacktracing. Defaults to None.

    """
    self._args = ()
    self._regions = []
    self._name_args_slice = dict(args_slice)
    self.source = source
    self.args = args

    if results:
        self._results = list(results)
        assert (
            len(result_types) == 0
        ), "expect either results or result_types specified, got both"

    if result_types:
        self._results = [
            ResultValue(self, idx, type=type)
            for idx, type in enumerate(result_types)
        ]

    if not results and not result_types:
        self._results = list(results)

    self.successors = list(successors)
    self.attributes = dict(attributes)
    self.regions = list(regions)

    self.parent = None
    self._next_stmt = None
    self._prev_stmt = None
    self.__post_init__()

index class-attribute instance-attribute

index: SSAValue = argument(print=False)

name class-attribute instance-attribute

name = 'setitem'

obj class-attribute instance-attribute

obj: SSAValue = argument(print=False)

traits class-attribute instance-attribute

traits = frozenset({FromPythonCall()})

value class-attribute instance-attribute

value: SSAValue = argument(print=False)

TypeAssert

TypeAssert(got: SSAValue, *, expected: TypeAttribute)

Bases: Statement


              flowchart TD
              kirin.dialects.py.assign.TypeAssert[TypeAssert]
              kirin.ir.nodes.stmt.Statement[Statement]
              kirin.ir.nodes.base.IRNode[IRNode]
              kirin.print.printable.Printable[Printable]

                              kirin.ir.nodes.stmt.Statement --> kirin.dialects.py.assign.TypeAssert
                                kirin.ir.nodes.base.IRNode --> kirin.ir.nodes.stmt.Statement
                                kirin.print.printable.Printable --> kirin.ir.nodes.base.IRNode
                




              click kirin.dialects.py.assign.TypeAssert href "" "kirin.dialects.py.assign.TypeAssert"
              click kirin.ir.nodes.stmt.Statement href "" "kirin.ir.nodes.stmt.Statement"
              click kirin.ir.nodes.base.IRNode href "" "kirin.ir.nodes.base.IRNode"
              click kirin.print.printable.Printable href "" "kirin.print.printable.Printable"
            
Source code in src/kirin/dialects/py/assign.py
68
69
70
71
72
73
74
def __init__(self, got: ir.SSAValue, *, expected: types.TypeAttribute):
    super().__init__(
        args=(got,),
        attributes={"expected": expected},
        result_types=(expected,),
        args_slice={"got": 0},
    )

expected class-attribute instance-attribute

expected: TypeAttribute = attribute()

got class-attribute instance-attribute

got: SSAValue = argument(print=False)

result class-attribute instance-attribute

result: ResultValue = result()

traits class-attribute instance-attribute

traits = frozenset({FromPythonCall()})

TypeInfer

Bases: MethodTable


              flowchart TD
              kirin.dialects.py.assign.TypeInfer[TypeInfer]
              kirin.interp.table.MethodTable[MethodTable]

                              kirin.interp.table.MethodTable --> kirin.dialects.py.assign.TypeInfer
                


              click kirin.dialects.py.assign.TypeInfer href "" "kirin.dialects.py.assign.TypeInfer"
              click kirin.interp.table.MethodTable href "" "kirin.interp.table.MethodTable"
            

type_assert

type_assert(
    interp_, frame: Frame[TypeAttribute], stmt: TypeAssert
)
Source code in src/kirin/dialects/py/assign.py
108
109
110
111
112
113
114
115
@interp.impl(TypeAssert)
def type_assert(
    self, interp_, frame: interp.Frame[types.TypeAttribute], stmt: TypeAssert
):
    got = frame.get(stmt.got)
    if got.is_subseteq(stmt.expected):
        return (got.meet(stmt.expected),)
    return (types.Bottom,)

Unpack

kirin.dialects.py.unpack

The unpack dialect for Python.

This module contains the dialect for the Python unpack semantics, including:

  • The Unpack statement class.
  • The lowering pass for the unpack statement.
  • The concrete implementation of the unpack statement.
  • The type inference implementation of the unpack statement.
  • A helper function unpacking for unpacking Python AST nodes during lowering.

dialect module-attribute

dialect = Dialect('py.unpack')

Concrete

Bases: MethodTable


              flowchart TD
              kirin.dialects.py.unpack.Concrete[Concrete]
              kirin.interp.table.MethodTable[MethodTable]

                              kirin.interp.table.MethodTable --> kirin.dialects.py.unpack.Concrete
                


              click kirin.dialects.py.unpack.Concrete href "" "kirin.dialects.py.unpack.Concrete"
              click kirin.interp.table.MethodTable href "" "kirin.interp.table.MethodTable"
            

unpack

unpack(interp: Interpreter, frame: Frame, stmt: Unpack)
Source code in src/kirin/dialects/py/unpack.py
46
47
48
@interp.impl(Unpack)
def unpack(self, interp: interp.Interpreter, frame: interp.Frame, stmt: Unpack):
    return tuple(frame.get(stmt.value))

TypeInfer

Bases: MethodTable


              flowchart TD
              kirin.dialects.py.unpack.TypeInfer[TypeInfer]
              kirin.interp.table.MethodTable[MethodTable]

                              kirin.interp.table.MethodTable --> kirin.dialects.py.unpack.TypeInfer
                


              click kirin.dialects.py.unpack.TypeInfer href "" "kirin.dialects.py.unpack.TypeInfer"
              click kirin.interp.table.MethodTable href "" "kirin.interp.table.MethodTable"
            

unpack

unpack(interp, frame: Frame[TypeAttribute], stmt: Unpack)
Source code in src/kirin/dialects/py/unpack.py
54
55
56
57
58
59
60
61
62
63
64
@interp.impl(Unpack)
def unpack(self, interp, frame: interp.Frame[types.TypeAttribute], stmt: Unpack):
    value = frame.get(stmt.value)
    if isinstance(value, types.Generic) and value.is_subseteq(types.Tuple):
        if value.vararg:
            rest = tuple(value.vararg.typ for _ in stmt.names[len(value.vars) :])
            return tuple(value.vars) + rest
        else:
            return value.vars
    # TODO: support unpacking other types
    return tuple(types.Any for _ in stmt.names)

Unpack

Unpack(value: SSAValue, names: tuple[str | None, ...])

Bases: Statement


              flowchart TD
              kirin.dialects.py.unpack.Unpack[Unpack]
              kirin.ir.nodes.stmt.Statement[Statement]
              kirin.ir.nodes.base.IRNode[IRNode]
              kirin.print.printable.Printable[Printable]

                              kirin.ir.nodes.stmt.Statement --> kirin.dialects.py.unpack.Unpack
                                kirin.ir.nodes.base.IRNode --> kirin.ir.nodes.stmt.Statement
                                kirin.print.printable.Printable --> kirin.ir.nodes.base.IRNode
                




              click kirin.dialects.py.unpack.Unpack href "" "kirin.dialects.py.unpack.Unpack"
              click kirin.ir.nodes.stmt.Statement href "" "kirin.ir.nodes.stmt.Statement"
              click kirin.ir.nodes.base.IRNode href "" "kirin.ir.nodes.base.IRNode"
              click kirin.print.printable.Printable href "" "kirin.print.printable.Printable"
            
Source code in src/kirin/dialects/py/unpack.py
26
27
28
29
30
31
32
33
34
35
def __init__(self, value: ir.SSAValue, names: tuple[str | None, ...]):
    result_types = [types.Any] * len(names)
    super().__init__(
        args=(value,),
        result_types=result_types,
        args_slice={"value": 0},
        attributes={"names": ir.PyAttr(names)},
    )
    for result, name in zip(self.results, names):
        result.name = name

names class-attribute instance-attribute

names: tuple[str | None, ...] = attribute()

value class-attribute instance-attribute

value: SSAValue = argument(Any)

print_impl

print_impl(printer: Printer) -> None
Source code in src/kirin/dialects/py/unpack.py
37
38
39
40
def print_impl(self, printer: Printer) -> None:
    printer.print_name(self)
    printer.plain_print(" ")
    printer.print(self.value)

unpacking

unpacking(state: State, node: expr, value: SSAValue)
Source code in src/kirin/dialects/py/unpack.py
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
def unpacking(state: lowering.State, node: ast.expr, value: ir.SSAValue):
    if isinstance(node, ast.Name):
        state.current_frame.defs[node.id] = value
        value.name = node.id
        return
    elif not isinstance(node, ast.Tuple):
        raise lowering.BuildError(f"unsupported unpack node {node}")

    names: list[str | None] = []
    continue_unpack: list[int] = []
    for idx, item in enumerate(node.elts):
        if isinstance(item, ast.Name):
            names.append(item.id)
        else:
            names.append(None)
            continue_unpack.append(idx)
    stmt = state.current_frame.push(Unpack(value, tuple(names)))
    for name, result in zip(names, stmt.results):
        if name is not None:
            state.current_frame.defs[name] = result

    for idx in continue_unpack:
        unpacking(state, node.elts[idx], stmt.results[idx])

Boolean Operation

kirin.dialects.py.boolop

Boolean operators for Python dialect.

This module contains the dialect for the Python boolean operators, including:

  • The And and Or statement classes.
  • The lowering pass for the boolean operators.
  • The concrete implementation of the boolean operators.
  • The Julia emitter for the boolean operators.

This dialect maps ast.BoolOp nodes to the And and Or statements.

dialect module-attribute

dialect = Dialect('py.boolop')

And dataclass

And(
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None
)

Bases: BoolOp


              flowchart TD
              kirin.dialects.py.boolop.And[And]
              kirin.dialects.py.boolop.BoolOp[BoolOp]
              kirin.ir.nodes.stmt.Statement[Statement]
              kirin.ir.nodes.base.IRNode[IRNode]
              kirin.print.printable.Printable[Printable]

                              kirin.dialects.py.boolop.BoolOp --> kirin.dialects.py.boolop.And
                                kirin.ir.nodes.stmt.Statement --> kirin.dialects.py.boolop.BoolOp
                                kirin.ir.nodes.base.IRNode --> kirin.ir.nodes.stmt.Statement
                                kirin.print.printable.Printable --> kirin.ir.nodes.base.IRNode
                





              click kirin.dialects.py.boolop.And href "" "kirin.dialects.py.boolop.And"
              click kirin.dialects.py.boolop.BoolOp href "" "kirin.dialects.py.boolop.BoolOp"
              click kirin.ir.nodes.stmt.Statement href "" "kirin.ir.nodes.stmt.Statement"
              click kirin.ir.nodes.base.IRNode href "" "kirin.ir.nodes.base.IRNode"
              click kirin.print.printable.Printable href "" "kirin.print.printable.Printable"
            
Source code in src/kirin/ir/nodes/stmt.py
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
def __init__(
    self,
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None,
) -> None:
    super().__init__()
    """Initialize the Statement.

    Args:
        arsg (Sequence[SSAValue], optional): The arguments of the Statement. Defaults to ().
        regions (Sequence[Region], optional): The regions where the Statement belong to. Defaults to ().
        successors (Sequence[Block], optional): The successors of the Statement. Defaults to ().
        attributes (Mapping[str, Attribute], optional): The attributes of the Statement. Defaults to {}.
        results (Sequence[ResultValue], optional): The result values of the Statement. Defaults to ().
        result_types (Sequence[TypeAttribute], optional): The result types of the Statement. Defaults to ().
        args_slice (Mapping[str, int | slice], optional): The arguments slice of the Statement. Defaults to {}.
        source (SourceInfo | None, optional): The source information of the Statement for debugging/stacktracing. Defaults to None.

    """
    self._args = ()
    self._regions = []
    self._name_args_slice = dict(args_slice)
    self.source = source
    self.args = args

    if results:
        self._results = list(results)
        assert (
            len(result_types) == 0
        ), "expect either results or result_types specified, got both"

    if result_types:
        self._results = [
            ResultValue(self, idx, type=type)
            for idx, type in enumerate(result_types)
        ]

    if not results and not result_types:
        self._results = list(results)

    self.successors = list(successors)
    self.attributes = dict(attributes)
    self.regions = list(regions)

    self.parent = None
    self._next_stmt = None
    self._prev_stmt = None
    self.__post_init__()

name class-attribute instance-attribute

name = 'and'

BoolOp dataclass

BoolOp(
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None
)

Bases: Statement


              flowchart TD
              kirin.dialects.py.boolop.BoolOp[BoolOp]
              kirin.ir.nodes.stmt.Statement[Statement]
              kirin.ir.nodes.base.IRNode[IRNode]
              kirin.print.printable.Printable[Printable]

                              kirin.ir.nodes.stmt.Statement --> kirin.dialects.py.boolop.BoolOp
                                kirin.ir.nodes.base.IRNode --> kirin.ir.nodes.stmt.Statement
                                kirin.print.printable.Printable --> kirin.ir.nodes.base.IRNode
                




              click kirin.dialects.py.boolop.BoolOp href "" "kirin.dialects.py.boolop.BoolOp"
              click kirin.ir.nodes.stmt.Statement href "" "kirin.ir.nodes.stmt.Statement"
              click kirin.ir.nodes.base.IRNode href "" "kirin.ir.nodes.base.IRNode"
              click kirin.print.printable.Printable href "" "kirin.print.printable.Printable"
            
Source code in src/kirin/ir/nodes/stmt.py
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
def __init__(
    self,
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None,
) -> None:
    super().__init__()
    """Initialize the Statement.

    Args:
        arsg (Sequence[SSAValue], optional): The arguments of the Statement. Defaults to ().
        regions (Sequence[Region], optional): The regions where the Statement belong to. Defaults to ().
        successors (Sequence[Block], optional): The successors of the Statement. Defaults to ().
        attributes (Mapping[str, Attribute], optional): The attributes of the Statement. Defaults to {}.
        results (Sequence[ResultValue], optional): The result values of the Statement. Defaults to ().
        result_types (Sequence[TypeAttribute], optional): The result types of the Statement. Defaults to ().
        args_slice (Mapping[str, int | slice], optional): The arguments slice of the Statement. Defaults to {}.
        source (SourceInfo | None, optional): The source information of the Statement for debugging/stacktracing. Defaults to None.

    """
    self._args = ()
    self._regions = []
    self._name_args_slice = dict(args_slice)
    self.source = source
    self.args = args

    if results:
        self._results = list(results)
        assert (
            len(result_types) == 0
        ), "expect either results or result_types specified, got both"

    if result_types:
        self._results = [
            ResultValue(self, idx, type=type)
            for idx, type in enumerate(result_types)
        ]

    if not results and not result_types:
        self._results = list(results)

    self.successors = list(successors)
    self.attributes = dict(attributes)
    self.regions = list(regions)

    self.parent = None
    self._next_stmt = None
    self._prev_stmt = None
    self.__post_init__()

lhs class-attribute instance-attribute

lhs: SSAValue = argument(print=False)

result class-attribute instance-attribute

result: ResultValue = result(Bool)

rhs class-attribute instance-attribute

rhs: SSAValue = argument(print=False)

traits class-attribute instance-attribute

traits = frozenset({Pure(), FromPythonCall()})

BoolOpMethod

Bases: MethodTable


              flowchart TD
              kirin.dialects.py.boolop.BoolOpMethod[BoolOpMethod]
              kirin.interp.table.MethodTable[MethodTable]

                              kirin.interp.table.MethodTable --> kirin.dialects.py.boolop.BoolOpMethod
                


              click kirin.dialects.py.boolop.BoolOpMethod href "" "kirin.dialects.py.boolop.BoolOpMethod"
              click kirin.interp.table.MethodTable href "" "kirin.interp.table.MethodTable"
            

and_

and_(interp, frame: Frame, stmt: And)
Source code in src/kirin/dialects/py/boolop.py
62
63
64
@interp.impl(And)
def and_(self, interp, frame: interp.Frame, stmt: And):
    return (frame.get(stmt.lhs) and frame.get(stmt.rhs),)

or_

or_(interp, frame: Frame, stmt: Or)
Source code in src/kirin/dialects/py/boolop.py
66
67
68
@interp.impl(Or)
def or_(self, interp, frame: interp.Frame, stmt: Or):
    return (frame.get(stmt.lhs) or frame.get(stmt.rhs),)

Or dataclass

Or(
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None
)

Bases: BoolOp


              flowchart TD
              kirin.dialects.py.boolop.Or[Or]
              kirin.dialects.py.boolop.BoolOp[BoolOp]
              kirin.ir.nodes.stmt.Statement[Statement]
              kirin.ir.nodes.base.IRNode[IRNode]
              kirin.print.printable.Printable[Printable]

                              kirin.dialects.py.boolop.BoolOp --> kirin.dialects.py.boolop.Or
                                kirin.ir.nodes.stmt.Statement --> kirin.dialects.py.boolop.BoolOp
                                kirin.ir.nodes.base.IRNode --> kirin.ir.nodes.stmt.Statement
                                kirin.print.printable.Printable --> kirin.ir.nodes.base.IRNode
                





              click kirin.dialects.py.boolop.Or href "" "kirin.dialects.py.boolop.Or"
              click kirin.dialects.py.boolop.BoolOp href "" "kirin.dialects.py.boolop.BoolOp"
              click kirin.ir.nodes.stmt.Statement href "" "kirin.ir.nodes.stmt.Statement"
              click kirin.ir.nodes.base.IRNode href "" "kirin.ir.nodes.base.IRNode"
              click kirin.print.printable.Printable href "" "kirin.print.printable.Printable"
            
Source code in src/kirin/ir/nodes/stmt.py
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
def __init__(
    self,
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None,
) -> None:
    super().__init__()
    """Initialize the Statement.

    Args:
        arsg (Sequence[SSAValue], optional): The arguments of the Statement. Defaults to ().
        regions (Sequence[Region], optional): The regions where the Statement belong to. Defaults to ().
        successors (Sequence[Block], optional): The successors of the Statement. Defaults to ().
        attributes (Mapping[str, Attribute], optional): The attributes of the Statement. Defaults to {}.
        results (Sequence[ResultValue], optional): The result values of the Statement. Defaults to ().
        result_types (Sequence[TypeAttribute], optional): The result types of the Statement. Defaults to ().
        args_slice (Mapping[str, int | slice], optional): The arguments slice of the Statement. Defaults to {}.
        source (SourceInfo | None, optional): The source information of the Statement for debugging/stacktracing. Defaults to None.

    """
    self._args = ()
    self._regions = []
    self._name_args_slice = dict(args_slice)
    self.source = source
    self.args = args

    if results:
        self._results = list(results)
        assert (
            len(result_types) == 0
        ), "expect either results or result_types specified, got both"

    if result_types:
        self._results = [
            ResultValue(self, idx, type=type)
            for idx, type in enumerate(result_types)
        ]

    if not results and not result_types:
        self._results = list(results)

    self.successors = list(successors)
    self.attributes = dict(attributes)
    self.regions = list(regions)

    self.parent = None
    self._next_stmt = None
    self._prev_stmt = None
    self.__post_init__()

name class-attribute instance-attribute

name = 'or'

PythonLowering dataclass

PythonLowering()

Bases: FromPythonAST


              flowchart TD
              kirin.dialects.py.boolop.PythonLowering[PythonLowering]
              kirin.lowering.python.dialect.FromPythonAST[FromPythonAST]

                              kirin.lowering.python.dialect.FromPythonAST --> kirin.dialects.py.boolop.PythonLowering
                


              click kirin.dialects.py.boolop.PythonLowering href "" "kirin.dialects.py.boolop.PythonLowering"
              click kirin.lowering.python.dialect.FromPythonAST href "" "kirin.lowering.python.dialect.FromPythonAST"
            

lower_BoolOp

lower_BoolOp(state: State, node: BoolOp) -> lowering.Result
Source code in src/kirin/dialects/py/boolop.py
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
def lower_BoolOp(self, state: lowering.State, node: ast.BoolOp) -> lowering.Result:
    lhs = state.lower(node.values[0]).expect_one()
    match node.op:
        case ast.And():
            boolop = And
        case ast.Or():
            boolop = Or
        case _:
            raise lowering.BuildError(f"unsupported boolop {node.op}")

    for value in node.values[1:]:
        lhs = state.current_frame.push(
            boolop(lhs=lhs, rhs=state.lower(value).expect_one())
        ).result
    return lhs

Comparison

kirin.dialects.py.cmp.stmts

Cmp dataclass

Cmp(
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None
)

Bases: Statement


              flowchart TD
              kirin.dialects.py.cmp.stmts.Cmp[Cmp]
              kirin.ir.nodes.stmt.Statement[Statement]
              kirin.ir.nodes.base.IRNode[IRNode]
              kirin.print.printable.Printable[Printable]

                              kirin.ir.nodes.stmt.Statement --> kirin.dialects.py.cmp.stmts.Cmp
                                kirin.ir.nodes.base.IRNode --> kirin.ir.nodes.stmt.Statement
                                kirin.print.printable.Printable --> kirin.ir.nodes.base.IRNode
                




              click kirin.dialects.py.cmp.stmts.Cmp href "" "kirin.dialects.py.cmp.stmts.Cmp"
              click kirin.ir.nodes.stmt.Statement href "" "kirin.ir.nodes.stmt.Statement"
              click kirin.ir.nodes.base.IRNode href "" "kirin.ir.nodes.base.IRNode"
              click kirin.print.printable.Printable href "" "kirin.print.printable.Printable"
            
Source code in src/kirin/ir/nodes/stmt.py
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
def __init__(
    self,
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None,
) -> None:
    super().__init__()
    """Initialize the Statement.

    Args:
        arsg (Sequence[SSAValue], optional): The arguments of the Statement. Defaults to ().
        regions (Sequence[Region], optional): The regions where the Statement belong to. Defaults to ().
        successors (Sequence[Block], optional): The successors of the Statement. Defaults to ().
        attributes (Mapping[str, Attribute], optional): The attributes of the Statement. Defaults to {}.
        results (Sequence[ResultValue], optional): The result values of the Statement. Defaults to ().
        result_types (Sequence[TypeAttribute], optional): The result types of the Statement. Defaults to ().
        args_slice (Mapping[str, int | slice], optional): The arguments slice of the Statement. Defaults to {}.
        source (SourceInfo | None, optional): The source information of the Statement for debugging/stacktracing. Defaults to None.

    """
    self._args = ()
    self._regions = []
    self._name_args_slice = dict(args_slice)
    self.source = source
    self.args = args

    if results:
        self._results = list(results)
        assert (
            len(result_types) == 0
        ), "expect either results or result_types specified, got both"

    if result_types:
        self._results = [
            ResultValue(self, idx, type=type)
            for idx, type in enumerate(result_types)
        ]

    if not results and not result_types:
        self._results = list(results)

    self.successors = list(successors)
    self.attributes = dict(attributes)
    self.regions = list(regions)

    self.parent = None
    self._next_stmt = None
    self._prev_stmt = None
    self.__post_init__()

lhs class-attribute instance-attribute

lhs: SSAValue = argument()

result class-attribute instance-attribute

result: ResultValue = result(Bool)

rhs class-attribute instance-attribute

rhs: SSAValue = argument()

traits class-attribute instance-attribute

traits = frozenset({Pure(), FromPythonCall()})

Eq dataclass

Eq(
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None
)

Bases: Cmp


              flowchart TD
              kirin.dialects.py.cmp.stmts.Eq[Eq]
              kirin.dialects.py.cmp.stmts.Cmp[Cmp]
              kirin.ir.nodes.stmt.Statement[Statement]
              kirin.ir.nodes.base.IRNode[IRNode]
              kirin.print.printable.Printable[Printable]

                              kirin.dialects.py.cmp.stmts.Cmp --> kirin.dialects.py.cmp.stmts.Eq
                                kirin.ir.nodes.stmt.Statement --> kirin.dialects.py.cmp.stmts.Cmp
                                kirin.ir.nodes.base.IRNode --> kirin.ir.nodes.stmt.Statement
                                kirin.print.printable.Printable --> kirin.ir.nodes.base.IRNode
                





              click kirin.dialects.py.cmp.stmts.Eq href "" "kirin.dialects.py.cmp.stmts.Eq"
              click kirin.dialects.py.cmp.stmts.Cmp href "" "kirin.dialects.py.cmp.stmts.Cmp"
              click kirin.ir.nodes.stmt.Statement href "" "kirin.ir.nodes.stmt.Statement"
              click kirin.ir.nodes.base.IRNode href "" "kirin.ir.nodes.base.IRNode"
              click kirin.print.printable.Printable href "" "kirin.print.printable.Printable"
            
Source code in src/kirin/ir/nodes/stmt.py
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
def __init__(
    self,
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None,
) -> None:
    super().__init__()
    """Initialize the Statement.

    Args:
        arsg (Sequence[SSAValue], optional): The arguments of the Statement. Defaults to ().
        regions (Sequence[Region], optional): The regions where the Statement belong to. Defaults to ().
        successors (Sequence[Block], optional): The successors of the Statement. Defaults to ().
        attributes (Mapping[str, Attribute], optional): The attributes of the Statement. Defaults to {}.
        results (Sequence[ResultValue], optional): The result values of the Statement. Defaults to ().
        result_types (Sequence[TypeAttribute], optional): The result types of the Statement. Defaults to ().
        args_slice (Mapping[str, int | slice], optional): The arguments slice of the Statement. Defaults to {}.
        source (SourceInfo | None, optional): The source information of the Statement for debugging/stacktracing. Defaults to None.

    """
    self._args = ()
    self._regions = []
    self._name_args_slice = dict(args_slice)
    self.source = source
    self.args = args

    if results:
        self._results = list(results)
        assert (
            len(result_types) == 0
        ), "expect either results or result_types specified, got both"

    if result_types:
        self._results = [
            ResultValue(self, idx, type=type)
            for idx, type in enumerate(result_types)
        ]

    if not results and not result_types:
        self._results = list(results)

    self.successors = list(successors)
    self.attributes = dict(attributes)
    self.regions = list(regions)

    self.parent = None
    self._next_stmt = None
    self._prev_stmt = None
    self.__post_init__()

name class-attribute instance-attribute

name = 'eq'

Gt dataclass

Gt(
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None
)

Bases: Cmp


              flowchart TD
              kirin.dialects.py.cmp.stmts.Gt[Gt]
              kirin.dialects.py.cmp.stmts.Cmp[Cmp]
              kirin.ir.nodes.stmt.Statement[Statement]
              kirin.ir.nodes.base.IRNode[IRNode]
              kirin.print.printable.Printable[Printable]

                              kirin.dialects.py.cmp.stmts.Cmp --> kirin.dialects.py.cmp.stmts.Gt
                                kirin.ir.nodes.stmt.Statement --> kirin.dialects.py.cmp.stmts.Cmp
                                kirin.ir.nodes.base.IRNode --> kirin.ir.nodes.stmt.Statement
                                kirin.print.printable.Printable --> kirin.ir.nodes.base.IRNode
                





              click kirin.dialects.py.cmp.stmts.Gt href "" "kirin.dialects.py.cmp.stmts.Gt"
              click kirin.dialects.py.cmp.stmts.Cmp href "" "kirin.dialects.py.cmp.stmts.Cmp"
              click kirin.ir.nodes.stmt.Statement href "" "kirin.ir.nodes.stmt.Statement"
              click kirin.ir.nodes.base.IRNode href "" "kirin.ir.nodes.base.IRNode"
              click kirin.print.printable.Printable href "" "kirin.print.printable.Printable"
            
Source code in src/kirin/ir/nodes/stmt.py
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
def __init__(
    self,
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None,
) -> None:
    super().__init__()
    """Initialize the Statement.

    Args:
        arsg (Sequence[SSAValue], optional): The arguments of the Statement. Defaults to ().
        regions (Sequence[Region], optional): The regions where the Statement belong to. Defaults to ().
        successors (Sequence[Block], optional): The successors of the Statement. Defaults to ().
        attributes (Mapping[str, Attribute], optional): The attributes of the Statement. Defaults to {}.
        results (Sequence[ResultValue], optional): The result values of the Statement. Defaults to ().
        result_types (Sequence[TypeAttribute], optional): The result types of the Statement. Defaults to ().
        args_slice (Mapping[str, int | slice], optional): The arguments slice of the Statement. Defaults to {}.
        source (SourceInfo | None, optional): The source information of the Statement for debugging/stacktracing. Defaults to None.

    """
    self._args = ()
    self._regions = []
    self._name_args_slice = dict(args_slice)
    self.source = source
    self.args = args

    if results:
        self._results = list(results)
        assert (
            len(result_types) == 0
        ), "expect either results or result_types specified, got both"

    if result_types:
        self._results = [
            ResultValue(self, idx, type=type)
            for idx, type in enumerate(result_types)
        ]

    if not results and not result_types:
        self._results = list(results)

    self.successors = list(successors)
    self.attributes = dict(attributes)
    self.regions = list(regions)

    self.parent = None
    self._next_stmt = None
    self._prev_stmt = None
    self.__post_init__()

name class-attribute instance-attribute

name = 'gt'

GtE dataclass

GtE(
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None
)

Bases: Cmp


              flowchart TD
              kirin.dialects.py.cmp.stmts.GtE[GtE]
              kirin.dialects.py.cmp.stmts.Cmp[Cmp]
              kirin.ir.nodes.stmt.Statement[Statement]
              kirin.ir.nodes.base.IRNode[IRNode]
              kirin.print.printable.Printable[Printable]

                              kirin.dialects.py.cmp.stmts.Cmp --> kirin.dialects.py.cmp.stmts.GtE
                                kirin.ir.nodes.stmt.Statement --> kirin.dialects.py.cmp.stmts.Cmp
                                kirin.ir.nodes.base.IRNode --> kirin.ir.nodes.stmt.Statement
                                kirin.print.printable.Printable --> kirin.ir.nodes.base.IRNode
                





              click kirin.dialects.py.cmp.stmts.GtE href "" "kirin.dialects.py.cmp.stmts.GtE"
              click kirin.dialects.py.cmp.stmts.Cmp href "" "kirin.dialects.py.cmp.stmts.Cmp"
              click kirin.ir.nodes.stmt.Statement href "" "kirin.ir.nodes.stmt.Statement"
              click kirin.ir.nodes.base.IRNode href "" "kirin.ir.nodes.base.IRNode"
              click kirin.print.printable.Printable href "" "kirin.print.printable.Printable"
            
Source code in src/kirin/ir/nodes/stmt.py
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
def __init__(
    self,
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None,
) -> None:
    super().__init__()
    """Initialize the Statement.

    Args:
        arsg (Sequence[SSAValue], optional): The arguments of the Statement. Defaults to ().
        regions (Sequence[Region], optional): The regions where the Statement belong to. Defaults to ().
        successors (Sequence[Block], optional): The successors of the Statement. Defaults to ().
        attributes (Mapping[str, Attribute], optional): The attributes of the Statement. Defaults to {}.
        results (Sequence[ResultValue], optional): The result values of the Statement. Defaults to ().
        result_types (Sequence[TypeAttribute], optional): The result types of the Statement. Defaults to ().
        args_slice (Mapping[str, int | slice], optional): The arguments slice of the Statement. Defaults to {}.
        source (SourceInfo | None, optional): The source information of the Statement for debugging/stacktracing. Defaults to None.

    """
    self._args = ()
    self._regions = []
    self._name_args_slice = dict(args_slice)
    self.source = source
    self.args = args

    if results:
        self._results = list(results)
        assert (
            len(result_types) == 0
        ), "expect either results or result_types specified, got both"

    if result_types:
        self._results = [
            ResultValue(self, idx, type=type)
            for idx, type in enumerate(result_types)
        ]

    if not results and not result_types:
        self._results = list(results)

    self.successors = list(successors)
    self.attributes = dict(attributes)
    self.regions = list(regions)

    self.parent = None
    self._next_stmt = None
    self._prev_stmt = None
    self.__post_init__()

name class-attribute instance-attribute

name = 'gte'

In dataclass

In(
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None
)

Bases: Cmp


              flowchart TD
              kirin.dialects.py.cmp.stmts.In[In]
              kirin.dialects.py.cmp.stmts.Cmp[Cmp]
              kirin.ir.nodes.stmt.Statement[Statement]
              kirin.ir.nodes.base.IRNode[IRNode]
              kirin.print.printable.Printable[Printable]

                              kirin.dialects.py.cmp.stmts.Cmp --> kirin.dialects.py.cmp.stmts.In
                                kirin.ir.nodes.stmt.Statement --> kirin.dialects.py.cmp.stmts.Cmp
                                kirin.ir.nodes.base.IRNode --> kirin.ir.nodes.stmt.Statement
                                kirin.print.printable.Printable --> kirin.ir.nodes.base.IRNode
                





              click kirin.dialects.py.cmp.stmts.In href "" "kirin.dialects.py.cmp.stmts.In"
              click kirin.dialects.py.cmp.stmts.Cmp href "" "kirin.dialects.py.cmp.stmts.Cmp"
              click kirin.ir.nodes.stmt.Statement href "" "kirin.ir.nodes.stmt.Statement"
              click kirin.ir.nodes.base.IRNode href "" "kirin.ir.nodes.base.IRNode"
              click kirin.print.printable.Printable href "" "kirin.print.printable.Printable"
            
Source code in src/kirin/ir/nodes/stmt.py
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
def __init__(
    self,
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None,
) -> None:
    super().__init__()
    """Initialize the Statement.

    Args:
        arsg (Sequence[SSAValue], optional): The arguments of the Statement. Defaults to ().
        regions (Sequence[Region], optional): The regions where the Statement belong to. Defaults to ().
        successors (Sequence[Block], optional): The successors of the Statement. Defaults to ().
        attributes (Mapping[str, Attribute], optional): The attributes of the Statement. Defaults to {}.
        results (Sequence[ResultValue], optional): The result values of the Statement. Defaults to ().
        result_types (Sequence[TypeAttribute], optional): The result types of the Statement. Defaults to ().
        args_slice (Mapping[str, int | slice], optional): The arguments slice of the Statement. Defaults to {}.
        source (SourceInfo | None, optional): The source information of the Statement for debugging/stacktracing. Defaults to None.

    """
    self._args = ()
    self._regions = []
    self._name_args_slice = dict(args_slice)
    self.source = source
    self.args = args

    if results:
        self._results = list(results)
        assert (
            len(result_types) == 0
        ), "expect either results or result_types specified, got both"

    if result_types:
        self._results = [
            ResultValue(self, idx, type=type)
            for idx, type in enumerate(result_types)
        ]

    if not results and not result_types:
        self._results = list(results)

    self.successors = list(successors)
    self.attributes = dict(attributes)
    self.regions = list(regions)

    self.parent = None
    self._next_stmt = None
    self._prev_stmt = None
    self.__post_init__()

name class-attribute instance-attribute

name = 'in'

Is dataclass

Is(
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None
)

Bases: Cmp


              flowchart TD
              kirin.dialects.py.cmp.stmts.Is[Is]
              kirin.dialects.py.cmp.stmts.Cmp[Cmp]
              kirin.ir.nodes.stmt.Statement[Statement]
              kirin.ir.nodes.base.IRNode[IRNode]
              kirin.print.printable.Printable[Printable]

                              kirin.dialects.py.cmp.stmts.Cmp --> kirin.dialects.py.cmp.stmts.Is
                                kirin.ir.nodes.stmt.Statement --> kirin.dialects.py.cmp.stmts.Cmp
                                kirin.ir.nodes.base.IRNode --> kirin.ir.nodes.stmt.Statement
                                kirin.print.printable.Printable --> kirin.ir.nodes.base.IRNode
                





              click kirin.dialects.py.cmp.stmts.Is href "" "kirin.dialects.py.cmp.stmts.Is"
              click kirin.dialects.py.cmp.stmts.Cmp href "" "kirin.dialects.py.cmp.stmts.Cmp"
              click kirin.ir.nodes.stmt.Statement href "" "kirin.ir.nodes.stmt.Statement"
              click kirin.ir.nodes.base.IRNode href "" "kirin.ir.nodes.base.IRNode"
              click kirin.print.printable.Printable href "" "kirin.print.printable.Printable"
            
Source code in src/kirin/ir/nodes/stmt.py
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
def __init__(
    self,
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None,
) -> None:
    super().__init__()
    """Initialize the Statement.

    Args:
        arsg (Sequence[SSAValue], optional): The arguments of the Statement. Defaults to ().
        regions (Sequence[Region], optional): The regions where the Statement belong to. Defaults to ().
        successors (Sequence[Block], optional): The successors of the Statement. Defaults to ().
        attributes (Mapping[str, Attribute], optional): The attributes of the Statement. Defaults to {}.
        results (Sequence[ResultValue], optional): The result values of the Statement. Defaults to ().
        result_types (Sequence[TypeAttribute], optional): The result types of the Statement. Defaults to ().
        args_slice (Mapping[str, int | slice], optional): The arguments slice of the Statement. Defaults to {}.
        source (SourceInfo | None, optional): The source information of the Statement for debugging/stacktracing. Defaults to None.

    """
    self._args = ()
    self._regions = []
    self._name_args_slice = dict(args_slice)
    self.source = source
    self.args = args

    if results:
        self._results = list(results)
        assert (
            len(result_types) == 0
        ), "expect either results or result_types specified, got both"

    if result_types:
        self._results = [
            ResultValue(self, idx, type=type)
            for idx, type in enumerate(result_types)
        ]

    if not results and not result_types:
        self._results = list(results)

    self.successors = list(successors)
    self.attributes = dict(attributes)
    self.regions = list(regions)

    self.parent = None
    self._next_stmt = None
    self._prev_stmt = None
    self.__post_init__()

name class-attribute instance-attribute

name = 'is'

IsNot dataclass

IsNot(
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None
)

Bases: Cmp


              flowchart TD
              kirin.dialects.py.cmp.stmts.IsNot[IsNot]
              kirin.dialects.py.cmp.stmts.Cmp[Cmp]
              kirin.ir.nodes.stmt.Statement[Statement]
              kirin.ir.nodes.base.IRNode[IRNode]
              kirin.print.printable.Printable[Printable]

                              kirin.dialects.py.cmp.stmts.Cmp --> kirin.dialects.py.cmp.stmts.IsNot
                                kirin.ir.nodes.stmt.Statement --> kirin.dialects.py.cmp.stmts.Cmp
                                kirin.ir.nodes.base.IRNode --> kirin.ir.nodes.stmt.Statement
                                kirin.print.printable.Printable --> kirin.ir.nodes.base.IRNode
                





              click kirin.dialects.py.cmp.stmts.IsNot href "" "kirin.dialects.py.cmp.stmts.IsNot"
              click kirin.dialects.py.cmp.stmts.Cmp href "" "kirin.dialects.py.cmp.stmts.Cmp"
              click kirin.ir.nodes.stmt.Statement href "" "kirin.ir.nodes.stmt.Statement"
              click kirin.ir.nodes.base.IRNode href "" "kirin.ir.nodes.base.IRNode"
              click kirin.print.printable.Printable href "" "kirin.print.printable.Printable"
            
Source code in src/kirin/ir/nodes/stmt.py
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
def __init__(
    self,
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None,
) -> None:
    super().__init__()
    """Initialize the Statement.

    Args:
        arsg (Sequence[SSAValue], optional): The arguments of the Statement. Defaults to ().
        regions (Sequence[Region], optional): The regions where the Statement belong to. Defaults to ().
        successors (Sequence[Block], optional): The successors of the Statement. Defaults to ().
        attributes (Mapping[str, Attribute], optional): The attributes of the Statement. Defaults to {}.
        results (Sequence[ResultValue], optional): The result values of the Statement. Defaults to ().
        result_types (Sequence[TypeAttribute], optional): The result types of the Statement. Defaults to ().
        args_slice (Mapping[str, int | slice], optional): The arguments slice of the Statement. Defaults to {}.
        source (SourceInfo | None, optional): The source information of the Statement for debugging/stacktracing. Defaults to None.

    """
    self._args = ()
    self._regions = []
    self._name_args_slice = dict(args_slice)
    self.source = source
    self.args = args

    if results:
        self._results = list(results)
        assert (
            len(result_types) == 0
        ), "expect either results or result_types specified, got both"

    if result_types:
        self._results = [
            ResultValue(self, idx, type=type)
            for idx, type in enumerate(result_types)
        ]

    if not results and not result_types:
        self._results = list(results)

    self.successors = list(successors)
    self.attributes = dict(attributes)
    self.regions = list(regions)

    self.parent = None
    self._next_stmt = None
    self._prev_stmt = None
    self.__post_init__()

name class-attribute instance-attribute

name = 'is_not'

Lt dataclass

Lt(
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None
)

Bases: Cmp


              flowchart TD
              kirin.dialects.py.cmp.stmts.Lt[Lt]
              kirin.dialects.py.cmp.stmts.Cmp[Cmp]
              kirin.ir.nodes.stmt.Statement[Statement]
              kirin.ir.nodes.base.IRNode[IRNode]
              kirin.print.printable.Printable[Printable]

                              kirin.dialects.py.cmp.stmts.Cmp --> kirin.dialects.py.cmp.stmts.Lt
                                kirin.ir.nodes.stmt.Statement --> kirin.dialects.py.cmp.stmts.Cmp
                                kirin.ir.nodes.base.IRNode --> kirin.ir.nodes.stmt.Statement
                                kirin.print.printable.Printable --> kirin.ir.nodes.base.IRNode
                





              click kirin.dialects.py.cmp.stmts.Lt href "" "kirin.dialects.py.cmp.stmts.Lt"
              click kirin.dialects.py.cmp.stmts.Cmp href "" "kirin.dialects.py.cmp.stmts.Cmp"
              click kirin.ir.nodes.stmt.Statement href "" "kirin.ir.nodes.stmt.Statement"
              click kirin.ir.nodes.base.IRNode href "" "kirin.ir.nodes.base.IRNode"
              click kirin.print.printable.Printable href "" "kirin.print.printable.Printable"
            
Source code in src/kirin/ir/nodes/stmt.py
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
def __init__(
    self,
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None,
) -> None:
    super().__init__()
    """Initialize the Statement.

    Args:
        arsg (Sequence[SSAValue], optional): The arguments of the Statement. Defaults to ().
        regions (Sequence[Region], optional): The regions where the Statement belong to. Defaults to ().
        successors (Sequence[Block], optional): The successors of the Statement. Defaults to ().
        attributes (Mapping[str, Attribute], optional): The attributes of the Statement. Defaults to {}.
        results (Sequence[ResultValue], optional): The result values of the Statement. Defaults to ().
        result_types (Sequence[TypeAttribute], optional): The result types of the Statement. Defaults to ().
        args_slice (Mapping[str, int | slice], optional): The arguments slice of the Statement. Defaults to {}.
        source (SourceInfo | None, optional): The source information of the Statement for debugging/stacktracing. Defaults to None.

    """
    self._args = ()
    self._regions = []
    self._name_args_slice = dict(args_slice)
    self.source = source
    self.args = args

    if results:
        self._results = list(results)
        assert (
            len(result_types) == 0
        ), "expect either results or result_types specified, got both"

    if result_types:
        self._results = [
            ResultValue(self, idx, type=type)
            for idx, type in enumerate(result_types)
        ]

    if not results and not result_types:
        self._results = list(results)

    self.successors = list(successors)
    self.attributes = dict(attributes)
    self.regions = list(regions)

    self.parent = None
    self._next_stmt = None
    self._prev_stmt = None
    self.__post_init__()

name class-attribute instance-attribute

name = 'lt'

LtE dataclass

LtE(
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None
)

Bases: Cmp


              flowchart TD
              kirin.dialects.py.cmp.stmts.LtE[LtE]
              kirin.dialects.py.cmp.stmts.Cmp[Cmp]
              kirin.ir.nodes.stmt.Statement[Statement]
              kirin.ir.nodes.base.IRNode[IRNode]
              kirin.print.printable.Printable[Printable]

                              kirin.dialects.py.cmp.stmts.Cmp --> kirin.dialects.py.cmp.stmts.LtE
                                kirin.ir.nodes.stmt.Statement --> kirin.dialects.py.cmp.stmts.Cmp
                                kirin.ir.nodes.base.IRNode --> kirin.ir.nodes.stmt.Statement
                                kirin.print.printable.Printable --> kirin.ir.nodes.base.IRNode
                





              click kirin.dialects.py.cmp.stmts.LtE href "" "kirin.dialects.py.cmp.stmts.LtE"
              click kirin.dialects.py.cmp.stmts.Cmp href "" "kirin.dialects.py.cmp.stmts.Cmp"
              click kirin.ir.nodes.stmt.Statement href "" "kirin.ir.nodes.stmt.Statement"
              click kirin.ir.nodes.base.IRNode href "" "kirin.ir.nodes.base.IRNode"
              click kirin.print.printable.Printable href "" "kirin.print.printable.Printable"
            
Source code in src/kirin/ir/nodes/stmt.py
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
def __init__(
    self,
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None,
) -> None:
    super().__init__()
    """Initialize the Statement.

    Args:
        arsg (Sequence[SSAValue], optional): The arguments of the Statement. Defaults to ().
        regions (Sequence[Region], optional): The regions where the Statement belong to. Defaults to ().
        successors (Sequence[Block], optional): The successors of the Statement. Defaults to ().
        attributes (Mapping[str, Attribute], optional): The attributes of the Statement. Defaults to {}.
        results (Sequence[ResultValue], optional): The result values of the Statement. Defaults to ().
        result_types (Sequence[TypeAttribute], optional): The result types of the Statement. Defaults to ().
        args_slice (Mapping[str, int | slice], optional): The arguments slice of the Statement. Defaults to {}.
        source (SourceInfo | None, optional): The source information of the Statement for debugging/stacktracing. Defaults to None.

    """
    self._args = ()
    self._regions = []
    self._name_args_slice = dict(args_slice)
    self.source = source
    self.args = args

    if results:
        self._results = list(results)
        assert (
            len(result_types) == 0
        ), "expect either results or result_types specified, got both"

    if result_types:
        self._results = [
            ResultValue(self, idx, type=type)
            for idx, type in enumerate(result_types)
        ]

    if not results and not result_types:
        self._results = list(results)

    self.successors = list(successors)
    self.attributes = dict(attributes)
    self.regions = list(regions)

    self.parent = None
    self._next_stmt = None
    self._prev_stmt = None
    self.__post_init__()

name class-attribute instance-attribute

name = 'lte'

NotEq dataclass

NotEq(
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None
)

Bases: Cmp


              flowchart TD
              kirin.dialects.py.cmp.stmts.NotEq[NotEq]
              kirin.dialects.py.cmp.stmts.Cmp[Cmp]
              kirin.ir.nodes.stmt.Statement[Statement]
              kirin.ir.nodes.base.IRNode[IRNode]
              kirin.print.printable.Printable[Printable]

                              kirin.dialects.py.cmp.stmts.Cmp --> kirin.dialects.py.cmp.stmts.NotEq
                                kirin.ir.nodes.stmt.Statement --> kirin.dialects.py.cmp.stmts.Cmp
                                kirin.ir.nodes.base.IRNode --> kirin.ir.nodes.stmt.Statement
                                kirin.print.printable.Printable --> kirin.ir.nodes.base.IRNode
                





              click kirin.dialects.py.cmp.stmts.NotEq href "" "kirin.dialects.py.cmp.stmts.NotEq"
              click kirin.dialects.py.cmp.stmts.Cmp href "" "kirin.dialects.py.cmp.stmts.Cmp"
              click kirin.ir.nodes.stmt.Statement href "" "kirin.ir.nodes.stmt.Statement"
              click kirin.ir.nodes.base.IRNode href "" "kirin.ir.nodes.base.IRNode"
              click kirin.print.printable.Printable href "" "kirin.print.printable.Printable"
            
Source code in src/kirin/ir/nodes/stmt.py
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
def __init__(
    self,
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None,
) -> None:
    super().__init__()
    """Initialize the Statement.

    Args:
        arsg (Sequence[SSAValue], optional): The arguments of the Statement. Defaults to ().
        regions (Sequence[Region], optional): The regions where the Statement belong to. Defaults to ().
        successors (Sequence[Block], optional): The successors of the Statement. Defaults to ().
        attributes (Mapping[str, Attribute], optional): The attributes of the Statement. Defaults to {}.
        results (Sequence[ResultValue], optional): The result values of the Statement. Defaults to ().
        result_types (Sequence[TypeAttribute], optional): The result types of the Statement. Defaults to ().
        args_slice (Mapping[str, int | slice], optional): The arguments slice of the Statement. Defaults to {}.
        source (SourceInfo | None, optional): The source information of the Statement for debugging/stacktracing. Defaults to None.

    """
    self._args = ()
    self._regions = []
    self._name_args_slice = dict(args_slice)
    self.source = source
    self.args = args

    if results:
        self._results = list(results)
        assert (
            len(result_types) == 0
        ), "expect either results or result_types specified, got both"

    if result_types:
        self._results = [
            ResultValue(self, idx, type=type)
            for idx, type in enumerate(result_types)
        ]

    if not results and not result_types:
        self._results = list(results)

    self.successors = list(successors)
    self.attributes = dict(attributes)
    self.regions = list(regions)

    self.parent = None
    self._next_stmt = None
    self._prev_stmt = None
    self.__post_init__()

name class-attribute instance-attribute

name = 'ne'

NotIn dataclass

NotIn(
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None
)

Bases: Cmp


              flowchart TD
              kirin.dialects.py.cmp.stmts.NotIn[NotIn]
              kirin.dialects.py.cmp.stmts.Cmp[Cmp]
              kirin.ir.nodes.stmt.Statement[Statement]
              kirin.ir.nodes.base.IRNode[IRNode]
              kirin.print.printable.Printable[Printable]

                              kirin.dialects.py.cmp.stmts.Cmp --> kirin.dialects.py.cmp.stmts.NotIn
                                kirin.ir.nodes.stmt.Statement --> kirin.dialects.py.cmp.stmts.Cmp
                                kirin.ir.nodes.base.IRNode --> kirin.ir.nodes.stmt.Statement
                                kirin.print.printable.Printable --> kirin.ir.nodes.base.IRNode
                





              click kirin.dialects.py.cmp.stmts.NotIn href "" "kirin.dialects.py.cmp.stmts.NotIn"
              click kirin.dialects.py.cmp.stmts.Cmp href "" "kirin.dialects.py.cmp.stmts.Cmp"
              click kirin.ir.nodes.stmt.Statement href "" "kirin.ir.nodes.stmt.Statement"
              click kirin.ir.nodes.base.IRNode href "" "kirin.ir.nodes.base.IRNode"
              click kirin.print.printable.Printable href "" "kirin.print.printable.Printable"
            
Source code in src/kirin/ir/nodes/stmt.py
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
def __init__(
    self,
    *,
    args: Sequence[SSAValue] = (),
    regions: Sequence[Region] = (),
    successors: Sequence[Block] = (),
    attributes: Mapping[str, Attribute] = {},
    results: Sequence[ResultValue] = (),
    result_types: Sequence[TypeAttribute] = (),
    args_slice: Mapping[str, int | slice] = {},
    source: SourceInfo | None = None,
) -> None:
    super().__init__()
    """Initialize the Statement.

    Args:
        arsg (Sequence[SSAValue], optional): The arguments of the Statement. Defaults to ().
        regions (Sequence[Region], optional): The regions where the Statement belong to. Defaults to ().
        successors (Sequence[Block], optional): The successors of the Statement. Defaults to ().
        attributes (Mapping[str, Attribute], optional): The attributes of the Statement. Defaults to {}.
        results (Sequence[ResultValue], optional): The result values of the Statement. Defaults to ().
        result_types (Sequence[TypeAttribute], optional): The result types of the Statement. Defaults to ().
        args_slice (Mapping[str, int | slice], optional): The arguments slice of the Statement. Defaults to {}.
        source (SourceInfo | None, optional): The source information of the Statement for debugging/stacktracing. Defaults to None.

    """
    self._args = ()
    self._regions = []
    self._name_args_slice = dict(args_slice)
    self.source = source
    self.args = args

    if results:
        self._results = list(results)
        assert (
            len(result_types) == 0
        ), "expect either results or result_types specified, got both"

    if result_types:
        self._results = [
            ResultValue(self, idx, type=type)
            for idx, type in enumerate(result_types)
        ]

    if not results and not result_types:
        self._results = list(results)

    self.successors = list(successors)
    self.attributes = dict(attributes)
    self.regions = list(regions)

    self.parent = None
    self._next_stmt = None
    self._prev_stmt = None
    self.__post_init__()

name class-attribute instance-attribute

name = 'not_in'