18 #ifndef __CPUI_OPBEHAVIOR__ 19 #define __CPUI_OPBEHAVIOR__ 54 OpCode getOpcode(
void)
const;
57 bool isSpecial(
void)
const;
60 bool isUnary(
void)
const;
63 virtual uintb evaluateUnary(int4 sizeout,int4 sizein,uintb in1)
const;
66 virtual uintb evaluateBinary(int4 sizeout,int4 sizein,uintb in1,uintb in2)
const;
69 virtual uintb recoverInputBinary(int4 slot,int4 sizeout,uintb out,int4 sizein,uintb in)
const;
72 virtual uintb recoverInputUnary(int4 sizeout,uintb out,int4 sizein)
const;
74 static void registerInstructions(vector<OpBehavior *> &inst,
const Translate *trans);
126 virtual uintb evaluateUnary(int4 sizeout,int4 sizein,uintb in1)
const;
127 virtual uintb recoverInputUnary(int4 sizeout,uintb out,int4 sizein)
const;
134 virtual uintb evaluateBinary(int4 sizeout,int4 sizein,uintb in1,uintb in2)
const;
141 virtual uintb evaluateBinary(int4 sizeout,int4 sizein,uintb in1,uintb in2)
const;
148 virtual uintb evaluateBinary(int4 sizeout,int4 sizein,uintb in1,uintb in2)
const;
155 virtual uintb evaluateBinary(int4 sizeout,int4 sizein,uintb in1,uintb in2)
const;
162 virtual uintb evaluateBinary(int4 sizeout,int4 sizein,uintb in1,uintb in2)
const;
169 virtual uintb evaluateBinary(int4 sizeout,int4 sizein,uintb in1,uintb in2)
const;
176 virtual uintb evaluateUnary(int4 sizeout,int4 sizein,uintb in1)
const;
177 virtual uintb recoverInputUnary(int4 sizeout,uintb out,int4 sizein)
const;
184 virtual uintb evaluateUnary(int4 sizeout,int4 sizein,uintb in1)
const;
185 virtual uintb recoverInputUnary(int4 sizeout,uintb out,int4 sizein)
const;
192 virtual uintb evaluateBinary(int4 sizeout,int4 sizein,uintb in1,uintb in2)
const;
193 virtual uintb recoverInputBinary(int4 slot,int4 sizeout,uintb out,int4 sizein,uintb in)
const;
200 virtual uintb evaluateBinary(int4 sizeout,int4 sizein,uintb in1,uintb in2)
const;
201 virtual uintb recoverInputBinary(int4 slot,int4 sizeout,uintb out,int4 sizein,uintb in)
const;
208 virtual uintb evaluateBinary(int4 sizeout,int4 sizein,uintb in1,uintb in2)
const;
215 virtual uintb evaluateBinary(int4 sizeout,int4 sizein,uintb in1,uintb in2)
const;
222 virtual uintb evaluateBinary(int4 sizeout,int4 sizein,uintb in1,uintb in2)
const;
229 virtual uintb evaluateUnary(int4 sizeout,int4 sizein,uintb in1)
const;
236 virtual uintb evaluateUnary(int4 sizeout,int4 sizein,uintb in1)
const;
243 virtual uintb evaluateBinary(int4 sizeout,int4 sizein,uintb in1,uintb in2)
const;
250 virtual uintb evaluateBinary(int4 sizeout,int4 sizein,uintb in1,uintb in2)
const;
257 virtual uintb evaluateBinary(int4 sizeout,int4 sizein,uintb in1,uintb in2)
const;
264 virtual uintb evaluateBinary(int4 sizeout,int4 sizein,uintb in1,uintb in2)
const;
265 virtual uintb recoverInputBinary(int4 slot,int4 sizeout,uintb out,int4 sizein,uintb in)
const;
272 virtual uintb evaluateBinary(int4 sizeout,int4 sizein,uintb in1,uintb in2)
const;
273 virtual uintb recoverInputBinary(int4 slot,int4 sizeout,uintb out,int4 sizein,uintb in)
const;
280 virtual uintb evaluateBinary(int4 sizeout,int4 sizein,uintb in1,uintb in2)
const;
281 virtual uintb recoverInputBinary(int4 slot,int4 sizeout,uintb out,int4 sizein,uintb in)
const;
288 virtual uintb evaluateBinary(int4 sizeout,int4 sizein,uintb in1,uintb in2)
const;
295 virtual uintb evaluateBinary(int4 sizeout,int4 sizein,uintb in1,uintb in2)
const;
302 virtual uintb evaluateBinary(int4 sizeout,int4 sizein,uintb in1,uintb in2)
const;
309 virtual uintb evaluateBinary(int4 sizeout,int4 sizein,uintb in1,uintb in2)
const;
316 virtual uintb evaluateBinary(int4 sizeout,int4 sizein,uintb in1,uintb in2)
const;
323 virtual uintb evaluateUnary(int4 sizeout,int4 sizein,uintb in1)
const;
330 virtual uintb evaluateBinary(int4 sizeout,int4 sizein,uintb in1,uintb in2)
const;
337 virtual uintb evaluateBinary(int4 sizeout,int4 sizein,uintb in1,uintb in2)
const;
344 virtual uintb evaluateBinary(int4 sizeout,int4 sizein,uintb in1,uintb in2)
const;
352 virtual uintb evaluateBinary(int4 sizeout,int4 sizein,uintb in1,uintb in2)
const;
360 virtual uintb evaluateBinary(int4 sizeout,int4 sizein,uintb in1,uintb in2)
const;
368 virtual uintb evaluateBinary(int4 sizeout,int4 sizein,uintb in1,uintb in2)
const;
376 virtual uintb evaluateBinary(int4 sizeout,int4 sizein,uintb in1,uintb in2)
const;
384 virtual uintb evaluateUnary(int4 sizeout,int4 sizein,uintb in1)
const;
392 virtual uintb evaluateBinary(int4 sizeout,int4 sizein,uintb in1,uintb in2)
const;
400 virtual uintb evaluateBinary(int4 sizeout,int4 sizein,uintb in1,uintb in2)
const;
408 virtual uintb evaluateBinary(int4 sizeout,int4 sizein,uintb in1,uintb in2)
const;
416 virtual uintb evaluateBinary(int4 sizeout,int4 sizein,uintb in1,uintb in2)
const;
424 virtual uintb evaluateUnary(int4 sizeout,int4 sizein,uintb in1)
const;
432 virtual uintb evaluateUnary(int4 sizeout,int4 sizein,uintb in1)
const;
440 virtual uintb evaluateUnary(int4 sizeout,int4 sizein,uintb in1)
const;
448 virtual uintb evaluateUnary(int4 sizeout,int4 sizein,uintb in1)
const;
456 virtual uintb evaluateUnary(int4 sizeout,int4 sizein,uintb in1)
const;
464 virtual uintb evaluateUnary(int4 sizeout,int4 sizein,uintb in1)
const;
472 virtual uintb evaluateUnary(int4 sizeout,int4 sizein,uintb in1)
const;
480 virtual uintb evaluateUnary(int4 sizeout,int4 sizein,uintb in1)
const;
488 virtual uintb evaluateUnary(int4 sizeout,int4 sizein,uintb in1)
const;
495 virtual uintb evaluateBinary(int4 sizeout,int4 sizein,uintb in1,uintb in2)
const;
502 virtual uintb evaluateBinary(int4 sizeout,int4 sizein,uintb in1,uintb in2)
const;
509 virtual uintb evaluateUnary(int4 sizeout,int4 sizein,uintb in1)
const;
CPUI_INT_AND behavior.
Definition: opbehavior.hh:247
CPUI_INT_NEGATE behavior.
Definition: opbehavior.hh:233
Concatenate.
Definition: opcodes.hh:114
Convert between different floating-point sizes.
Definition: opcodes.hh:102
OpBehaviorFloatLessEqual(const Translate *trans)
Constructor.
Definition: opbehavior.hh:375
Convert an integer to a floating-point.
Definition: opcodes.hh:101
OpBehaviorFloatFloat2Float(const Translate *trans)
Constructor.
Definition: opbehavior.hh:455
OpBehaviorIntSborrow(void)
Constructor.
Definition: opbehavior.hh:221
CPUI_FLOAT_DIV behavior.
Definition: opbehavior.hh:396
Floating-point absolute value (abs)
Definition: opcodes.hh:98
Floating-point comparison, equality (==)
Definition: opcodes.hh:86
Test for signed borrow.
Definition: opcodes.hh:64
Integer comparison, in-equality (!=)
Definition: opcodes.hh:52
CPUI_FLOAT_NAN behavior.
Definition: opbehavior.hh:380
OpBehaviorEqual(void)
Constructor.
Definition: opbehavior.hh:133
Boolean or (||)
Definition: opcodes.hh:82
OpBehaviorIntXor(void)
Constructor.
Definition: opbehavior.hh:242
OpBehaviorNotEqual(void)
Constructor.
Definition: opbehavior.hh:140
CPUI_FLOAT_SUB behavior.
Definition: opbehavior.hh:412
OpCode
The op-code defining a specific p-code operation (PcodeOp)
Definition: opcodes.hh:35
OpBehaviorBoolNegate(void)
Constructor.
Definition: opbehavior.hh:322
CPUI_FLOAT_NOTEQUAL behavior.
Definition: opbehavior.hh:356
Boolean exclusive-or (^^)
Definition: opcodes.hh:80
CPUI_FLOAT_CEIL behavior.
Definition: opbehavior.hh:468
CPUI_INT_ZEXT behavior.
Definition: opbehavior.hh:173
OpBehaviorIntLessEqual(void)
Constructor.
Definition: opbehavior.hh:168
CPUI_INT_REM behavior.
Definition: opbehavior.hh:306
CPUI_FLOAT_FLOAT2FLOAT behavior.
Definition: opbehavior.hh:452
Boolean and (&&)
Definition: opcodes.hh:81
OpBehaviorFloatTrunc(const Translate *trans)
Constructor.
Definition: opbehavior.hh:463
Zero extension.
Definition: opcodes.hh:58
OpBehaviorIntRem(void)
Constructor.
Definition: opbehavior.hh:308
Integer division, signed (/)
Definition: opcodes.hh:75
Logical/bitwise exclusive-or (^)
Definition: opcodes.hh:67
CPUI_INT_RIGHT behavior.
Definition: opbehavior.hh:269
CPUI_INT_SDIV behavior.
Definition: opbehavior.hh:299
CPUI_INT_SREM behavior.
Definition: opbehavior.hh:313
Floating-point comparison, less-than (<)
Definition: opcodes.hh:88
OpBehaviorIntMult(void)
Constructor.
Definition: opbehavior.hh:287
CPUI_SUBPIECE behavior.
Definition: opbehavior.hh:499
CPUI_FLOAT_TRUNC behavior.
Definition: opbehavior.hh:460
Integer comparison, signed less-than-or-equal (<=)
Definition: opcodes.hh:54
CPUI_INT_SLESSEQUAL behavior.
Definition: opbehavior.hh:152
CPUI_FLOAT_LESS behavior.
Definition: opbehavior.hh:364
OpBehaviorFloatEqual(const Translate *trans)
Constructor.
Definition: opbehavior.hh:351
OpBehaviorFloatLess(const Translate *trans)
Constructor.
Definition: opbehavior.hh:367
CPUI_INT_EQUAL behavior.
Definition: opbehavior.hh:131
CPUI_BOOL_XOR behavior.
Definition: opbehavior.hh:327
OpBehaviorFloatAdd(const Translate *trans)
Constructor.
Definition: opbehavior.hh:391
CPUI_INT_OR behavior.
Definition: opbehavior.hh:254
Sign extension.
Definition: opcodes.hh:59
OpBehaviorFloatAbs(const Translate *trans)
Constructor.
Definition: opbehavior.hh:431
Round towards nearest.
Definition: opcodes.hh:106
CPUI_INT_SBORROW behavior.
Definition: opbehavior.hh:219
OpBehaviorIntLess(void)
Constructor.
Definition: opbehavior.hh:161
OpBehaviorFloatMult(const Translate *trans)
Constructor.
Definition: opbehavior.hh:407
OpBehaviorIntCarry(void)
Constructor.
Definition: opbehavior.hh:207
OpBehaviorIntSub(void)
Constructor.
Definition: opbehavior.hh:199
OpBehaviorPopcount(void)
Constructor.
Definition: opbehavior.hh:508
CPUI_FLOAT_ADD behavior.
Definition: opbehavior.hh:388
OpBehaviorFloatInt2Float(const Translate *trans)
Constructor.
Definition: opbehavior.hh:447
OpBehavior(OpCode opc, bool isun)
A behavior constructor.
Definition: opbehavior.hh:80
CPUI_INT_XOR behavior.
Definition: opbehavior.hh:240
OpBehaviorIntRight(void)
Constructor.
Definition: opbehavior.hh:271
OpBehaviorFloatSqrt(const Translate *trans)
Constructor.
Definition: opbehavior.hh:439
Floating-point comparison, less-than-or-equal (<=)
Definition: opcodes.hh:89
CPUI_FLOAT_INT2FLOAT behavior.
Definition: opbehavior.hh:444
CPUI_INT_SEXT behavior.
Definition: opbehavior.hh:181
CPUI_INT_SRIGHT behavior.
Definition: opbehavior.hh:277
Round towards +infinity.
Definition: opcodes.hh:104
bool isSpecial(void) const
Check if this is a special operator.
Definition: opbehavior.hh:110
CPUI_POPCOUNT behavior.
Definition: opbehavior.hh:506
Class encapsulating the action/behavior of specific pcode opcodes.
Definition: opbehavior.hh:42
OpBehaviorBoolXor(void)
Constructor.
Definition: opbehavior.hh:329
OpBehaviorFloatNeg(const Translate *trans)
Constructor.
Definition: opbehavior.hh:423
OpBehaviorIntSless(void)
Constructor.
Definition: opbehavior.hh:147
Test for signed carry.
Definition: opcodes.hh:63
All the individual p-code operations.
CPUI_COPY behavior.
Definition: opbehavior.hh:123
Test for unsigned carry.
Definition: opcodes.hh:62
CPUI_BOOL_AND behavior.
Definition: opbehavior.hh:334
CPUI_FLOAT_MULT behavior.
Definition: opbehavior.hh:404
Copy one operand to another.
Definition: opcodes.hh:36
CPUI_FLOAT_ABS behavior.
Definition: opbehavior.hh:428
CPUI_INT_MULT behavior.
Definition: opbehavior.hh:285
OpBehaviorIntSext(void)
Constructor.
Definition: opbehavior.hh:183
CPUI_INT_LEFT behavior.
Definition: opbehavior.hh:261
Count the 1-bits.
Definition: opcodes.hh:125
Floating-point negation (-)
Definition: opcodes.hh:97
CPUI_INT_NOTEQUAL behavior.
Definition: opbehavior.hh:138
Round towards -infinity.
Definition: opcodes.hh:105
CPUI_INT_LESSEQUAL behavior.
Definition: opbehavior.hh:166
Integer comparison, unsigned less-than (<)
Definition: opcodes.hh:55
The interface to a translation engine for a processor.
Definition: translate.hh:293
Not-a-number test (NaN)
Definition: opcodes.hh:91
Integer comparison, signed less-than (<)
Definition: opcodes.hh:53
Boolean negate (!)
Definition: opcodes.hh:79
Floating-point comparison, in-equality (!=)
Definition: opcodes.hh:87
CPUI_INT_LESS behavior.
Definition: opbehavior.hh:159
OpBehaviorBoolAnd(void)
Constructor.
Definition: opbehavior.hh:336
Truncate.
Definition: opcodes.hh:115
CPUI_PIECE behavior.
Definition: opbehavior.hh:492
EvaluationError(const string &s)
Initialize the error with an explanatory string.
Definition: opbehavior.hh:29
Right shift, logical (>>)
Definition: opcodes.hh:71
OpBehaviorIntAdd(void)
Constructor.
Definition: opbehavior.hh:191
The lowest level error generated by the decompiler.
Definition: error.hh:44
Round towards zero.
Definition: opcodes.hh:103
OpBehaviorFloatNotEqual(const Translate *trans)
Constructor.
Definition: opbehavior.hh:359
bool isUnary(void) const
Check if operator is unary.
Definition: opbehavior.hh:116
OpBehaviorIntDiv(void)
Constructor.
Definition: opbehavior.hh:294
OpBehaviorPiece(void)
Constructor.
Definition: opbehavior.hh:494
Definition: opbehavior.hh:28
Floating-point subtraction (-)
Definition: opcodes.hh:96
CPUI_INT_SLESS behavior.
Definition: opbehavior.hh:145
CPUI_INT_SUB behavior.
Definition: opbehavior.hh:197
CPUI_FLOAT_LESSEQUAL behavior.
Definition: opbehavior.hh:372
Base class for error handling facilities.
OpBehaviorIntSlessEqual(void)
Constructor.
Definition: opbehavior.hh:154
OpBehaviorIntOr(void)
Constructor.
Definition: opbehavior.hh:256
OpBehaviorInt2Comp(void)
Constructor.
Definition: opbehavior.hh:228
Integer comparison, unsigned less-than-or-equal (<=)
Definition: opcodes.hh:57
OpBehaviorFloatFloor(const Translate *trans)
Constructor.
Definition: opbehavior.hh:479
Integer division, unsigned (/)
Definition: opcodes.hh:74
CPUI_BOOL_NEGATE behavior.
Definition: opbehavior.hh:320
CPUI_FLOAT_NEG behavior.
Definition: opbehavior.hh:420
CPUI_INT_2COMP behavior.
Definition: opbehavior.hh:226
OpBehaviorFloatNan(const Translate *trans)
Constructor.
Definition: opbehavior.hh:383
Addition, signed or unsigned (+)
Definition: opcodes.hh:60
Floating-point addition (+)
Definition: opcodes.hh:93
Logical/bitwise negation (~)
Definition: opcodes.hh:66
Remainder/modulo, signed (%)
Definition: opcodes.hh:77
Subtraction, signed or unsigned (-)
Definition: opcodes.hh:61
CPUI_INT_CARRY behavior.
Definition: opbehavior.hh:205
CPUI_FLOAT_SQRT behavior.
Definition: opbehavior.hh:436
OpBehaviorIntLeft(void)
Constructor.
Definition: opbehavior.hh:263
OpBehaviorCopy(void)
Constructor.
Definition: opbehavior.hh:125
OpBehaviorIntZext(void)
Constructor.
Definition: opbehavior.hh:175
CPUI_INT_DIV behavior.
Definition: opbehavior.hh:292
Right shift, arithmetic (>>)
Definition: opcodes.hh:72
OpBehaviorIntSright(void)
Constructor.
Definition: opbehavior.hh:279
OpBehaviorFloatSub(const Translate *trans)
Constructor.
Definition: opbehavior.hh:415
OpBehaviorIntAnd(void)
Constructor.
Definition: opbehavior.hh:249
Integer comparison, equality (==)
Definition: opcodes.hh:51
OpBehaviorFloatCeil(const Translate *trans)
Constructor.
Definition: opbehavior.hh:471
OpBehaviorIntScarry(void)
Constructor.
Definition: opbehavior.hh:214
OpBehaviorFloatDiv(const Translate *trans)
Constructor.
Definition: opbehavior.hh:399
OpCode getOpcode(void) const
Get the opcode for this pcode operation.
Definition: opbehavior.hh:103
CPUI_FLOAT_ROUND behavior.
Definition: opbehavior.hh:484
OpBehaviorBoolOr(void)
Constructor.
Definition: opbehavior.hh:343
OpBehaviorIntSrem(void)
Constructor.
Definition: opbehavior.hh:315
Floating-point division (/)
Definition: opcodes.hh:94
Remainder/modulo, unsigned (%)
Definition: opcodes.hh:76
Twos complement.
Definition: opcodes.hh:65
Floating-point multiplication (*)
Definition: opcodes.hh:95
Integer multiplication, signed and unsigned (*)
Definition: opcodes.hh:73
Logical/bitwise or (|)
Definition: opcodes.hh:69
Logical/bitwise and (&)
Definition: opcodes.hh:68
Floating-point square root (sqrt)
Definition: opcodes.hh:99
CPUI_INT_ADD behavior.
Definition: opbehavior.hh:189
OpBehaviorIntNegate(void)
Constructor.
Definition: opbehavior.hh:235
CPUI_BOOL_OR behavior.
Definition: opbehavior.hh:341
OpBehaviorIntSdiv(void)
Constructor.
Definition: opbehavior.hh:301
CPUI_FLOAT_EQUAL behavior.
Definition: opbehavior.hh:348
CPUI_FLOAT_FLOOR behavior.
Definition: opbehavior.hh:476
CPUI_INT_SCARRY behavior.
Definition: opbehavior.hh:212
Left shift (<<)
Definition: opcodes.hh:70
OpBehaviorSubpiece(void)
Constructor.
Definition: opbehavior.hh:501
OpBehaviorFloatRound(const Translate *trans)
Constructor.
Definition: opbehavior.hh:487