My Project
typeop.hh
Go to the documentation of this file.
1 /* ###
2  * IP: GHIDRA
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
18 
19 #ifndef __CPUI_TYPEOP__
20 #define __CPUI_TYPEOP__
21 
22 #include "cpool.hh"
23 #include "variable.hh"
24 #include "opbehavior.hh"
25 #include "printlanguage.hh"
26 
27 class PcodeOp;
28 class Translate;
29 
37 class TypeOp {
38 public:
39  enum {
42  };
43 protected:
46  uint4 opflags;
47  uint4 addlflags;
48  string name;
50  virtual void setMetatypeIn(type_metatype val) {}
51  virtual void setMetatypeOut(type_metatype val) {}
52  virtual void setSymbol(const string &nm) { name = nm; }
53 public:
54  TypeOp(TypeFactory *t,OpCode opc,const string &n);
55  virtual ~TypeOp(void);
56  const string &getName(void) const { return name; }
57  OpCode getOpcode(void) const { return opcode; }
58  uint4 getFlags(void) const { return opflags; }
59  OpBehavior *getBehavior(void) const { return behave; }
60  bool markExplicitUnsigned(PcodeOp *op,int4 slot) const;
61 
68  uintb evaluateUnary(int4 sizeout,int4 sizein,uintb in1) const {
69  return behave->evaluateUnary(sizeout,sizein,in1); }
70 
78  uintb evaluateBinary(int4 sizeout,int4 sizein,uintb in1,uintb in2) const {
79  return behave->evaluateBinary(sizeout,sizein,in1,in2); }
80 
91  uintb recoverInputBinary(int4 slot,int4 sizeout,uintb out,int4 sizein,uintb in) const {
92  return behave->recoverInputBinary(slot,sizeout,out,sizein,in); }
93 
101  uintb recoverInputUnary(int4 sizeout,uintb out,int4 sizein) const {
102  return behave->recoverInputUnary(sizeout,out,sizein); }
103 
104  bool isCommutative(void) const;
105 
107  bool inheritsSign(void) const { return ((addlflags & inherits_sign)!=0); }
108 
110  virtual Datatype *getOutputLocal(const PcodeOp *op) const;
111 
113  virtual Datatype *getInputLocal(const PcodeOp *op,int4 slot) const;
114 
116  virtual Datatype *getOutputToken(const PcodeOp *op,CastStrategy *castStrategy) const;
117 
119  virtual Datatype *getInputCast(const PcodeOp *op,int4 slot,const CastStrategy *castStrategy) const;
120 
126  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const=0;
127 
132  virtual void printRaw(ostream &s,const PcodeOp *op)=0;
133 
139  virtual string getOperatorName(const PcodeOp *op) const { return name; }
140 
142  static void registerInstructions(vector<TypeOp *> &inst,TypeFactory *tlst,
143  const Translate *trans);
144 
146  static void selectJavaOperators(vector<TypeOp *> &inst,bool val);
147 };
148 
149 // Major classes of operations
150 
155 class TypeOpBinary : public TypeOp {
156  type_metatype metaout;
157  type_metatype metain;
158  virtual void setMetatypeIn(type_metatype val) { metain = val; }
159  virtual void setMetatypeOut(type_metatype val) { metaout = val; }
160 public:
161  TypeOpBinary(TypeFactory *t,OpCode opc,const string &n,type_metatype mout,type_metatype min)
162  : TypeOp(t,opc,n) { metaout = mout; metain = min; }
163  virtual Datatype *getOutputLocal(const PcodeOp *op) const;
164  virtual Datatype *getInputLocal(const PcodeOp *op,int4 slot) const;
165  virtual void printRaw(ostream &s,const PcodeOp *op);
166 };
167 
172 class TypeOpUnary : public TypeOp {
173  type_metatype metaout;
174  type_metatype metain;
175  virtual void setMetatypeIn(type_metatype val) { metain = val; }
176  virtual void setMetatypeOut(type_metatype val) { metaout = val; }
177 public:
178  TypeOpUnary(TypeFactory *t,OpCode opc,const string &n,type_metatype mout,type_metatype min)
179  : TypeOp(t,opc,n) { metaout = mout; metain = min; }
180  virtual Datatype *getOutputLocal(const PcodeOp *op) const;
181  virtual Datatype *getInputLocal(const PcodeOp *op,int4 slot) const;
182  virtual void printRaw(ostream &s,const PcodeOp *op);
183 };
184 
189 class TypeOpFunc : public TypeOp {
190  type_metatype metaout;
191  type_metatype metain;
192  virtual void setMetatypeIn(type_metatype val) { metain = val; }
193  virtual void setMetatypeOut(type_metatype val) { metaout = val; }
194 public:
195  TypeOpFunc(TypeFactory *t,OpCode opc,const string &n,type_metatype mout,type_metatype min)
196  : TypeOp(t,opc,n) { metaout = mout; metain = min; }
197  virtual Datatype *getOutputLocal(const PcodeOp *op) const;
198  virtual Datatype *getInputLocal(const PcodeOp *op,int4 slot) const;
199  virtual void printRaw(ostream &s,const PcodeOp *op);
200 };
201 
202 // A class for each op-code
203 
205 class TypeOpCopy : public TypeOp {
206 public:
207  TypeOpCopy(TypeFactory *t);
208  virtual Datatype *getInputCast(const PcodeOp *op,int4 slot,const CastStrategy *castStrategy) const;
209  virtual Datatype *getOutputToken(const PcodeOp *op,CastStrategy *castStrategy) const;
210  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opCopy(op); }
211  virtual void printRaw(ostream &s,const PcodeOp *op);
212 };
213 
215 class TypeOpLoad : public TypeOp {
216 public:
217  TypeOpLoad(TypeFactory *t);
218  // virtual Datatype *getInputLocal(const PcodeOp *op,int4 slot) const;
219  virtual Datatype *getInputCast(const PcodeOp *op,int4 slot,const CastStrategy *castStrategy) const;
220  virtual Datatype *getOutputToken(const PcodeOp *op,CastStrategy *castStrategy) const;
221  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opLoad(op); }
222  virtual void printRaw(ostream &s,const PcodeOp *op);
223 };
224 
226 class TypeOpStore : public TypeOp {
227 public:
229  // virtual Datatype *getInputLocal(const PcodeOp *op,int4 slot) const;
230  virtual Datatype *getInputCast(const PcodeOp *op,int4 slot,const CastStrategy *castStrategy) const;
231  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opStore(op); }
232  virtual void printRaw(ostream &s,const PcodeOp *op);
233 };
234 
236 class TypeOpBranch : public TypeOp {
237 public:
239  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opBranch(op); }
240  virtual void printRaw(ostream &s,const PcodeOp *op);
241 };
242 
244 class TypeOpCbranch : public TypeOp {
245 public:
247  virtual Datatype *getInputLocal(const PcodeOp *op,int4 slot) const;
248  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opCbranch(op); }
249  virtual void printRaw(ostream &s,const PcodeOp *op);
250 };
251 
253 class TypeOpBranchind : public TypeOp {
254 public:
256  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opBranchind(op); }
257  virtual void printRaw(ostream &s,const PcodeOp *op);
258 };
259 
261 class TypeOpCall : public TypeOp {
262 public:
263  TypeOpCall(TypeFactory *t);
264  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opCall(op); }
265  virtual void printRaw(ostream &s,const PcodeOp *op);
266  virtual Datatype *getInputLocal(const PcodeOp *op,int4 slot) const;
267  virtual Datatype *getOutputLocal(const PcodeOp *op) const;
268 };
269 
271 class TypeOpCallind : public TypeOp {
272 public:
274  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opCallind(op); }
275  virtual void printRaw(ostream &s,const PcodeOp *op);
276  virtual Datatype *getInputLocal(const PcodeOp *op,int4 slot) const;
277  virtual Datatype *getOutputLocal(const PcodeOp *op) const;
278 };
279 
281 class TypeOpCallother : public TypeOp {
282 public:
284  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opCallother(op); }
285  virtual void printRaw(ostream &s,const PcodeOp *op);
286  virtual string getOperatorName(const PcodeOp *op) const;
287  virtual Datatype *getInputLocal(const PcodeOp *op,int4 slot) const;
288  virtual Datatype *getOutputLocal(const PcodeOp *op) const;
289 };
290 
292 class TypeOpReturn : public TypeOp {
293 public:
295  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opReturn(op); }
296  virtual void printRaw(ostream &s,const PcodeOp *op);
297  virtual Datatype *getInputLocal(const PcodeOp *op,int4 slot) const;
298 };
299 
301 class TypeOpEqual : public TypeOpBinary {
302 public:
304  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opIntEqual(op); }
305  virtual Datatype *getInputCast(const PcodeOp *op,int4 slot,const CastStrategy *castStrategy) const;
306 };
307 
309 class TypeOpNotEqual : public TypeOpBinary {
310 public:
312  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opIntNotEqual(op); }
313  virtual Datatype *getInputCast(const PcodeOp *op,int4 slot,const CastStrategy *castStrategy) const;
314 };
315 
317 class TypeOpIntSless : public TypeOpBinary {
318 public:
320  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opIntSless(op); }
321  virtual Datatype *getInputCast(const PcodeOp *op,int4 slot,const CastStrategy *castStrategy) const;
322 };
323 
326 public:
328  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opIntSlessEqual(op); }
329  virtual Datatype *getInputCast(const PcodeOp *op,int4 slot,const CastStrategy *castStrategy) const;
330 };
331 
333 class TypeOpIntLess : public TypeOpBinary {
334 public:
336  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opIntLess(op); }
337  virtual Datatype *getInputCast(const PcodeOp *op,int4 slot,const CastStrategy *castStrategy) const;
338 };
339 
342 public:
344  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opIntLessEqual(op); }
345  virtual Datatype *getInputCast(const PcodeOp *op,int4 slot,const CastStrategy *castStrategy) const;
346 };
347 
349 class TypeOpIntZext : public TypeOpFunc {
350 public:
352  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opIntZext(op,readOp); }
353  virtual string getOperatorName(const PcodeOp *op) const;
354  virtual Datatype *getInputCast(const PcodeOp *op,int4 slot,const CastStrategy *castStrategy) const;
355 };
356 
358 class TypeOpIntSext : public TypeOpFunc {
359 public:
361  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opIntSext(op,readOp); }
362  virtual string getOperatorName(const PcodeOp *op) const;
363  virtual Datatype *getInputCast(const PcodeOp *op,int4 slot,const CastStrategy *castStrategy) const;
364 };
365 
367 class TypeOpIntAdd : public TypeOpBinary {
368 public:
370  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opIntAdd(op); }
371  virtual Datatype *getOutputToken(const PcodeOp *op,CastStrategy *castStrategy) const;
372 };
373 
375 class TypeOpIntSub : public TypeOpBinary {
376 public:
378  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opIntSub(op); }
379  virtual Datatype *getOutputToken(const PcodeOp *op,CastStrategy *castStrategy) const;
380 };
381 
383 class TypeOpIntCarry : public TypeOpFunc {
384 public:
386  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opIntCarry(op); }
387  virtual string getOperatorName(const PcodeOp *op) const;
388 };
389 
391 class TypeOpIntScarry : public TypeOpFunc {
392 public:
394  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opIntScarry(op); }
395  virtual string getOperatorName(const PcodeOp *op) const;
396 };
397 
399 class TypeOpIntSborrow : public TypeOpFunc {
400 public:
402  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opIntSborrow(op); }
403  virtual string getOperatorName(const PcodeOp *op) const;
404 };
405 
407 class TypeOpInt2Comp : public TypeOpUnary {
408 public:
410  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opInt2Comp(op); }
411  virtual Datatype *getOutputToken(const PcodeOp *op,CastStrategy *castStrategy) const;
412 };
413 
415 class TypeOpIntNegate : public TypeOpUnary {
416 public:
418  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opIntNegate(op); }
419  virtual Datatype *getOutputToken(const PcodeOp *op,CastStrategy *castStrategy) const;
420 };
421 
423 class TypeOpIntXor : public TypeOpBinary {
424 public:
426  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opIntXor(op); }
427  virtual Datatype *getOutputToken(const PcodeOp *op,CastStrategy *castStrategy) const;
428 };
429 
431 class TypeOpIntAnd : public TypeOpBinary {
432 public:
434  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opIntAnd(op); }
435  virtual Datatype *getOutputToken(const PcodeOp *op,CastStrategy *castStrategy) const;
436 };
437 
439 class TypeOpIntOr : public TypeOpBinary {
440 public:
442  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opIntOr(op); }
443  virtual Datatype *getOutputToken(const PcodeOp *op,CastStrategy *castStrategy) const;
444 };
445 
447 class TypeOpIntLeft : public TypeOpBinary {
448 public:
450  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opIntLeft(op); }
451  virtual Datatype *getInputLocal(const PcodeOp *op,int4 slot) const;
452  virtual Datatype *getOutputToken(const PcodeOp *op,CastStrategy *castStrategy) const;
453 };
454 
456 class TypeOpIntRight : public TypeOpBinary {
457 public:
459  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opIntRight(op); }
460  virtual Datatype *getInputCast(const PcodeOp *op,int4 slot,const CastStrategy *castStrategy) const;
461  virtual Datatype *getInputLocal(const PcodeOp *op,int4 slot) const;
462  virtual Datatype *getOutputToken(const PcodeOp *op,CastStrategy *castStrategy) const;
463 };
464 
467 public:
469  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opIntSright(op); }
470  virtual void printRaw(ostream &s,const PcodeOp *op);
471  virtual Datatype *getInputCast(const PcodeOp *op,int4 slot,const CastStrategy *castStrategy) const;
472  virtual Datatype *getInputLocal(const PcodeOp *op,int4 slot) const;
473  virtual Datatype *getOutputToken(const PcodeOp *op,CastStrategy *castStrategy) const;
474 };
475 
477 class TypeOpIntMult : public TypeOpBinary {
478 public:
480  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opIntMult(op); }
481  virtual Datatype *getOutputToken(const PcodeOp *op,CastStrategy *castStrategy) const;
482 };
483 
485 class TypeOpIntDiv : public TypeOpBinary {
486 public:
488  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opIntDiv(op); }
489  virtual Datatype *getInputCast(const PcodeOp *op,int4 slot,const CastStrategy *castStrategy) const;
490 };
491 
493 class TypeOpIntSdiv : public TypeOpBinary {
494 public:
496  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opIntSdiv(op); }
497  virtual Datatype *getInputCast(const PcodeOp *op,int4 slot,const CastStrategy *castStrategy) const;
498 };
499 
501 class TypeOpIntRem : public TypeOpBinary {
502 public:
504  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opIntRem(op); }
505  virtual Datatype *getInputCast(const PcodeOp *op,int4 slot,const CastStrategy *castStrategy) const;
506 };
507 
509 class TypeOpIntSrem : public TypeOpBinary {
510 public:
512  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opIntSrem(op); }
513  virtual Datatype *getInputCast(const PcodeOp *op,int4 slot,const CastStrategy *castStrategy) const;
514 };
515 
518 public:
520  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opBoolNegate(op); }
521 };
522 
524 class TypeOpBoolXor : public TypeOpBinary {
525 public:
527  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opBoolXor(op); }
528 };
529 
531 class TypeOpBoolAnd : public TypeOpBinary {
532 public:
534  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opBoolAnd(op); }
535 };
536 
538 class TypeOpBoolOr : public TypeOpBinary {
539 public:
541  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opBoolOr(op); }
542 };
543 
546 public:
547  TypeOpFloatEqual(TypeFactory *t,const Translate *trans);
548  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opFloatEqual(op); }
549 };
550 
553 public:
554  TypeOpFloatNotEqual(TypeFactory *t,const Translate *trans);
555  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opFloatNotEqual(op); }
556 };
557 
560 public:
561  TypeOpFloatLess(TypeFactory *t,const Translate *trans);
562  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opFloatLess(op); }
563 };
564 
567 public:
568  TypeOpFloatLessEqual(TypeFactory *t,const Translate *trans);
569  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opFloatLessEqual(op); }
570 };
571 
573 class TypeOpFloatNan : public TypeOpFunc {
574 public:
575  TypeOpFloatNan(TypeFactory *t,const Translate *trans);
576  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opFloatNan(op); }
577 };
578 
580 class TypeOpFloatAdd : public TypeOpBinary {
581 public:
582  TypeOpFloatAdd(TypeFactory *t,const Translate *trans);
583  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opFloatAdd(op); }
584 };
585 
587 class TypeOpFloatDiv : public TypeOpBinary {
588 public:
589  TypeOpFloatDiv(TypeFactory *t,const Translate *trans);
590  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opFloatDiv(op); }
591 };
592 
595 public:
596  TypeOpFloatMult(TypeFactory *t,const Translate *trans);
597  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opFloatMult(op); }
598 };
599 
601 class TypeOpFloatSub : public TypeOpBinary {
602 public:
603  TypeOpFloatSub(TypeFactory *t,const Translate *trans);
604  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opFloatSub(op); }
605 };
606 
608 class TypeOpFloatNeg : public TypeOpUnary {
609 public:
610  TypeOpFloatNeg(TypeFactory *t,const Translate *trans);
611  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opFloatNeg(op); }
612 };
613 
615 class TypeOpFloatAbs : public TypeOpFunc {
616 public:
617  TypeOpFloatAbs(TypeFactory *t,const Translate *trans);
618  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opFloatAbs(op); }
619 };
620 
622 class TypeOpFloatSqrt : public TypeOpFunc {
623 public:
624  TypeOpFloatSqrt(TypeFactory *t,const Translate *trans);
625  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opFloatSqrt(op); }
626 };
627 
630 public:
631  TypeOpFloatInt2Float(TypeFactory *t,const Translate *trans);
632  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opFloatInt2Float(op); }
633 };
634 
637 public:
638  TypeOpFloatFloat2Float(TypeFactory *t,const Translate *trans);
639  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opFloatFloat2Float(op); }
640 };
641 
643 class TypeOpFloatTrunc : public TypeOpFunc {
644 public:
645  TypeOpFloatTrunc(TypeFactory *t,const Translate *trans);
646  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opFloatTrunc(op); }
647 };
648 
650 class TypeOpFloatCeil : public TypeOpFunc {
651 public:
652  TypeOpFloatCeil(TypeFactory *t,const Translate *trans);
653  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opFloatCeil(op); }
654 };
655 
657 class TypeOpFloatFloor : public TypeOpFunc {
658 public:
659  TypeOpFloatFloor(TypeFactory *t,const Translate *trans);
660  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opFloatFloor(op); }
661 };
662 
664 class TypeOpFloatRound : public TypeOpFunc {
665 public:
666  TypeOpFloatRound(TypeFactory *t,const Translate *trans);
667  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opFloatRound(op); }
668 };
669 
671 class TypeOpMulti : public TypeOp {
672 public:
674  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opMultiequal(op); }
675  virtual void printRaw(ostream &s,const PcodeOp *op);
676 };
677 
679 class TypeOpIndirect : public TypeOp {
680 public:
682  virtual Datatype *getInputLocal(const PcodeOp *op,int4 slot) const;
683  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opIndirect(op); }
684  virtual void printRaw(ostream &s,const PcodeOp *op);
685 };
686 
688 class TypeOpPiece : public TypeOpFunc {
689 public:
691  virtual Datatype *getOutputToken(const PcodeOp *op,CastStrategy *castStrategy) const;
692  virtual string getOperatorName(const PcodeOp *op) const;
693  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opPiece(op); }
694 };
695 
697 class TypeOpSubpiece : public TypeOpFunc {
698 public:
700  // virtual Datatype *getOutputLocal(const PcodeOp *op) const;
701  // virtual Datatype *getInputLocal(const PcodeOp *op,int4 slot) const;
702  virtual Datatype *getOutputToken(const PcodeOp *op,CastStrategy *castStrategy) const;
703  virtual string getOperatorName(const PcodeOp *op) const;
704  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opSubpiece(op); }
705 };
706 
708 class TypeOpCast : public TypeOp {
709 public:
710  TypeOpCast(TypeFactory *t);
711  // We don't care what types are cast
712  // So no input and output requirements
713  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opCast(op); }
714  virtual void printRaw(ostream &s,const PcodeOp *op);
715 };
716 
718 class TypeOpPtradd : public TypeOp {
719 public:
721  virtual Datatype *getInputLocal(const PcodeOp *op,int4 slot) const;
722  virtual Datatype *getOutputLocal(const PcodeOp *op) const;
723  virtual Datatype *getOutputToken(const PcodeOp *op,CastStrategy *castStrategy) const;
724  virtual Datatype *getInputCast(const PcodeOp *op,int4 slot,const CastStrategy *castStrategy) const;
725  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opPtradd(op); }
726  virtual void printRaw(ostream &s,const PcodeOp *op);
727 };
728 
730 class TypeOpPtrsub : public TypeOp {
731 public:
733  virtual Datatype *getOutputLocal(const PcodeOp *op) const;
734  virtual Datatype *getInputLocal(const PcodeOp *op,int4 slot) const;
735  virtual Datatype *getInputCast(const PcodeOp *op,int4 slot,const CastStrategy *castStrategy) const;
736  virtual Datatype *getOutputToken(const PcodeOp *op,CastStrategy *castStrategy) const;
737  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opPtrsub(op); }
738  virtual void printRaw(ostream &s,const PcodeOp *op);
739 };
740 
749 class TypeOpSegment : public TypeOp {
750 public:
752  // virtual Datatype *getOutputLocal(const PcodeOp *op) const;
753  // virtual Datatype *getInputLocal(const PcodeOp *op,int4 slot) const;
754  virtual Datatype *getInputCast(const PcodeOp *op,int4 slot,const CastStrategy *castStrategy) const;
755  virtual Datatype *getOutputToken(const PcodeOp *op,CastStrategy *castStrategy) const;
756  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opSegmentOp(op); }
757  virtual void printRaw(ostream &s,const PcodeOp *op);
758 };
759 
761 class TypeOpCpoolref : public TypeOp {
762  ConstantPool *cpool;
763 public:
765  virtual Datatype *getInputCast(const PcodeOp *op,int4 slot,const CastStrategy *castStrategy) const { return (Datatype *)0; } // Never needs casting
766  virtual Datatype *getOutputLocal(const PcodeOp *op) const;
767  virtual Datatype *getInputLocal(const PcodeOp *op,int4 slot) const;
768  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opCpoolRefOp(op); }
769  virtual void printRaw(ostream &s,const PcodeOp *op);
770 };
771 
773 class TypeOpNew : public TypeOp {
774 public:
775  TypeOpNew(TypeFactory *t);
776  virtual Datatype *getInputCast(const PcodeOp *op,int4 slot,const CastStrategy *castStrategy) const { return (Datatype *)0; } // Never needs casting
777  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opNewOp(op); }
778  virtual void printRaw(ostream &s,const PcodeOp *op);
779 };
780 
782 class TypeOpInsert : public TypeOpFunc {
783 public:
785  virtual Datatype *getInputLocal(const PcodeOp *op,int4 slot) const;
786  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opInsertOp(op); }
787 };
788 
790 class TypeOpExtract : public TypeOpFunc {
791 public:
793  virtual Datatype *getInputLocal(const PcodeOp *op,int4 slot) const;
794  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opExtractOp(op); }
795 };
796 
798 class TypeOpPopcount : public TypeOpFunc {
799 public:
801  virtual void push(PrintLanguage *lng,const PcodeOp *op,const PcodeOp *readOp) const { lng->opPopcountOp(op); }
802 };
803 
804 #endif
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:352
Information about the PTRSUB op-code.
Definition: typeop.hh:730
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:386
Information about the RETURN op-code.
Definition: typeop.hh:292
Information about the INT_ADD op-code.
Definition: typeop.hh:367
Associate data-type and behavior information with a specific p-code op-code.
Definition: typeop.hh:37
virtual void opIntLeft(const PcodeOp *op)=0
Emit a INT_LEFT operator.
virtual void opIntDiv(const PcodeOp *op)=0
Emit a INT_DIV operator.
Information about the FLOAT_NAN op-code.
Definition: typeop.hh:573
virtual void opInt2Comp(const PcodeOp *op)=0
Emit a INT_2COMP operator.
Information about the LOAD op-code.
Definition: typeop.hh:215
Information about the INT_OR op-code.
Definition: typeop.hh:439
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:794
Information about the FLOAT_FLOAT2FLOAT op-code.
Definition: typeop.hh:636
The base datatype class for the decompiler.
Definition: type.hh:62
A generic functional operator.
Definition: typeop.hh:189
Information about the INT_2COMP op-code.
Definition: typeop.hh:407
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:693
Information about the BOOL_NEGATE op-code.
Definition: typeop.hh:517
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:674
virtual void opBoolXor(const PcodeOp *op)=0
Emit a BOOL_XOR operator.
virtual void opIntAdd(const PcodeOp *op)=0
Emit a INT_ADD operator.
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:370
uint4 opflags
Cached pcode-op properties for this op-code.
Definition: typeop.hh:46
OpCode
The op-code defining a specific p-code operation (PcodeOp)
Definition: opcodes.hh:35
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:426
Classes for printing tokens in a high-level language.
virtual void opIntRem(const PcodeOp *op)=0
Emit a INT_REM operator.
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:496
uint4 addlflags
Additional properties.
Definition: typeop.hh:47
Information about the COPY op-code.
Definition: typeop.hh:205
virtual void opFloatDiv(const PcodeOp *op)=0
Emit a FLOAT_DIV operator.
OpBehavior * getBehavior(void) const
Get the behavior associated with the op-code.
Definition: typeop.hh:59
virtual void opBoolOr(const PcodeOp *op)=0
Emit a BOOL_OR operator.
Information about the BRANCH op-code.
Definition: typeop.hh:236
Information about the INT_AND op-code.
Definition: typeop.hh:431
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:320
virtual void opFloatCeil(const PcodeOp *op)=0
Emit a FLOAT_CEIL operator.
virtual void opIntXor(const PcodeOp *op)=0
Emit a INT_XOR operator.
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:488
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:328
virtual void opIntRight(const PcodeOp *op)=0
Emit a INT_RIGHT operator.
virtual void opCallother(const PcodeOp *op)=0
Emit a CALLOTHER operator.
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:512
Information about the STORE op-code.
Definition: typeop.hh:226
virtual void opCall(const PcodeOp *op)=0
Emit a CALL operator.
virtual void opFloatNeg(const PcodeOp *op)=0
Emit a FLOAT_NEG operator.
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:548
Information about the INT_ZEXT op-code.
Definition: typeop.hh:349
virtual void opCopy(const PcodeOp *op)=0
Emit a COPY operator.
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:555
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:768
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:256
virtual void setMetatypeOut(type_metatype val)
Set the data-type associated with outputs of this opcode.
Definition: typeop.hh:51
Information about the PIECE op-code.
Definition: typeop.hh:688
Information about the INT_REM op-code.
Definition: typeop.hh:501
virtual void opFloatMult(const PcodeOp *op)=0
Emit a FLOAT_MULT operator.
string name
Symbol denoting this operation.
Definition: typeop.hh:48
virtual void opFloatLessEqual(const PcodeOp *op)=0
Emit a FLOAT_LESSEQUAL operator.
OpCode opcode
The op-code value.
Definition: typeop.hh:45
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:312
virtual void opNewOp(const PcodeOp *op)=0
Emit a NEW operator.
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:597
Information about the CBRANCH op-code.
Definition: typeop.hh:244
virtual void opFloatNan(const PcodeOp *op)=0
Emit a FLOAT_NAN operator.
virtual void opStore(const PcodeOp *op)=0
Emit a STORE operator.
Definitions for high-level variables.
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:469
Information about the BRANCHIND op-code.
Definition: typeop.hh:253
Information about the INT_NEGATE op-code.
Definition: typeop.hh:415
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:274
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:725
virtual void opFloatAbs(const PcodeOp *op)=0
Emit a FLOAT_ABS operator.
virtual Datatype * getInputCast(const PcodeOp *op, int4 slot, const CastStrategy *castStrategy) const
Find the data-type of the input to a specific PcodeOp.
Definition: typeop.hh:776
Information about the BOOL_AND op-code.
Definition: typeop.hh:531
virtual void opFloatTrunc(const PcodeOp *op)=0
Emit a FLOAT_TRUNC operator.
virtual void opFloatFloor(const PcodeOp *op)=0
Emit a FLOAT_FLOOR operator.
type_metatype
Definition: type.hh:33
virtual void opIntLess(const PcodeOp *op)=0
Emit a INT_LESS operator.
Information about the INT_MULT op-code.
Definition: typeop.hh:477
virtual string getOperatorName(const PcodeOp *op) const
Get the name of the op-code as it should be displayed in context.
Definition: typeop.hh:139
virtual void opIntMult(const PcodeOp *op)=0
Emit a INT_MULT operator.
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:442
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:304
Information about the INT_RIGHT op-code.
Definition: typeop.hh:456
Information about the INT_SUB op-code.
Definition: typeop.hh:375
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:777
virtual Datatype * getOutputToken(const PcodeOp *op, CastStrategy *castStrategy) const
Find the data-type of the output that would be assigned by a compiler.
Definition: typeop.cc:199
virtual void opSubpiece(const PcodeOp *op)=0
Emit a SUBPIECE operator.
virtual void opIntSless(const PcodeOp *op)=0
Emit a INT_SLESS operator.
virtual void opIntCarry(const PcodeOp *op)=0
Emit a INT_CARRY operator.
TypeOpFunc(TypeFactory *t, OpCode opc, const string &n, type_metatype mout, type_metatype min)
Constructor.
Definition: typeop.hh:195
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:786
Information about the FLOAT_FLOOR op-code.
Definition: typeop.hh:657
virtual void opIntNegate(const PcodeOp *op)=0
Emit a INT_NEGATE operator.
Information about the BOOL_XOR op-code.
Definition: typeop.hh:524
Information about the FLOAT_ADD op-code.
Definition: typeop.hh:580
Class encapsulating the action/behavior of specific pcode opcodes.
Definition: opbehavior.hh:42
virtual void opIntAnd(const PcodeOp *op)=0
Emit a INT_AND operator.
virtual void opFloatSub(const PcodeOp *op)=0
Emit a FLOAT_SUB operator.
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:541
Information about the FLOAT_ROUND op-code.
Definition: typeop.hh:664
TypeOpUnary(TypeFactory *t, OpCode opc, const string &n, type_metatype mout, type_metatype min)
Constructor.
Definition: typeop.hh:178
Information about the POPCOUNT op-code.
Definition: typeop.hh:798
virtual void opBoolNegate(const PcodeOp *op)=0
Emit a BOOL_NEGATE operator.
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:632
Information about the FLOAT_TRUNC op-code.
Definition: typeop.hh:643
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:378
Information about the BOOL_OR op-code.
Definition: typeop.hh:538
Information about the FLOAT_NOTEQUAL op-code.
Definition: typeop.hh:552
virtual void opIntSext(const PcodeOp *op, const PcodeOp *readOp)=0
Emit a INT_SEXT operator.
Information about the INT_SLESS op-code.
Definition: typeop.hh:317
Information about the MULTIEQUAL op-code.
Definition: typeop.hh:671
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:756
A strategy for applying type casts.
Definition: cast.hh:40
virtual void opReturn(const PcodeOp *op)=0
Emit a RETURN operator.
Information about the INT_SBORROW op-code.
Definition: typeop.hh:399
virtual void opCast(const PcodeOp *op)=0
Emit a CAST operator.
Information about the INT_SEXT op-code.
Definition: typeop.hh:358
virtual void opIntEqual(const PcodeOp *op)=0
Emit a INT_EQUAL operator.
virtual void opFloatFloat2Float(const PcodeOp *op)=0
Emit a FLOAT_FLOAT2FLOAT operator.
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:527
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:344
Lowest level operation of the p-code language.
Definition: op.hh:58
virtual void opIntZext(const PcodeOp *op, const PcodeOp *readOp)=0
Emit a INT_ZEXT operator.
const string & getName(void) const
Get the display name of the op-code.
Definition: typeop.hh:56
OpBehavior * behave
Object for emulating the behavior of the op-code.
Definition: typeop.hh:49
virtual uintb evaluateBinary(int4 sizeout, int4 sizein, uintb in1, uintb in2) const
Emulate the binary op-code on input values.
Definition: opbehavior.cc:123
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const =0
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Information about the CALLOTHER op-code (user defined p-code operations)
Definition: typeop.hh:281
virtual void opIntSdiv(const PcodeOp *op)=0
Emit a INT_SDIV operator.
virtual void opLoad(const PcodeOp *op)=0
Emit a LOAD operator.
Information about the INT_SLESSEQUAL op-code.
Definition: typeop.hh:325
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:576
virtual Datatype * getInputCast(const PcodeOp *op, int4 slot, const CastStrategy *castStrategy) const
Find the data-type of the input to a specific PcodeOp.
Definition: typeop.hh:765
virtual void opFloatNotEqual(const PcodeOp *op)=0
Emit a FLOAT_NOTEQUAL operator.
static void selectJavaOperators(vector< TypeOp *> &inst, bool val)
Toggle Java specific aspects of the op-code information.
Definition: typeop.cc:112
virtual void opFloatSqrt(const PcodeOp *op)=0
Emit a FLOAT_SQRT operator.
virtual void opBoolAnd(const PcodeOp *op)=0
Emit a BOOL_AND operator.
Classes for describing the behavior of individual p-code operations.
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:459
The interface to a translation engine for a processor.
Definition: translate.hh:293
Information about the INT_LESS op-code.
Definition: typeop.hh:333
virtual void opFloatLess(const PcodeOp *op)=0
Emit a FLOAT_LESS operator.
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:450
Information about the INSERT op-code.
Definition: typeop.hh:782
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:583
Information about the CALL op-code.
Definition: typeop.hh:261
static void registerInstructions(vector< TypeOp *> &inst, TypeFactory *tlst, const Translate *trans)
Build a map from op-code value to the TypeOp information objects.
Definition: typeop.cc:23
uint4 getFlags(void) const
Get the properties associated with the op-code.
Definition: typeop.hh:58
virtual ~TypeOp(void)
Destructor.
Definition: typeop.cc:161
virtual void opIntNotEqual(const PcodeOp *op)=0
Emit a INT_NOTEQUAL operator.
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:646
Information about the INT_LEFT op-code.
Definition: typeop.hh:447
virtual void opBranchind(const PcodeOp *op)=0
Emit a BRANCHIND operator.
An interface to the pool of constant objects for byte-code languages.
Definition: cpool.hh:94
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:590
Information about the INT_SREM op-code.
Definition: typeop.hh:509
virtual Datatype * getInputLocal(const PcodeOp *op, int4 slot) const
Find the minimal (or suggested) data-type of an input to this op-code.
Definition: typeop.cc:188
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:418
virtual void opIndirect(const PcodeOp *op)=0
Emit a INDIRECT operator.
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:801
virtual void opExtractOp(const PcodeOp *op)=0
Emit an EXTRACT operator.
Information about the INT_CARRY op-code.
Definition: typeop.hh:383
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:683
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:534
Information about the CPOOLREF op-code.
Definition: typeop.hh:761
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:639
virtual void opFloatAdd(const PcodeOp *op)=0
Emit a FLOAT_ADD operator.
Information about the INT_SCARRY op-code.
Definition: typeop.hh:391
A generic unary operator: one input and one output.
Definition: typeop.hh:172
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:611
Information about the CAST op-code.
Definition: typeop.hh:708
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:231
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:402
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:480
Information about the FLOAT_DIV op-code.
Definition: typeop.hh:587
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:562
uintb evaluateBinary(int4 sizeout, int4 sizein, uintb in1, uintb in2) const
Emulate the binary op-code on an input value.
Definition: typeop.hh:78
virtual void opPtradd(const PcodeOp *op)=0
Emit a PTRADD operator.
virtual void opSegmentOp(const PcodeOp *op)=0
Emit a SEGMENTOP operator.
Information about the NEW op-code.
Definition: typeop.hh:773
virtual void opPopcountOp(const PcodeOp *op)=0
Emit a POPCOUNT operator.
uintb evaluateUnary(int4 sizeout, int4 sizein, uintb in1) const
Emulate the unary op-code on an input value.
Definition: typeop.hh:68
virtual void printRaw(ostream &s, const PcodeOp *op)=0
Print (for debugging purposes) this specific PcodeOp to the stream.
bool isCommutative(void) const
Return true if this op-code is commutative.
Definition: typeop.cc:169
virtual void setMetatypeIn(type_metatype val)
Set the data-type associated with inputs to this opcode.
Definition: typeop.hh:50
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:264
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:295
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:569
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:737
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:434
Information about the FLOAT_INT2FLOAT op-code.
Definition: typeop.hh:629
virtual void opInsertOp(const PcodeOp *op)=0
Emit an INSERT operator.
virtual void opPtrsub(const PcodeOp *op)=0
Emit a PTRSUB operator.
Information about the FLOAT_ABS op-code.
Definition: typeop.hh:615
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:704
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:604
Information about the SUBPIECE op-code.
Definition: typeop.hh:697
virtual uintb evaluateUnary(int4 sizeout, int4 sizein, uintb in1) const
Emulate the unary op-code on an input value.
Definition: opbehavior.cc:111
TypeOpBinary(TypeFactory *t, OpCode opc, const string &n, type_metatype mout, type_metatype min)
Constructor.
Definition: typeop.hh:161
virtual void opCbranch(const PcodeOp *op)=0
Emit a CBRANCH operator.
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:625
Definitions to support a constant pool for deferred compilation languages (i.e. java byte-code) ...
Only inherits sign from first operand, not the second.
Definition: typeop.hh:41
Information about the SEGMENTOP op-code.
Definition: typeop.hh:749
Information about the PTRADD op-code.
Definition: typeop.hh:718
A generic binary operator: two inputs and one output.
Definition: typeop.hh:155
virtual Datatype * getInputCast(const PcodeOp *op, int4 slot, const CastStrategy *castStrategy) const
Find the data-type of the input to a specific PcodeOp.
Definition: typeop.cc:212
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:239
Information about the FLOAT_SQRT op-code.
Definition: typeop.hh:622
Information about the EXTRACT op-code.
Definition: typeop.hh:790
bool markExplicitUnsigned(PcodeOp *op, int4 slot) const
Check if a constant input should be explicitly labeled as unsigned.
Definition: typeop.cc:230
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:618
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:713
bool inheritsSign(void) const
Return true if the op-code inherits it signedness from its inputs.
Definition: typeop.hh:107
Container class for all Datatype objects in an Architecture.
Definition: type.hh:380
virtual void opCpoolRefOp(const PcodeOp *op)=0
Emit a CPOOLREF operator.
Information about the CALLIND op-code.
Definition: typeop.hh:271
virtual void opFloatEqual(const PcodeOp *op)=0
Emit a FLOAT_EQUAL operator.
virtual uintb recoverInputBinary(int4 slot, int4 sizeout, uintb out, int4 sizein, uintb in) const
Reverse the binary op-code operation, recovering an input value.
Definition: opbehavior.cc:149
Information about the FLOAT_NEG op-code.
Definition: typeop.hh:608
uintb recoverInputUnary(int4 sizeout, uintb out, int4 sizein) const
Reverse the unary op-code operation, recovering a constant input value.
Definition: typeop.hh:101
OpCode getOpcode(void) const
Get the op-code value.
Definition: typeop.hh:57
uintb recoverInputBinary(int4 slot, int4 sizeout, uintb out, int4 sizein, uintb in) const
Reverse the binary op-code operation, recovering a constant input value.
Definition: typeop.hh:91
Information about the INT_EQUAL op-code.
Definition: typeop.hh:301
Information about the FLOAT_CEIL op-code.
Definition: typeop.hh:650
Information about the INT_SDIV op-code.
Definition: typeop.hh:493
virtual void opFloatRound(const PcodeOp *op)=0
Emit a FLOAT_ROUND operator.
virtual void opIntSlessEqual(const PcodeOp *op)=0
Emit a INT_SLESSEQUAL operator.
Information about the FLOAT_SUB op-code.
Definition: typeop.hh:601
virtual uintb recoverInputUnary(int4 sizeout, uintb out, int4 sizein) const
Reverse the unary op-code operation, recovering the input value.
Definition: opbehavior.cc:135
TypeFactory * tlst
Pointer to data-type factory.
Definition: typeop.hh:44
virtual void opPiece(const PcodeOp *op)=0
Emit a PIECE operator.
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:361
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:504
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:336
Information about the FLOAT_LESSEQUAL op-code.
Definition: typeop.hh:566
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:410
Information about the INT_SRIGHT op-code.
Definition: typeop.hh:466
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:284
Information about the INT_NOTEQUAL op-code.
Definition: typeop.hh:309
virtual void opCallind(const PcodeOp *op)=0
Emit a CALLIND operator.
TypeOp(TypeFactory *t, OpCode opc, const string &n)
Constructor.
Definition: typeop.cc:150
virtual void opMultiequal(const PcodeOp *op)=0
Emit a MULTIEQUAL operator.
virtual void opIntSright(const PcodeOp *op)=0
Emit a INT_SRIGHT operator.
Information about the INDIRECT op-code.
Definition: typeop.hh:679
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:520
virtual void opBranch(const PcodeOp *op)=0
Emit a BRANCH operator.
Information about the INT_DIV op-code.
Definition: typeop.hh:485
virtual void opIntSborrow(const PcodeOp *op)=0
Emit a INT_SBORROW operator.
virtual void opIntSub(const PcodeOp *op)=0
Emit a INT_SUB operator.
virtual void opFloatInt2Float(const PcodeOp *op)=0
Emit a FLOAT_INT2FLOAT operator.
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:248
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:660
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:221
virtual void setSymbol(const string &nm)
Set the display symbol associated with the op-code.
Definition: typeop.hh:52
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:667
The base class API for emitting a high-level language.
Definition: printlanguage.hh:134
Information about the FLOAT_MULT op-code.
Definition: typeop.hh:594
Information about the INT_XOR op-code.
Definition: typeop.hh:423
Information about the FLOAT_LESS op-code.
Definition: typeop.hh:559
Operator token inherits signedness from its inputs.
Definition: typeop.hh:40
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:394
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:653
virtual void push(PrintLanguage *lng, const PcodeOp *op, const PcodeOp *readOp) const
Push the specific PcodeOp to the emitter&#39;s RPN stack.
Definition: typeop.hh:210
virtual void opIntScarry(const PcodeOp *op)=0
Emit a INT_SCARRY operator.
virtual Datatype * getOutputLocal(const PcodeOp *op) const
Find the minimal (or suggested) data-type of an output to this op-code.
Definition: typeop.cc:178
virtual void opIntOr(const PcodeOp *op)=0
Emit a INT_OR operator.
Information about the FLOAT_EQUAL op-code.
Definition: typeop.hh:545
virtual void opIntLessEqual(const PcodeOp *op)=0
Emit a INT_LESSEQUAL operator.
virtual void opIntSrem(const PcodeOp *op)=0
Emit a INT_SREM operator.
Information about the INT_LESSEQUAL op-code.
Definition: typeop.hh:341