Skip to content

Commit

Permalink
Eq cond simplification for readXXD(memory, A) => readXXD(A)
Browse files Browse the repository at this point in the history
  • Loading branch information
jim-carciofini committed May 9, 2024
1 parent df1ba9c commit 0aa9e37
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pate_binja/pate.py
Original file line number Diff line number Diff line change
Expand Up @@ -1356,15 +1356,15 @@ def simplify_sexp(sexp, env=None):

# Simplify call(F, args...) => F(args...)
if op == 'call' and len(arg) >= 1:
return [arg[0]] + arg[1:]
return simplify_sexp([arg[0]] + arg[1:], env)

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

# Simplify read(memory, ADDR) -> read(ADDR)
if op == 'read' and len(arg) == 2 and arg[0] == 'memory':
return ['read' + 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]]

# Simplify multiply by 1
if op == 'bvmul' and len(arg) == 2:
Expand Down

0 comments on commit 0aa9e37

Please sign in to comment.