Program
program
P = ParamSpec('P')
module-attribute
R = TypeVar('R')
module-attribute
PyASTProgram
dataclass
Wrapper to associate an IR representation with a Python function.
Source code in xdsl/frontend/pyast/program.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | |
name: Final[str]
instance-attribute
The name of the function describing the program.
func: Final[Callable[P, R]]
instance-attribute
A callable object for the function describing the program.
module: ModuleOp
property
Lazily build the module when required, once.
__init__(name: Final[str], func: Final[Callable[P, R]], _builder: Final[PyASTBuilder], _module: ModuleOp | None = None) -> None
__call__(*args: P.args, **kwargs: P.kwargs) -> R
Pass through calling the object to its Python implementation.
Source code in xdsl/frontend/pyast/program.py
50 51 52 | |
FrontendProgram
dataclass
Class to store the Python AST of a program written in the frontend. This program can be compiled and translated to xDSL or MLIR.
Source code in xdsl/frontend/pyast/program.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | |
stmts: list[ast.stmt] | None = field(default=None)
class-attribute
instance-attribute
Input AST nodes.
functions_and_blocks: FunctionMap | None = field(default=None)
class-attribute
instance-attribute
Processed AST nodes stored for code generation.
globals: dict[str, Any] | None = field(default=None)
class-attribute
instance-attribute
Global information for this program, including all the imports.
xdsl_program: ModuleOp | None = field(default=None)
class-attribute
instance-attribute
Generated xDSL program when AST is compiled.
type_registry: TypeRegistry = field(default_factory=TypeRegistry)
class-attribute
instance-attribute
Mappings between source code and IR type.
function_registry: FunctionRegistry = field(default_factory=FunctionRegistry)
class-attribute
instance-attribute
Mappings between functions and their operation types.
file: str | None = field(default=None)
class-attribute
instance-attribute
Path to the file that contains the program.
__init__(stmts: list[ast.stmt] | None = None, functions_and_blocks: FunctionMap | None = None, globals: dict[str, Any] | None = None, xdsl_program: ModuleOp | None = None, type_registry: TypeRegistry = TypeRegistry(), function_registry: FunctionRegistry = FunctionRegistry(), file: str | None = None) -> None
register_type(source_type: type, ir_type: TypeAttribute) -> None
Associate a type in the source code with its type in the IR.
Source code in xdsl/frontend/pyast/program.py
83 84 85 86 87 88 89 | |
register_function(function: Callable[..., Any], ir_constructor: Callable[..., Operation]) -> None
Associate a method on an object in the source code with its IR implementation.
Source code in xdsl/frontend/pyast/program.py
91 92 93 94 95 | |
compile(desymref: bool = True) -> None
Generates xDSL from the source program.
Source code in xdsl/frontend/pyast/program.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | |
desymref() -> None
Desymrefy the generated xDSL.
Source code in xdsl/frontend/pyast/program.py
131 132 133 134 135 | |
textual_format() -> str
Source code in xdsl/frontend/pyast/program.py
147 148 149 150 151 152 153 154 | |