Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions numba_rvsdg/core/datastructures/ast_transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -770,12 +770,12 @@ def codegen_view() -> list[Any]:
# update __scfg_loop_continue__.
rval = [
ast.Assign(
[ast.Name("__scfg_loop_cont__")],
[ast.Name("__scfg_loop_cont__", ctx=ast.Store())],
ast.Constant(True),
lineno=0,
),
ast.While(
test=ast.Name("__scfg_loop_cont__"),
test=ast.Name("__scfg_loop_cont__", ctx=ast.Load()),
body=codegen_view(),
orelse=[],
),
Expand All @@ -788,7 +788,9 @@ def codegen_view() -> list[Any]:
# Synthetic assignments just create Python assignments, one for
# each variable..
return [
ast.Assign([ast.Name(t)], ast.Constant(v), lineno=0)
ast.Assign(
[ast.Name(t, ctx=ast.Store())], ast.Constant(v), lineno=0
)
for t, v in block.variable_assignment.items()
]
elif type(block) is SyntheticTail:
Expand All @@ -801,16 +803,20 @@ def codegen_view() -> list[Any]:
elif type(block) is SyntheticReturn:
# Synthetic return blocks must re-assigne the return value to a
# special reserved variable.
return [ast.Return(ast.Name("__scfg_return_value__"))]
return [
ast.Return(ast.Name("__scfg_return_value__", ctx=ast.Load()))
]
elif type(block) is SyntheticExitingLatch:
# The synthetic exiting latch simply assigns the negated value of
# the exit variable to '__scfg_loop_cont__'.
assert len(block.jump_targets) == 1
assert len(block.backedges) == 1
return [
ast.Assign(
[ast.Name("__scfg_loop_cont__")],
ast.UnaryOp(ast.Not(), ast.Name(block.variable)),
[ast.Name("__scfg_loop_cont__", ctx=ast.Store())],
ast.UnaryOp(
ast.Not(), ast.Name(block.variable, ctx=ast.Load())
),
lineno=0,
)
]
Expand Down Expand Up @@ -844,7 +850,7 @@ def if_cascade(
# compare to all variable values that point to this
# jump_target
if_test = ast.Compare(
left=ast.Name(block.variable),
left=ast.Name(block.variable, ctx=ast.Load()),
ops=[ast.In()],
comparators=[
ast.Tuple(
Expand Down