Skip to content

Commit

Permalink
Add eq cond simplification select(memory, ADDR) => read1(ADDR)
Browse files Browse the repository at this point in the history
  • Loading branch information
jim-carciofini committed May 10, 2024
1 parent 67c95cc commit 8a6fcdf
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pate_binja/pate.py
Original file line number Diff line number Diff line change
Expand Up @@ -1363,6 +1363,10 @@ def simplify_sexp(sexp, env=None):
if op == 'select' and len(arg) == 2 and arg[0] == 'InitMemBytes' and arg[1] == 0:
return 'memory'

# Simplify select(memory, ADDR) => read1(ADDR)
if op == 'select' and len(arg) == 2 and arg[0] == 'memory':
return ['read1', arg[1]]

# Simplify read{LE|GE}N(memory, ADDR) -> read{LE|GE}N(ADDR)
if re.fullmatch(r'read(?:LE|GE)\d+', op) and len(arg) == 2 and arg[0] == 'memory':
return [op, arg[1]]
Expand Down

0 comments on commit 8a6fcdf

Please sign in to comment.