mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 19:42:36 +02:00
Added ternary flag to PcodeOp
This commit is contained in:
parent
a4e360a3e5
commit
eccf8e8595
3 changed files with 32 additions and 32 deletions
|
@ -84,7 +84,7 @@ public:
|
|||
unary = 0x8000, ///< Evaluate as unary expression
|
||||
binary = 0x10000, ///< Evaluate as binary expression
|
||||
special = 0x20000, ///< Cannot be evaluated (without special processing)
|
||||
floatingpoint = 0x40000, ///< A floating point operation
|
||||
ternary = 0x40000, ///< Evaluate as ternary operator (or higher)
|
||||
splittingbranch = 0x80000, ///< Dead edge cannot be removed as it splits
|
||||
nonprinting = 0x100000, ///< Op should not be directly printed as source
|
||||
halt = 0x200000, ///< instruction causes processor or process to halt
|
||||
|
@ -158,7 +158,7 @@ public:
|
|||
int4 getSlot(const Varnode *vn) const { int4 i,n; n=inrefs.size(); for(i=0;i<n;++i) if (inrefs[i]==vn) break; return i; }
|
||||
int4 getRepeatSlot(const Varnode *vn,int4 firstSlot,list<PcodeOp *>::const_iterator iter) const;
|
||||
/// \brief Get the evaluation type of this op
|
||||
uint4 getEvalType(void) const { return (flags&(PcodeOp::unary|PcodeOp::binary|PcodeOp::special)); }
|
||||
uint4 getEvalType(void) const { return (flags&(PcodeOp::unary|PcodeOp::binary|PcodeOp::special|PcodeOp::ternary)); }
|
||||
/// \brief Get type which indicates unusual halt in control-flow
|
||||
uint4 getHaltType(void) const { return (flags&(PcodeOp::halt|PcodeOp::badinstruction|PcodeOp::unimplemented|
|
||||
PcodeOp::noreturn|PcodeOp::missing)); }
|
||||
|
|
|
@ -73,8 +73,8 @@ void OpBehavior::registerInstructions(vector<OpBehavior *> &inst,const Translate
|
|||
inst[CPUI_BOOL_OR] = new OpBehaviorBoolOr();
|
||||
|
||||
inst[CPUI_CAST] = new OpBehavior(CPUI_CAST,false,true);
|
||||
inst[CPUI_PTRADD] = new OpBehavior(CPUI_PTRADD,false,true);
|
||||
inst[CPUI_PTRSUB] = new OpBehavior(CPUI_PTRSUB,false,true);
|
||||
inst[CPUI_PTRADD] = new OpBehavior(CPUI_PTRADD,false);
|
||||
inst[CPUI_PTRSUB] = new OpBehavior(CPUI_PTRSUB,false);
|
||||
|
||||
inst[CPUI_FLOAT_EQUAL] = new OpBehaviorFloatEqual(trans);
|
||||
inst[CPUI_FLOAT_NOTEQUAL] = new OpBehaviorFloatNotEqual(trans);
|
||||
|
@ -99,8 +99,8 @@ void OpBehavior::registerInstructions(vector<OpBehavior *> &inst,const Translate
|
|||
inst[CPUI_SEGMENTOP] = new OpBehavior(CPUI_SEGMENTOP,false,true);
|
||||
inst[CPUI_CPOOLREF] = new OpBehavior(CPUI_CPOOLREF,false,true);
|
||||
inst[CPUI_NEW] = new OpBehavior(CPUI_NEW,false,true);
|
||||
inst[CPUI_INSERT] = new OpBehavior(CPUI_INSERT,false,true);
|
||||
inst[CPUI_EXTRACT] = new OpBehavior(CPUI_EXTRACT,false,true);
|
||||
inst[CPUI_INSERT] = new OpBehavior(CPUI_INSERT,false);
|
||||
inst[CPUI_EXTRACT] = new OpBehavior(CPUI_EXTRACT,false);
|
||||
inst[CPUI_POPCOUNT] = new OpBehaviorPopcount();
|
||||
}
|
||||
|
||||
|
|
|
@ -1356,126 +1356,126 @@ TypeOpBoolOr::TypeOpBoolOr(TypeFactory *t)
|
|||
TypeOpFloatEqual::TypeOpFloatEqual(TypeFactory *t,const Translate *trans)
|
||||
: TypeOpBinary(t,CPUI_FLOAT_EQUAL,"==",TYPE_BOOL,TYPE_FLOAT)
|
||||
{
|
||||
opflags = PcodeOp::binary | PcodeOp::booloutput | PcodeOp::commutative | PcodeOp::floatingpoint;
|
||||
opflags = PcodeOp::binary | PcodeOp::booloutput | PcodeOp::commutative;
|
||||
behave = new OpBehaviorFloatEqual(trans);
|
||||
}
|
||||
|
||||
TypeOpFloatNotEqual::TypeOpFloatNotEqual(TypeFactory *t,const Translate *trans)
|
||||
: TypeOpBinary(t,CPUI_FLOAT_NOTEQUAL,"!=",TYPE_BOOL,TYPE_FLOAT)
|
||||
{
|
||||
opflags = PcodeOp::binary | PcodeOp::booloutput | PcodeOp::commutative | PcodeOp::floatingpoint;
|
||||
opflags = PcodeOp::binary | PcodeOp::booloutput | PcodeOp::commutative;
|
||||
behave = new OpBehaviorFloatNotEqual(trans);
|
||||
}
|
||||
|
||||
TypeOpFloatLess::TypeOpFloatLess(TypeFactory *t,const Translate *trans)
|
||||
: TypeOpBinary(t,CPUI_FLOAT_LESS,"<",TYPE_BOOL,TYPE_FLOAT)
|
||||
{
|
||||
opflags = PcodeOp::binary | PcodeOp::booloutput | PcodeOp::floatingpoint;
|
||||
opflags = PcodeOp::binary | PcodeOp::booloutput;
|
||||
behave = new OpBehaviorFloatLess(trans);
|
||||
}
|
||||
|
||||
TypeOpFloatLessEqual::TypeOpFloatLessEqual(TypeFactory *t,const Translate *trans)
|
||||
: TypeOpBinary(t,CPUI_FLOAT_LESSEQUAL,"<=",TYPE_BOOL,TYPE_FLOAT)
|
||||
{
|
||||
opflags = PcodeOp::binary | PcodeOp::booloutput | PcodeOp::floatingpoint;
|
||||
opflags = PcodeOp::binary | PcodeOp::booloutput;
|
||||
behave = new OpBehaviorFloatLessEqual(trans);
|
||||
}
|
||||
|
||||
TypeOpFloatNan::TypeOpFloatNan(TypeFactory *t,const Translate *trans)
|
||||
: TypeOpFunc(t,CPUI_FLOAT_NAN,"NAN",TYPE_BOOL,TYPE_FLOAT)
|
||||
{
|
||||
opflags = PcodeOp::unary | PcodeOp::booloutput | PcodeOp::floatingpoint;
|
||||
opflags = PcodeOp::unary | PcodeOp::booloutput;
|
||||
behave = new OpBehaviorFloatNan(trans);
|
||||
}
|
||||
|
||||
TypeOpFloatAdd::TypeOpFloatAdd(TypeFactory *t,const Translate *trans)
|
||||
: TypeOpBinary(t,CPUI_FLOAT_ADD,"+",TYPE_FLOAT,TYPE_FLOAT)
|
||||
{
|
||||
opflags = PcodeOp::binary | PcodeOp::commutative | PcodeOp::floatingpoint;
|
||||
opflags = PcodeOp::binary | PcodeOp::commutative;
|
||||
behave = new OpBehaviorFloatAdd(trans);
|
||||
}
|
||||
|
||||
TypeOpFloatDiv::TypeOpFloatDiv(TypeFactory *t,const Translate *trans)
|
||||
: TypeOpBinary(t,CPUI_FLOAT_DIV,"/",TYPE_FLOAT,TYPE_FLOAT)
|
||||
{
|
||||
opflags = PcodeOp::binary | PcodeOp::floatingpoint;
|
||||
opflags = PcodeOp::binary;
|
||||
behave = new OpBehaviorFloatDiv(trans);
|
||||
}
|
||||
|
||||
TypeOpFloatMult::TypeOpFloatMult(TypeFactory *t,const Translate *trans)
|
||||
: TypeOpBinary(t,CPUI_FLOAT_MULT,"*",TYPE_FLOAT,TYPE_FLOAT)
|
||||
{
|
||||
opflags = PcodeOp::binary | PcodeOp::commutative | PcodeOp::floatingpoint;
|
||||
opflags = PcodeOp::binary | PcodeOp::commutative;
|
||||
behave = new OpBehaviorFloatMult(trans);
|
||||
}
|
||||
|
||||
TypeOpFloatSub::TypeOpFloatSub(TypeFactory *t,const Translate *trans)
|
||||
: TypeOpBinary(t,CPUI_FLOAT_SUB,"-",TYPE_FLOAT,TYPE_FLOAT)
|
||||
{
|
||||
opflags = PcodeOp::binary | PcodeOp::floatingpoint;
|
||||
opflags = PcodeOp::binary;
|
||||
behave = new OpBehaviorFloatSub(trans);
|
||||
}
|
||||
|
||||
TypeOpFloatNeg::TypeOpFloatNeg(TypeFactory *t,const Translate *trans)
|
||||
: TypeOpUnary(t,CPUI_FLOAT_NEG,"-",TYPE_FLOAT,TYPE_FLOAT)
|
||||
{
|
||||
opflags = PcodeOp::unary | PcodeOp::floatingpoint;
|
||||
opflags = PcodeOp::unary;
|
||||
behave = new OpBehaviorFloatNeg(trans);
|
||||
}
|
||||
|
||||
TypeOpFloatAbs::TypeOpFloatAbs(TypeFactory *t,const Translate *trans)
|
||||
: TypeOpFunc(t,CPUI_FLOAT_ABS,"ABS",TYPE_FLOAT,TYPE_FLOAT)
|
||||
{
|
||||
opflags = PcodeOp::unary | PcodeOp::floatingpoint;
|
||||
opflags = PcodeOp::unary;
|
||||
behave = new OpBehaviorFloatAbs(trans);
|
||||
}
|
||||
|
||||
TypeOpFloatSqrt::TypeOpFloatSqrt(TypeFactory *t,const Translate *trans)
|
||||
: TypeOpFunc(t,CPUI_FLOAT_SQRT,"SQRT",TYPE_FLOAT,TYPE_FLOAT)
|
||||
{
|
||||
opflags = PcodeOp::unary | PcodeOp::floatingpoint;
|
||||
opflags = PcodeOp::unary;
|
||||
behave = new OpBehaviorFloatSqrt(trans);
|
||||
}
|
||||
|
||||
TypeOpFloatInt2Float::TypeOpFloatInt2Float(TypeFactory *t,const Translate *trans)
|
||||
: TypeOpFunc(t,CPUI_FLOAT_INT2FLOAT,"INT2FLOAT",TYPE_FLOAT,TYPE_INT)
|
||||
{
|
||||
opflags = PcodeOp::unary | PcodeOp::floatingpoint;
|
||||
opflags = PcodeOp::unary;
|
||||
behave = new OpBehaviorFloatInt2Float(trans);
|
||||
}
|
||||
|
||||
TypeOpFloatFloat2Float::TypeOpFloatFloat2Float(TypeFactory *t,const Translate *trans)
|
||||
: TypeOpFunc(t,CPUI_FLOAT_FLOAT2FLOAT,"FLOAT2FLOAT",TYPE_FLOAT,TYPE_FLOAT)
|
||||
{
|
||||
opflags = PcodeOp::unary | PcodeOp::floatingpoint;
|
||||
opflags = PcodeOp::unary;
|
||||
behave = new OpBehaviorFloatFloat2Float(trans);
|
||||
}
|
||||
|
||||
TypeOpFloatTrunc::TypeOpFloatTrunc(TypeFactory *t,const Translate *trans)
|
||||
: TypeOpFunc(t,CPUI_FLOAT_TRUNC,"TRUNC",TYPE_INT,TYPE_FLOAT)
|
||||
{
|
||||
opflags = PcodeOp::unary | PcodeOp::floatingpoint;
|
||||
opflags = PcodeOp::unary;
|
||||
behave = new OpBehaviorFloatTrunc(trans);
|
||||
}
|
||||
|
||||
TypeOpFloatCeil::TypeOpFloatCeil(TypeFactory *t,const Translate *trans)
|
||||
: TypeOpFunc(t,CPUI_FLOAT_CEIL,"CEIL",TYPE_FLOAT,TYPE_FLOAT)
|
||||
{
|
||||
opflags = PcodeOp::unary | PcodeOp::floatingpoint;
|
||||
opflags = PcodeOp::unary;
|
||||
behave = new OpBehaviorFloatCeil(trans);
|
||||
}
|
||||
|
||||
TypeOpFloatFloor::TypeOpFloatFloor(TypeFactory *t,const Translate *trans)
|
||||
: TypeOpFunc(t,CPUI_FLOAT_FLOOR,"FLOOR",TYPE_FLOAT,TYPE_FLOAT)
|
||||
{
|
||||
opflags = PcodeOp::unary | PcodeOp::floatingpoint;
|
||||
opflags = PcodeOp::unary;
|
||||
behave = new OpBehaviorFloatFloor(trans);
|
||||
}
|
||||
|
||||
TypeOpFloatRound::TypeOpFloatRound(TypeFactory *t,const Translate *trans)
|
||||
: TypeOpFunc(t,CPUI_FLOAT_ROUND,"ROUND",TYPE_FLOAT,TYPE_FLOAT)
|
||||
{
|
||||
opflags = PcodeOp::unary | PcodeOp::floatingpoint;
|
||||
opflags = PcodeOp::unary;
|
||||
behave = new OpBehaviorFloatRound(trans);
|
||||
}
|
||||
|
||||
|
@ -1610,8 +1610,8 @@ void TypeOpCast::printRaw(ostream &s,const PcodeOp *op)
|
|||
TypeOpPtradd::TypeOpPtradd(TypeFactory *t) : TypeOp(t,CPUI_PTRADD,"+")
|
||||
|
||||
{
|
||||
opflags = PcodeOp::special | PcodeOp::nocollapse;
|
||||
behave = new OpBehavior(CPUI_PTRADD,false,true); // Dummy behavior
|
||||
opflags = PcodeOp::ternary | PcodeOp::nocollapse;
|
||||
behave = new OpBehavior(CPUI_PTRADD,false); // Dummy behavior
|
||||
}
|
||||
|
||||
Datatype *TypeOpPtradd::getInputLocal(const PcodeOp *op,int4 slot) const
|
||||
|
@ -1664,8 +1664,8 @@ TypeOpPtrsub::TypeOpPtrsub(TypeFactory *t) : TypeOp(t,CPUI_PTRSUB,"->")
|
|||
// So it should be commutative
|
||||
// But the typing information doesn't really
|
||||
// allow this to be commutative.
|
||||
opflags = PcodeOp::special|PcodeOp::nocollapse;
|
||||
behave = new OpBehavior(CPUI_PTRSUB,false,true); // Dummy behavior
|
||||
opflags = PcodeOp::binary|PcodeOp::nocollapse;
|
||||
behave = new OpBehavior(CPUI_PTRSUB,false); // Dummy behavior
|
||||
}
|
||||
|
||||
Datatype *TypeOpPtrsub::getOutputLocal(const PcodeOp *op) const
|
||||
|
@ -1834,8 +1834,8 @@ void TypeOpNew::printRaw(ostream &s,const PcodeOp *op)
|
|||
TypeOpInsert::TypeOpInsert(TypeFactory *t)
|
||||
: TypeOpFunc(t,CPUI_INSERT,"INSERT",TYPE_UNKNOWN,TYPE_INT)
|
||||
{
|
||||
opflags = PcodeOp::special;
|
||||
behave = new OpBehavior(CPUI_INSERT,false,true); // Dummy behavior
|
||||
opflags = PcodeOp::ternary;
|
||||
behave = new OpBehavior(CPUI_INSERT,false); // Dummy behavior
|
||||
}
|
||||
|
||||
Datatype *TypeOpInsert::getInputLocal(const PcodeOp *op,int4 slot) const
|
||||
|
@ -1849,8 +1849,8 @@ Datatype *TypeOpInsert::getInputLocal(const PcodeOp *op,int4 slot) const
|
|||
TypeOpExtract::TypeOpExtract(TypeFactory *t)
|
||||
: TypeOpFunc(t,CPUI_EXTRACT,"EXTRACT",TYPE_INT,TYPE_INT)
|
||||
{
|
||||
opflags = PcodeOp::special;
|
||||
behave = new OpBehavior(CPUI_EXTRACT,false,true); // Dummy behavior
|
||||
opflags = PcodeOp::ternary;
|
||||
behave = new OpBehavior(CPUI_EXTRACT,false); // Dummy behavior
|
||||
}
|
||||
|
||||
Datatype *TypeOpExtract::getInputLocal(const PcodeOp *op,int4 slot) const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue