|
decompiler 1.0.0
|
A helper class for describing the similarity of the boolean condition between 2 CBRANCH operations. More...
#include <condexe.hh>
Public Member Functions | |
| bool | verifyCondition (PcodeOp *op, PcodeOp *iop) |
| Perform the correlation test on two CBRANCH operations. | |
| int4 | getMultiSlot (void) const |
| Get the MULTIEQUAL slot in the critical path. | |
| bool | getFlip (void) const |
| Return true if the expressions are anti-correlated. | |
Private Types | |
| enum | { same = 1 , complementary = 2 , uncorrelated = 3 } |
Static Private Member Functions | |
| static bool | sameOpComplement (PcodeOp *bin1op, PcodeOp *bin2op) |
| Test if two operations with same opcode produce complementary boolean values. More... | |
| static bool | varnodeSame (Varnode *a, Varnode *b) |
| Do the given Varnodes hold the same value, possibly as constants. More... | |
| static int4 | evaluate (Varnode *vn1, Varnode *vn2, int4 depth) |
| Determine if two boolean Varnodes hold related values. More... | |
Private Attributes | |
| bool | matchflip |
| True if the compared CBRANCH keys on the opposite boolean value of the root. | |
Static Private Attributes | |
| static const int4 | maxDepth = 1 |
| Maximum depth to trace a boolean expression. | |
A helper class for describing the similarity of the boolean condition between 2 CBRANCH operations.
This class determines if two CBRANCHs share the same condition. It also determines if the conditions are complements of each other, and/or they are shared along only one path.
Traverse (upto a specific depth) the two boolean expressions consisting of BOOL_AND, BOOL_OR, and BOOL_XOR operations. Leaf operators in the expression can be other operators with boolean output (INT_LESS, INT_SLESS, etc.).
|
private |
|
staticprivate |
Determine if two boolean Varnodes hold related values.
The values may be the same, or opposite of each other (complementary). Otherwise the values are uncorrelated. The trees constructing each Varnode are examined up to a maximum depth. If this is exceeded uncorrelated is returned.
| vn1 | is the first boolean Varnode |
| vn2 | is the second boolean Varnode |
| depth | is the maximum depth to traverse in the evaluation |
References ghidra::PcodeOp::code(), complementary, ghidra::CPUI_BOOL_AND, ghidra::CPUI_BOOL_NEGATE, ghidra::CPUI_BOOL_OR, ghidra::CPUI_BOOL_XOR, ghidra::CPUI_MAX, evaluate(), ghidra::Varnode::getDef(), ghidra::PcodeOp::getIn(), ghidra::PcodeOp::isBoolOutput(), ghidra::Varnode::isWritten(), same, sameOpComplement(), uncorrelated, and varnodeSame().
Referenced by evaluate(), and verifyCondition().
|
staticprivate |
Test if two operations with same opcode produce complementary boolean values.
This only tests for cases where the opcode is INT_LESS or INT_SLESS and one of the inputs is constant.
| bin1op | is the first p-code op to compare |
| bin2op | is the second p-code op to compare |
References ghidra::PcodeOp::code(), ghidra::CPUI_INT_LESS, ghidra::CPUI_INT_SLESS, ghidra::PcodeOp::getIn(), ghidra::Varnode::getOffset(), ghidra::Varnode::getSize(), ghidra::Varnode::isConstant(), and varnodeSame().
Referenced by evaluate().
Do the given Varnodes hold the same value, possibly as constants.
References ghidra::Varnode::getOffset(), and ghidra::Varnode::isConstant().
Referenced by evaluate(), and sameOpComplement().