-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework serializer and lbmem implementations
- Loading branch information
Showing
13 changed files
with
130 additions
and
86 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from .types import Branch, BasicBlock, Yield | ||
|
||
|
||
def get_next_block(block, seen): | ||
if isinstance(block, Branch): | ||
return find_branch_join(block, seen) | ||
elif isinstance(block, (BasicBlock, Yield)): | ||
return block.outgoing_edge[0] | ||
raise NotImplementedError(block) | ||
|
||
|
||
def find_branch_join(branch, seen=[]): | ||
seen.append(branch) | ||
curr_true_block = branch.true_edge | ||
while curr_true_block not in seen: | ||
seen.append(curr_true_block) | ||
curr_true_block = get_next_block(curr_true_block, seen) | ||
curr_false_block = branch.false_edge | ||
while curr_false_block not in seen: | ||
curr_false_block = get_next_block(curr_false_block, seen) | ||
return curr_false_block | ||
# curr_false_block = branch.false_edge | ||
# curr_true_block = branch.true_edge | ||
# while curr_false_block != curr_true_block: | ||
# seen.add(curr_false_block) | ||
# seen.add(curr_true_block) | ||
# next_true_block = get_next_block(curr_true_block, seen) | ||
# if next_true_block == curr_false_block: | ||
# break | ||
# next_false_block = get_next_block(curr_false_block, seen) | ||
# if next_false_block == curr_true_block: | ||
# break | ||
# curr_true_block, curr_false_block = next_true_block, next_false_block | ||
# return curr_false_block |
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
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
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
File renamed without changes.
File renamed without changes.
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
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
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
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