|
decompiler
1.0.0
|
A class for ordering Varnode terms in an additive expression. More...
#include <coreaction.hh>
Public Member Functions | |
| TermOrder (PcodeOp *rt) | |
| Construct given root PcodeOp. | |
| int4 | getSize (void) const |
| Get the number of terms in the expression. | |
| void | collect (void) |
| Collect all the terms in the expression. More... | |
| void | sortTerms (void) |
| Sort the terms using additiveCompare() | |
| const vector< PcodeOpEdge * > & | getSort (void) |
| Get the sorted list of references. | |
Static Private Member Functions | |
| static bool | additiveCompare (const PcodeOpEdge *op1, const PcodeOpEdge *op2) |
| A comparison operator for ordering terms in a sum. More... | |
Private Attributes | |
| PcodeOp * | root |
| The final PcodeOp in the expression. | |
| vector< PcodeOpEdge > | terms |
| Collected terms. | |
| vector< PcodeOpEdge * > | sorter |
| An array of references to terms for quick sorting. | |
A class for ordering Varnode terms in an additive expression.
Given the final PcodeOp in a data-flow expression that sums 2 or more Varnode terms, this class collects all the terms then allows sorting of the terms to facilitate constant collapse and factoring simplifications.
|
inlinestaticprivate |
A comparison operator for ordering terms in a sum.
This is based on Varnode::termOrder which groups constants terms and ignores multiplicative coefficients.
| op1 | is the first term to compare |
| op2 | is the second term |
References PcodeOpEdge::getVarnode(), and Varnode::termOrder().
| void TermOrder::collect | ( | void | ) |
Collect all the terms in the expression.
Assuming root->getOut() is the root of an expression formed with the CPUI_INT_ADD op, collect all the Varnode terms of the expression.
References PcodeOp::code(), CPUI_INT_ADD, CPUI_INT_MULT, Varnode::getDef(), PcodeOp::getIn(), PcodeOp::getOut(), Varnode::isConstant(), Varnode::isWritten(), Varnode::loneDescend(), and PcodeOp::numInput().
Referenced by RuleCollectTerms::applyOp().
1.8.11