-
Notifications
You must be signed in to change notification settings - Fork 474
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplification passes for ExprAssign #1004
Comments
Hello, Hum, for now, I would rather explictely call the simplifier in your script, instead of modifying |
Hi! I could do this, but in this case I think I would also have to modify/recreate all Assign/IR blocks in I am currently looking for a clean solution since I'm planning to introduce a new PR that requires performing simplifications of |
Ok. Just some remarks: But it may trigger some new behavior:
@32[EAX] = @32[EAX] + 1 and let say we have concluded in a previous analysis that @32[EAX] = 0x1337BEEF + 1 and not: 0x1337BEEF = 0x1337BEEF + 1 So the conclusion maybe that we may have to
For me I think we have to take this problem into account and maybe the second solution is the good for. Today, we are using What do you think about this? |
Hi! I think both approaches have advantges and disadvantages. On the short term, introducing Lets take for instance the following: ira_cfg.simplify_lhs(expr_simp_lhs)
ira_cfg.simplify_rhs(expr_simp_rhs) Lets assume def simplify_lhs(self, simplifier):
"""
Return a new AssignBlock with expression simplified
@simplifier: ExpressionSimplifier instance
"""
new_assignblk = {}
for dst, src in viewitems(self):
new_dst = simplifier(dst)
new_assignblk[new_dst] = src
return AssignBlock(irs=new_assignblk, instr=self.instr) In these cases, we iterate all IR instructions and generate all |
Hi @mrphrazer , In fact I was not talking about simplification rules, but about the replace_expr(left_tokens_replacement, right_tokens_replacement) In this function we could manage left and right simultaneously, which will involve only one creation of basic block. But I am curious about a thing: have you got some reduction rules example which may by applied on the right side of an expression and which should not be applied to the right one ? (ok, let say the replacement is a case appart) |
Hi! Perhaps it is better to submit the PR first and discuss the details afterwards . Otherwise it might (or will) not make any sense to you. Give me a few days, then I will take up the discussion here again. |
This was quicker than intended: See PR #1021 for more details. The simplification pass for # ebx = @32[eax]
ebx = mem_read(M, eax, 32)
# @32[eax] = ebx
M = mem_write(M, eax, ebx, 32) Do you have any suggestions how we could this implement in a clean manner? |
Hi!
I'm preparing a PR. For this, I have to apply simplification rules for
ExprAssign
which has to perform different transformation forsrc
anddst
.Since
simplify
fromAssignBlock
applies the same operation tosrc
anddst
:I patched it as follows:
Obviously, this is not how it should be done. What do you think would be a good way to apply this?
The text was updated successfully, but these errors were encountered: