Skip to content

Commit

Permalink
BlockWalker: Handle Store.guard. (#261)
Browse files Browse the repository at this point in the history
  • Loading branch information
ltfish authored Nov 24, 2024
1 parent 227f9a9 commit 07344cd
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ailment/block_walker.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ def _handle_Call(self, stmt_idx: int, stmt: Call, block: Block | None):
def _handle_Store(self, stmt_idx: int, stmt: Store, block: Block | None):
self._handle_expr(0, stmt.addr, stmt_idx, stmt, block)
self._handle_expr(1, stmt.data, stmt_idx, stmt, block)
if stmt.guard is not None:
self._handle_expr(2, stmt.guard, stmt_idx, stmt, block)

def _handle_Jump(self, stmt_idx: int, stmt: Jump, block: Block | None):
self._handle_expr(0, stmt.target, stmt_idx, stmt, block)
Expand Down Expand Up @@ -349,6 +351,12 @@ def _handle_Store(self, stmt_idx: int, stmt: Store, block: Block | None):
else:
data = stmt.data

guard = None if stmt.guard is None else self._handle_expr(2, stmt.guard, stmt_idx, stmt, block)
if guard is not None and guard is not stmt.guard:
changed = True
else:
guard = stmt.guard

if changed:
# update the statement directly in the block
new_stmt = Store(
Expand All @@ -357,7 +365,7 @@ def _handle_Store(self, stmt_idx: int, stmt: Store, block: Block | None):
data,
stmt.size,
stmt.endness,
guard=stmt.guard,
guard=guard,
variable=stmt.variable,
offset=stmt.offset,
**stmt.tags,
Expand Down

0 comments on commit 07344cd

Please sign in to comment.