Frame
Frame dataclass
Frame(
state: State,
stream: StmtStream[Stmt],
curr_region: Region,
entr_block: Block,
curr_block: Block,
next_block: Block,
defs: dict[str, SSAValue] = dict(),
globals: dict[str, Any] = dict(),
captures: dict[str, SSAValue] = dict(),
capture_callback: Optional[CallbackFn] = None,
)
Bases: Generic[Stmt]
capture_callback class-attribute
instance-attribute
capture_callback: Optional[CallbackFn] = None
callback function that creates a local SSAValue value when an captured value was used.
captures class-attribute
instance-attribute
captures: dict[str, SSAValue] = field(default_factory=dict)
values accessed from the parent frame
curr_block instance-attribute
curr_block: Block
current block being lowered
curr_region instance-attribute
curr_region: Region
the region this frame is generating
defs class-attribute
instance-attribute
defs: dict[str, SSAValue] = field(default_factory=dict)
values defined in the current frame
entr_block instance-attribute
entr_block: Block
entry block of the frame region
globals class-attribute
instance-attribute
globals: dict[str, Any] = field(default_factory=dict)
global values known to the current frame
next_block instance-attribute
next_block: Block
next block to be lowered, but not yet inserted in the region
parent class-attribute
instance-attribute
parent: Optional[Frame] = field(default=None, init=False)
parent frame, if any
state instance-attribute
state: State
lowering state
stream instance-attribute
stream: StmtStream[Stmt]
stream of statements
__getitem__
__getitem__(name: str) -> SSAValue
Get a variable from current scope.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name(str) | variable name | required |
Returns:
Name | Type | Description |
---|---|---|
SSAValue | SSAValue | the value of the variable |
Raises:
Type | Description |
---|---|
BuildError | if the variable is not found in the scope, or if the variable has multiple possible values. |
Source code in src/kirin/lowering/frame.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
|
exhaust
exhaust()
Exhaust the current stream and return the remaining statements.
Source code in src/kirin/lowering/frame.py
146 147 148 149 150 151 |
|
jump_next_block
jump_next_block()
Jump to the next block and return it. This appends the current Frame.next_block
to the current region and creates a new Block for next_block
.
Returns:
Name | Type | Description |
---|---|---|
Block | the next block |
Source code in src/kirin/lowering/frame.py
87 88 89 90 91 92 93 94 95 96 97 |
|