|
decompiler 1.0.0
|
Information about the INT_ADD op-code. More...
#include <typeop.hh>
Public Member Functions | |
| TypeOpIntAdd (TypeFactory *t) | |
| Constructor. | |
| virtual void | push (PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const |
| Push the specific PcodeOp to the emitter's RPN stack. More... | |
| virtual Datatype * | getOutputToken (const PcodeOp *op, CastStrategy *castStrategy) const |
| Find the data-type of the output that would be assigned by a compiler. More... | |
| virtual Datatype * | propagateType (Datatype *alttype, PcodeOp *op, Varnode *invn, Varnode *outvn, int4 inslot, int4 outslot) |
| Propagate an incoming data-type across a specific PcodeOp. More... | |
Public Member Functions inherited from TypeOpBinary | |
| TypeOpBinary (TypeFactory *t, OpCode opc, const string &n, type_metatype mout, type_metatype min) | |
| Constructor. | |
| virtual Datatype * | getOutputLocal (const PcodeOp *op) const |
| Find the minimal (or suggested) data-type of an output to this op-code. More... | |
| virtual Datatype * | getInputLocal (const PcodeOp *op, int4 slot) const |
| Find the minimal (or suggested) data-type of an input to this op-code. More... | |
| virtual void | printRaw (ostream &s, const PcodeOp *op) |
| Print (for debugging purposes) this specific PcodeOp to the stream. More... | |
Public Member Functions inherited from TypeOp | |
| TypeOp (TypeFactory *t, OpCode opc, const string &n) | |
| Constructor. More... | |
| virtual | ~TypeOp (void) |
| Destructor. | |
| const string & | getName (void) const |
| Get the display name of the op-code. | |
| OpCode | getOpcode (void) const |
| Get the op-code value. | |
| uint4 | getFlags (void) const |
| Get the properties associated with the op-code. | |
| OpBehavior * | getBehavior (void) const |
| Get the behavior associated with the op-code. | |
| uintb | evaluateUnary (int4 sizeout, int4 sizein, uintb in1) const |
| Emulate the unary op-code on an input value. More... | |
| uintb | evaluateBinary (int4 sizeout, int4 sizein, uintb in1, uintb in2) const |
| Emulate the binary op-code on an input value. More... | |
| uintb | recoverInputBinary (int4 slot, int4 sizeout, uintb out, int4 sizein, uintb in) const |
| Reverse the binary op-code operation, recovering a constant input value. More... | |
| uintb | recoverInputUnary (int4 sizeout, uintb out, int4 sizein) const |
| Reverse the unary op-code operation, recovering a constant input value. More... | |
| bool | isCommutative (void) const |
| Return true if this op-code is commutative. More... | |
| bool | inheritsSign (void) const |
| Return true if the op-code inherits its signedness from its inputs. | |
| bool | inheritsSignFirstParamOnly (void) const |
| Return true if the op-code inherits its signedness from only its first input. | |
| bool | isShiftOp (void) const |
| Return true if the op-code is a shift (INT_LEFT, INT_RIGHT, or INT_SRIGHT) | |
| virtual Datatype * | getOutputLocal (const PcodeOp *op) const |
| Find the minimal (or suggested) data-type of an output to this op-code. More... | |
| virtual Datatype * | getInputLocal (const PcodeOp *op, int4 slot) const |
| Find the minimal (or suggested) data-type of an input to this op-code. More... | |
| virtual Datatype * | getOutputToken (const PcodeOp *op, CastStrategy *castStrategy) const |
| Find the data-type of the output that would be assigned by a compiler. More... | |
| virtual Datatype * | getInputCast (const PcodeOp *op, int4 slot, const CastStrategy *castStrategy) const |
| Find the data-type of the input to a specific PcodeOp. More... | |
| virtual Datatype * | propagateType (Datatype *alttype, PcodeOp *op, Varnode *invn, Varnode *outvn, int4 inslot, int4 outslot) |
| Propagate an incoming data-type across a specific PcodeOp. More... | |
| virtual void | push (PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const =0 |
| Push the specific PcodeOp to the emitter's RPN stack. More... | |
| virtual void | printRaw (ostream &s, const PcodeOp *op)=0 |
| Print (for debugging purposes) this specific PcodeOp to the stream. More... | |
| virtual string | getOperatorName (const PcodeOp *op) const |
| Get the name of the op-code as it should be displayed in context. More... | |
Static Public Member Functions | |
| static Datatype * | propagateAddIn2Out (Datatype *alttype, TypeFactory *typegrp, PcodeOp *op, int4 inslot) |
| Propagate a pointer data-type through an ADD operation. More... | |
| static int4 | propagateAddPointer (uintb &off, PcodeOp *op, int4 slot, int4 sz) |
Static Public Member Functions inherited from TypeOp | |
| static void | registerInstructions (vector< TypeOp * > &inst, TypeFactory *tlst, const Translate *trans) |
| Build a map from op-code value to the TypeOp information objects. More... | |
| static void | selectJavaOperators (vector< TypeOp * > &inst, bool val) |
| Toggle Java specific aspects of the op-code information. More... | |
Additional Inherited Members | |
Public Types inherited from TypeOp | |
| enum | { inherits_sign = 1 , inherits_sign_zero = 2 , shift_op = 4 } |
Protected Member Functions inherited from TypeOp | |
| virtual void | setMetatypeIn (type_metatype val) |
| Set the data-type associated with inputs to this opcode. More... | |
| virtual void | setMetatypeOut (type_metatype val) |
| Set the data-type associated with outputs of this opcode. More... | |
| virtual void | setSymbol (const string &nm) |
| Set the display symbol associated with the op-code. | |
Protected Attributes inherited from TypeOp | |
| TypeFactory * | tlst |
| Pointer to data-type factory. | |
| OpCode | opcode |
| The op-code value. | |
| uint4 | opflags |
| Cached pcode-op properties for this op-code. | |
| uint4 | addlflags |
| Additional properties. | |
| string | name |
| Symbol denoting this operation. | |
| OpBehavior * | behave |
| Object for emulating the behavior of the op-code. | |
Information about the INT_ADD op-code.
|
virtual |
Find the data-type of the output that would be assigned by a compiler.
Calculate the actual data-type of the output for a specific PcodeOp as would be assigned by a C compiler parsing a grammar containing this op.
| op | is the specific PcodeOp |
| castStrategy | is the current casting strategy |
Reimplemented from TypeOp.
References CastStrategy::arithmeticOutputStandard().
|
static |
Propagate a pointer data-type through an ADD operation.
Assuming a pointer data-type from an ADD PcodeOp propagates from an input to its output, calculate the transformed data-type of the output Varnode, which will depend on details of the operation. If the edge doesn't make sense as "an ADD to a pointer", prevent the propagation by returning the output Varnode's current data-type.
| alttype | is the resolved input pointer data-type |
| typegrp | is the TypeFactory for constructing the transformed Datatype |
| op | is the ADD operation |
| inslot | is the edge to propagate along |
References AddrSpace::addressToByte(), PcodeOp::code(), CPUI_PTRSUB, TypePointer::downChain(), TypeFactory::getBase(), PcodeOp::getIn(), Datatype::getMetatype(), PcodeOp::getOut(), TypePointer::getPtrTo(), Datatype::getSize(), Varnode::getTempType(), TypeFactory::getTypePointer(), TypeFactory::getTypePointerRel(), TypePointer::getWordSize(), Varnode::isSpacebase(), propagateAddPointer(), TYPE_SPACEBASE, and TYPE_UNKNOWN.
Referenced by propagateType(), TypeOpPtradd::propagateType(), and TypeOpPtrsub::propagateType().
|
static |
Determine if the given data-type edge looks like a pointer propagating through an "add a constant" operation. We assume the input to the edge has a pointer data-type. This routine returns one the commands:
| off | passes back the constant offset if the command is '0' or '1' |
| op | is the PcodeOp propagating the data-type |
| slot | is the input edge being propagated |
| sz | is the size of the data-type being pointed to |
References calc_mask(), PcodeOp::code(), CPUI_INT_ADD, CPUI_INT_MULT, CPUI_PTRADD, CPUI_PTRSUB, Varnode::getDef(), PcodeOp::getIn(), Datatype::getMetatype(), Varnode::getOffset(), Varnode::getSize(), Varnode::getTempType(), Varnode::isConstant(), Varnode::isWritten(), and TYPE_PTR.
Referenced by propagateAddIn2Out().
|
virtual |
Propagate an incoming data-type across a specific PcodeOp.
The data-type can propagate between any two Varnodes attached to the PcodeOp, either in or out. The pair invn and inslot indicate the Varnode holding the incoming data-type. The pair outvn and outslot indicate the Varnode that will hold the outgoing data-type. The data-type for the outgoing Varnode is returned, which may be different then the incoming data-type as the PcodeOp can transform the data-type as it propagates.
| alttype | is the incoming data-type |
| op | is the PcodeOp to propagate across |
| invn | is the Varnode holding the incoming data-type |
| outvn | is the Varnode that will hold the outgoing data-type |
| inslot | indicates how the incoming Varnode is attached to the PcodeOp (-1 indicates output >= indicates input) |
| outslot | indicates how the outgoing Varnode is attached to the PcodeOp |
Reimplemented from TypeOp.
References PcodeOp::getIn(), Datatype::getMetatype(), Varnode::getTempType(), Varnode::isConstant(), propagateAddIn2Out(), TypeOp::tlst, TYPE_INT, TYPE_PTR, and TYPE_UINT.
|
inlinevirtual |
Push the specific PcodeOp to the emitter's RPN stack.
Given a specific language and PcodeOp, emit the expression rooted at the operation.
| lng | is the PrintLanguage to emit |
| op | is the specific PcodeOp |
| readOp | is the PcodeOp consuming the output (or null) |
Implements TypeOp.
References PrintLanguage::opIntAdd().