Skip to content

Callable

CallableStmtInterface dataclass

CallableStmtInterface()

Bases: StmtTrait, ABC, Generic[StmtType]

A trait that indicates that a statement is a callable statement.

A callable statement is a statement that can be called as a function.

align_input_args abstractmethod classmethod

align_input_args(
    stmt: "StmtType", *args: ValueType, **kwargs: ValueType
) -> tuple[ValueType, ...]

Permute the arguments and keyword arguments of the statement to match the execution order of the callable region input.

Source code in src/kirin/ir/traits/callable.py
31
32
33
34
35
36
37
38
39
@classmethod
@abstractmethod
def align_input_args(
    cls, stmt: "StmtType", *args: ValueType, **kwargs: ValueType
) -> tuple[ValueType, ...]:
    """Permute the arguments and keyword arguments of the statement
    to match the execution order of the callable region input.
    """
    ...

get_callable_region abstractmethod classmethod

get_callable_region(stmt: StmtType) -> 'Region'

Returns the body of the callable region

Source code in src/kirin/ir/traits/callable.py
23
24
25
26
27
@classmethod
@abstractmethod
def get_callable_region(cls, stmt: StmtType) -> "Region":
    """Returns the body of the callable region"""
    ...

HasSignature dataclass

HasSignature()

Bases: StmtTrait, ABC

A trait that indicates that a statement has a function signature attribute.