OLD | NEW |
---|---|
1 //===- subzero/src/IceInstX8632.h - Low-level x86 instructions --*- C++ -*-===// | 1 //===- subzero/src/IceInstX8632.h - Low-level x86 instructions --*- C++ -*-===// |
2 // | 2 // |
3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // This file declares the InstX8632 and OperandX8632 classes and | 10 // This file declares the InstX8632 and OperandX8632 classes and |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
256 Subss, | 256 Subss, |
257 Test, | 257 Test, |
258 Ucomiss, | 258 Ucomiss, |
259 UD2, | 259 UD2, |
260 Xadd, | 260 Xadd, |
261 Xchg, | 261 Xchg, |
262 Xor | 262 Xor |
263 }; | 263 }; |
264 | 264 |
265 static const char *getWidthString(Type Ty); | 265 static const char *getWidthString(Type Ty); |
266 static const char *getFldString(Type Ty); | |
266 void dump(const Cfg *Func) const override; | 267 void dump(const Cfg *Func) const override; |
267 | 268 |
268 protected: | 269 protected: |
269 InstX8632(Cfg *Func, InstKindX8632 Kind, SizeT Maxsrcs, Variable *Dest) | 270 InstX8632(Cfg *Func, InstKindX8632 Kind, SizeT Maxsrcs, Variable *Dest) |
270 : InstTarget(Func, static_cast<InstKind>(Kind), Maxsrcs, Dest) {} | 271 : InstTarget(Func, static_cast<InstKind>(Kind), Maxsrcs, Dest) {} |
271 ~InstX8632() override {} | 272 ~InstX8632() override {} |
272 static bool isClassof(const Inst *Inst, InstKindX8632 MyKind) { | 273 static bool isClassof(const Inst *Inst, InstKindX8632 MyKind) { |
273 return Inst->getKind() == static_cast<InstKind>(MyKind); | 274 return Inst->getKind() == static_cast<InstKind>(MyKind); |
274 } | 275 } |
275 }; | 276 }; |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
456 template <InstX8632::InstKindX8632 K> | 457 template <InstX8632::InstKindX8632 K> |
457 class InstX8632InplaceopGPR : public InstX8632 { | 458 class InstX8632InplaceopGPR : public InstX8632 { |
458 InstX8632InplaceopGPR(const InstX8632InplaceopGPR &) = delete; | 459 InstX8632InplaceopGPR(const InstX8632InplaceopGPR &) = delete; |
459 InstX8632InplaceopGPR &operator=(const InstX8632InplaceopGPR &) = delete; | 460 InstX8632InplaceopGPR &operator=(const InstX8632InplaceopGPR &) = delete; |
460 | 461 |
461 public: | 462 public: |
462 static InstX8632InplaceopGPR *create(Cfg *Func, Operand *SrcDest) { | 463 static InstX8632InplaceopGPR *create(Cfg *Func, Operand *SrcDest) { |
463 return new (Func->allocate<InstX8632InplaceopGPR>()) | 464 return new (Func->allocate<InstX8632InplaceopGPR>()) |
464 InstX8632InplaceopGPR(Func, SrcDest); | 465 InstX8632InplaceopGPR(Func, SrcDest); |
465 } | 466 } |
466 void emit(const Cfg *Func) const override { | 467 void emit(const Cfg *Func) const override { |
Jim Stichnoth
2014/10/31 20:55:19
No changes needed for AT&T syntax.
| |
467 Ostream &Str = Func->getContext()->getStrEmit(); | 468 Ostream &Str = Func->getContext()->getStrEmit(); |
468 assert(getSrcSize() == 1); | 469 assert(getSrcSize() == 1); |
469 Str << "\t" << Opcode << "\t"; | 470 Str << "\t" << Opcode << "\t"; |
470 getSrc(0)->emit(Func); | 471 getSrc(0)->emit(Func); |
471 } | 472 } |
472 void emitIAS(const Cfg *Func) const override { | 473 void emitIAS(const Cfg *Func) const override { |
473 assert(getSrcSize() == 1); | 474 assert(getSrcSize() == 1); |
474 const Variable *Var = getDest(); | 475 const Variable *Var = getDest(); |
475 Type Ty = Var->getType(); | 476 Type Ty = Var->getType(); |
476 emitIASOpTyGPR(Func, Ty, Var, Emitter); | 477 emitIASOpTyGPR(Func, Ty, Var, Emitter); |
(...skipping 30 matching lines...) Expand all Loading... | |
507 InstX8632UnaryopGPR &operator=(const InstX8632UnaryopGPR &) = delete; | 508 InstX8632UnaryopGPR &operator=(const InstX8632UnaryopGPR &) = delete; |
508 | 509 |
509 public: | 510 public: |
510 static InstX8632UnaryopGPR *create(Cfg *Func, Variable *Dest, Operand *Src) { | 511 static InstX8632UnaryopGPR *create(Cfg *Func, Variable *Dest, Operand *Src) { |
511 return new (Func->allocate<InstX8632UnaryopGPR>()) | 512 return new (Func->allocate<InstX8632UnaryopGPR>()) |
512 InstX8632UnaryopGPR(Func, Dest, Src); | 513 InstX8632UnaryopGPR(Func, Dest, Src); |
513 } | 514 } |
514 void emit(const Cfg *Func) const override { | 515 void emit(const Cfg *Func) const override { |
515 Ostream &Str = Func->getContext()->getStrEmit(); | 516 Ostream &Str = Func->getContext()->getStrEmit(); |
516 assert(getSrcSize() == 1); | 517 assert(getSrcSize() == 1); |
517 Str << "\t" << Opcode << "\t"; | 518 Type SrcTy = getSrc(0)->getType(); |
519 Type DestTy = getDest()->getType(); | |
520 Str << "\t" << Opcode << getWidthString(SrcTy); | |
521 if (SrcTy != DestTy) | |
522 Str << getWidthString(DestTy); | |
523 Str << "\t"; | |
524 getSrc(0)->emit(Func); | |
525 Str << ", "; | |
518 getDest()->emit(Func); | 526 getDest()->emit(Func); |
519 Str << ", "; | |
520 getSrc(0)->emit(Func); | |
521 } | 527 } |
522 void emitIAS(const Cfg *Func) const override { | 528 void emitIAS(const Cfg *Func) const override { |
523 assert(getSrcSize() == 1); | 529 assert(getSrcSize() == 1); |
524 const Variable *Var = getDest(); | 530 const Variable *Var = getDest(); |
525 Type Ty = Var->getType(); | 531 Type Ty = Var->getType(); |
526 const Operand *Src = getSrc(0); | 532 const Operand *Src = getSrc(0); |
527 emitIASRegOpTyGPR(Func, Ty, Var, Src, Emitter); | 533 emitIASRegOpTyGPR(Func, Ty, Var, Src, Emitter); |
528 } | 534 } |
529 void dump(const Cfg *Func) const override { | 535 void dump(const Cfg *Func) const override { |
530 Ostream &Str = Func->getContext()->getStrDump(); | 536 Ostream &Str = Func->getContext()->getStrDump(); |
(...skipping 24 matching lines...) Expand all Loading... | |
555 | 561 |
556 public: | 562 public: |
557 static InstX8632UnaryopXmm *create(Cfg *Func, Variable *Dest, Operand *Src) { | 563 static InstX8632UnaryopXmm *create(Cfg *Func, Variable *Dest, Operand *Src) { |
558 return new (Func->allocate<InstX8632UnaryopXmm>()) | 564 return new (Func->allocate<InstX8632UnaryopXmm>()) |
559 InstX8632UnaryopXmm(Func, Dest, Src); | 565 InstX8632UnaryopXmm(Func, Dest, Src); |
560 } | 566 } |
561 void emit(const Cfg *Func) const override { | 567 void emit(const Cfg *Func) const override { |
562 Ostream &Str = Func->getContext()->getStrEmit(); | 568 Ostream &Str = Func->getContext()->getStrEmit(); |
563 assert(getSrcSize() == 1); | 569 assert(getSrcSize() == 1); |
564 Str << "\t" << Opcode << "\t"; | 570 Str << "\t" << Opcode << "\t"; |
571 getSrc(0)->emit(Func); | |
572 Str << ", "; | |
565 getDest()->emit(Func); | 573 getDest()->emit(Func); |
566 Str << ", "; | |
567 getSrc(0)->emit(Func); | |
568 } | 574 } |
569 void emitIAS(const Cfg *Func) const override { | 575 void emitIAS(const Cfg *Func) const override { |
570 Type Ty = getDest()->getType(); | 576 Type Ty = getDest()->getType(); |
571 assert(getSrcSize() == 1); | 577 assert(getSrcSize() == 1); |
572 emitIASRegOpTyXMM(Func, Ty, getDest(), getSrc(0), Emitter); | 578 emitIASRegOpTyXMM(Func, Ty, getDest(), getSrc(0), Emitter); |
573 } | 579 } |
574 void dump(const Cfg *Func) const override { | 580 void dump(const Cfg *Func) const override { |
575 Ostream &Str = Func->getContext()->getStrDump(); | 581 Ostream &Str = Func->getContext()->getStrDump(); |
576 dumpDest(Func); | 582 dumpDest(Func); |
577 Str << " = " << Opcode << "." << getDest()->getType() << " "; | 583 Str << " = " << Opcode << "." << getDest()->getType() << " "; |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
773 // Create a ternary-op instruction like div or idiv. | 779 // Create a ternary-op instruction like div or idiv. |
774 static InstX8632Ternop *create(Cfg *Func, Variable *Dest, Operand *Source1, | 780 static InstX8632Ternop *create(Cfg *Func, Variable *Dest, Operand *Source1, |
775 Operand *Source2) { | 781 Operand *Source2) { |
776 return new (Func->allocate<InstX8632Ternop>()) | 782 return new (Func->allocate<InstX8632Ternop>()) |
777 InstX8632Ternop(Func, Dest, Source1, Source2); | 783 InstX8632Ternop(Func, Dest, Source1, Source2); |
778 } | 784 } |
779 void emit(const Cfg *Func) const override { | 785 void emit(const Cfg *Func) const override { |
780 Ostream &Str = Func->getContext()->getStrEmit(); | 786 Ostream &Str = Func->getContext()->getStrEmit(); |
781 assert(getSrcSize() == 3); | 787 assert(getSrcSize() == 3); |
782 Str << "\t" << Opcode << "\t"; | 788 Str << "\t" << Opcode << "\t"; |
783 getDest()->emit(Func); | 789 getSrc(2)->emit(Func); |
784 Str << ", "; | 790 Str << ", "; |
785 getSrc(1)->emit(Func); | 791 getSrc(1)->emit(Func); |
786 Str << ", "; | 792 Str << ", "; |
787 getSrc(2)->emit(Func); | 793 getDest()->emit(Func); |
788 } | 794 } |
789 void emitIAS(const Cfg *Func) const override; | 795 void emitIAS(const Cfg *Func) const override; |
790 void dump(const Cfg *Func) const override { | 796 void dump(const Cfg *Func) const override { |
791 Ostream &Str = Func->getContext()->getStrDump(); | 797 Ostream &Str = Func->getContext()->getStrDump(); |
792 dumpDest(Func); | 798 dumpDest(Func); |
793 Str << " = " << Opcode << "." << getDest()->getType() << " "; | 799 Str << " = " << Opcode << "." << getDest()->getType() << " "; |
794 dumpSources(Func); | 800 dumpSources(Func); |
795 } | 801 } |
796 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } | 802 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } |
797 | 803 |
(...skipping 17 matching lines...) Expand all Loading... | |
815 public: | 821 public: |
816 static InstX8632ThreeAddressop *create(Cfg *Func, Variable *Dest, | 822 static InstX8632ThreeAddressop *create(Cfg *Func, Variable *Dest, |
817 Operand *Source0, Operand *Source1) { | 823 Operand *Source0, Operand *Source1) { |
818 return new (Func->allocate<InstX8632ThreeAddressop>()) | 824 return new (Func->allocate<InstX8632ThreeAddressop>()) |
819 InstX8632ThreeAddressop(Func, Dest, Source0, Source1); | 825 InstX8632ThreeAddressop(Func, Dest, Source0, Source1); |
820 } | 826 } |
821 void emit(const Cfg *Func) const override { | 827 void emit(const Cfg *Func) const override { |
822 Ostream &Str = Func->getContext()->getStrEmit(); | 828 Ostream &Str = Func->getContext()->getStrEmit(); |
823 assert(getSrcSize() == 2); | 829 assert(getSrcSize() == 2); |
824 Str << "\t" << Opcode << "\t"; | 830 Str << "\t" << Opcode << "\t"; |
825 getDest()->emit(Func); | 831 getSrc(1)->emit(Func); |
826 Str << ", "; | 832 Str << ", "; |
827 getSrc(0)->emit(Func); | 833 getSrc(0)->emit(Func); |
828 Str << ", "; | 834 Str << ", "; |
829 getSrc(1)->emit(Func); | 835 getDest()->emit(Func); |
830 } | 836 } |
831 void emitIAS(const Cfg *Func) const override; | 837 void emitIAS(const Cfg *Func) const override; |
832 void dump(const Cfg *Func) const override { | 838 void dump(const Cfg *Func) const override { |
833 Ostream &Str = Func->getContext()->getStrDump(); | 839 Ostream &Str = Func->getContext()->getStrDump(); |
834 dumpDest(Func); | 840 dumpDest(Func); |
835 Str << " = " << Opcode << "." << getDest()->getType() << " "; | 841 Str << " = " << Opcode << "." << getDest()->getType() << " "; |
836 dumpSources(Func); | 842 dumpSources(Func); |
837 } | 843 } |
838 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } | 844 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } |
839 | 845 |
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1545 template <> void InstX8632Pinsr::emitIAS(const Cfg *Func) const; | 1551 template <> void InstX8632Pinsr::emitIAS(const Cfg *Func) const; |
1546 template <> void InstX8632Movsx::emitIAS(const Cfg *Func) const; | 1552 template <> void InstX8632Movsx::emitIAS(const Cfg *Func) const; |
1547 template <> void InstX8632Movzx::emitIAS(const Cfg *Func) const; | 1553 template <> void InstX8632Movzx::emitIAS(const Cfg *Func) const; |
1548 template <> void InstX8632Pmull::emitIAS(const Cfg *Func) const; | 1554 template <> void InstX8632Pmull::emitIAS(const Cfg *Func) const; |
1549 template <> void InstX8632Pshufd::emitIAS(const Cfg *Func) const; | 1555 template <> void InstX8632Pshufd::emitIAS(const Cfg *Func) const; |
1550 template <> void InstX8632Shufps::emitIAS(const Cfg *Func) const; | 1556 template <> void InstX8632Shufps::emitIAS(const Cfg *Func) const; |
1551 | 1557 |
1552 } // end of namespace Ice | 1558 } // end of namespace Ice |
1553 | 1559 |
1554 #endif // SUBZERO_SRC_ICEINSTX8632_H | 1560 #endif // SUBZERO_SRC_ICEINSTX8632_H |
OLD | NEW |