-
-
Save sklam/f43f7c4eb574a79eaca9d5b4d27ef6ba to your computer and use it in GitHub Desktop.
issue_find_headers_and_entries
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from numba_rvsdg.core.datastructures.byte_flow import ByteFlow | |
from numba_rvsdg.rendering.rendering import ByteFlowRenderer | |
def while_count(s, e): | |
i = s | |
c = 0 | |
while i < e: | |
c += i | |
i += 1 | |
return c | |
code = while_count.__code__ | |
byteflow = ByteFlow.from_bytecode(code) | |
bcmap = byteflow.scfg.bcmap_from_bytecode(byteflow.bc) | |
byteflow = byteflow.restructure() | |
# render | |
bfr = ByteFlowRenderer() | |
bfr.bcmap_from_bytecode(byteflow.bc) | |
bfr.render_scfg(byteflow.scfg).view("scfg") | |
scfg = byteflow.scfg | |
the_branch = scfg.graph["python_bytecode_block_1"] | |
the_loop = the_branch.subregion["python_bytecode_block_1"] | |
the_pybc_block = the_loop.subregion["python_bytecode_block_1"] | |
headers, entries = the_loop.subregion.find_headers_and_entries(the_loop.subregion) | |
print("entries?", entries) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment