Skip to content

Target

target

Target dataclass

Bases: ArgSpecConvertible

A Target is a named output backend that serializes a ModuleOp to a stream.

Targets can accept arguments following the same name{arg=val ...} syntax used by passes. Subclasses must be decorated with @dataclass(frozen=True) and provide a name class variable.

Source code in xdsl/utils/target.py
12
13
14
15
16
17
18
19
20
21
22
23
24
25
@dataclass(frozen=True)
class Target(ArgSpecConvertible):
    """
    A Target is a named output backend that serializes a ModuleOp to a stream.

    Targets can accept arguments following the same ``name{arg=val ...}`` syntax
    used by passes.  Subclasses must be decorated with
    ``@dataclass(frozen=True)`` and provide a ``name`` class variable.
    """

    name: ClassVar[str]

    @abstractmethod
    def emit(self, ctx: Context, module: ModuleOp, output: IO[str]) -> None: ...

name: str class-attribute

__init__() -> None

emit(ctx: Context, module: ModuleOp, output: IO[str]) -> None abstractmethod

Source code in xdsl/utils/target.py
24
25
@abstractmethod
def emit(self, ctx: Context, module: ModuleOp, output: IO[str]) -> None: ...