Closed GH0st3rs closed 6 years ago
Thank you for your comment.
Yes that could be a temporary solution, but the second proposal is a bit more complicated ;). There is a special process to manage conditional instructions: it tries to fuse with a previous instruction. But it's actually done only for x86[_64] and a bit for ARM.
The process function should be implemented in lib/arch/*/process_ast.py
. You can take a look on x86 there is a function fuse_inst_with_if
which is called just after the ast generation (lib/generate_ast.py
). During the output the lib.ast.Ast_Ifelse
call the appropriate function _if_cond
in lib/arch*/output.py
.
Moreover, it's not a good idea to write directly self._add(" < ")
because you can't know in advance which branch will be taken for the if and the else. You have to use the function cond_symbol
defined in lib/arch/*/utils.py
and called by _if_cond
. And recently I've added a patch which allows the user to invert the condition in the visual mode (the condition symbol is then automatically inverted).
The simplification of certain instructions in the function _sub_asm_inst
is only for non-conditional instructions.
If I've time I will try to do it.
Yes, you are right. But my solution - just wrapper for SLT* instructions.
I will send you PULL-request with fix _if_cond
and other functions for mips
dc2f552
Result:
But ideally, it's better to do so:
or