Decorator used to mark function as a basic block.
def foo(a: int) -> int:
@block
def bb0(x: int):
y: int = x + 2
bb1(y)
@block
def bb1(z: int):
return z
# Entry-point.
bb0(a)
Source code in xdsl/frontend/pyast/utils/block.py
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 | def block(*params: Any):
"""
Decorator used to mark function as a basic block.
```
def foo(a: int) -> int:
@block
def bb0(x: int):
y: int = x + 2
bb1(y)
@block
def bb1(z: int):
return z
# Entry-point.
bb0(a)
```
"""
def decorate(*params: Any):
return None
return decorate
|