Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Side by Side Diff: src/IceInstX8632.h

Issue 476323004: Start adding an integrated assembler. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: simplify Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
11 // their subclasses. This represents the machine instructions and 11 // their subclasses. This represents the machine instructions and
12 // operands used for x86-32 code selection. 12 // operands used for x86-32 code selection.
13 // 13 //
14 //===----------------------------------------------------------------------===// 14 //===----------------------------------------------------------------------===//
15 15
16 #ifndef SUBZERO_SRC_ICEINSTX8632_H 16 #ifndef SUBZERO_SRC_ICEINSTX8632_H
17 #define SUBZERO_SRC_ICEINSTX8632_H 17 #define SUBZERO_SRC_ICEINSTX8632_H
18 18
19 #include "assembler_ia32.h"
19 #include "IceDefs.h" 20 #include "IceDefs.h"
20 #include "IceInst.h" 21 #include "IceInst.h"
21 #include "IceInstX8632.def" 22 #include "IceInstX8632.def"
22 #include "IceOperand.h" 23 #include "IceOperand.h"
23 24
24 namespace Ice { 25 namespace Ice {
25 26
26 class TargetX8632; 27 class TargetX8632;
27 28
28 // OperandX8632 extends the Operand hierarchy. Its subclasses are 29 // OperandX8632 extends the Operand hierarchy. Its subclasses are
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 uint16_t Shift = 0, 65 uint16_t Shift = 0,
65 SegmentRegisters SegmentReg = DefaultSegment) { 66 SegmentRegisters SegmentReg = DefaultSegment) {
66 return new (Func->allocate<OperandX8632Mem>()) 67 return new (Func->allocate<OperandX8632Mem>())
67 OperandX8632Mem(Func, Ty, Base, Offset, Index, Shift, SegmentReg); 68 OperandX8632Mem(Func, Ty, Base, Offset, Index, Shift, SegmentReg);
68 } 69 }
69 Variable *getBase() const { return Base; } 70 Variable *getBase() const { return Base; }
70 Constant *getOffset() const { return Offset; } 71 Constant *getOffset() const { return Offset; }
71 Variable *getIndex() const { return Index; } 72 Variable *getIndex() const { return Index; }
72 uint16_t getShift() const { return Shift; } 73 uint16_t getShift() const { return Shift; }
73 SegmentRegisters getSegmentRegister() const { return SegmentReg; } 74 SegmentRegisters getSegmentRegister() const { return SegmentReg; }
75 x86::Address convertToAsmAddress(IceString &SymbolicOffset) const;
74 virtual void emit(const Cfg *Func) const; 76 virtual void emit(const Cfg *Func) const;
75 virtual void dump(const Cfg *Func) const; 77 virtual void dump(const Cfg *Func) const;
76 78
77 static bool classof(const Operand *Operand) { 79 static bool classof(const Operand *Operand) {
78 return Operand->getKind() == static_cast<OperandKind>(kMem); 80 return Operand->getKind() == static_cast<OperandKind>(kMem);
79 } 81 }
80 82
81 private: 83 private:
82 OperandX8632Mem(Cfg *Func, Type Ty, Variable *Base, Constant *Offset, 84 OperandX8632Mem(Cfg *Func, Type Ty, Variable *Base, Constant *Offset,
83 Variable *Index, uint16_t Shift, SegmentRegisters SegmentReg); 85 Variable *Index, uint16_t Shift, SegmentRegisters SegmentReg);
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 223
222 enum BrCond { 224 enum BrCond {
223 #define X(tag, dump, emit) tag, 225 #define X(tag, dump, emit) tag,
224 ICEINSTX8632BR_TABLE 226 ICEINSTX8632BR_TABLE
225 #undef X 227 #undef X
226 Br_None 228 Br_None
227 }; 229 };
228 230
229 static const char *getWidthString(Type Ty); 231 static const char *getWidthString(Type Ty);
230 virtual void emit(const Cfg *Func) const = 0; 232 virtual void emit(const Cfg *Func) const = 0;
233 virtual void emitIAS(const Cfg *Func) const;
231 virtual void dump(const Cfg *Func) const; 234 virtual void dump(const Cfg *Func) const;
232 235
233 protected: 236 protected:
234 InstX8632(Cfg *Func, InstKindX8632 Kind, SizeT Maxsrcs, Variable *Dest) 237 InstX8632(Cfg *Func, InstKindX8632 Kind, SizeT Maxsrcs, Variable *Dest)
235 : InstTarget(Func, static_cast<InstKind>(Kind), Maxsrcs, Dest) {} 238 : InstTarget(Func, static_cast<InstKind>(Kind), Maxsrcs, Dest) {}
236 virtual ~InstX8632() {} 239 virtual ~InstX8632() {}
237 static bool isClassof(const Inst *Inst, InstKindX8632 MyKind) { 240 static bool isClassof(const Inst *Inst, InstKindX8632 MyKind) {
238 return Inst->getKind() == static_cast<InstKind>(MyKind); 241 return Inst->getKind() == static_cast<InstKind>(MyKind);
239 } 242 }
240 243
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 368
366 // Call instruction. Arguments should have already been pushed. 369 // Call instruction. Arguments should have already been pushed.
367 class InstX8632Call : public InstX8632 { 370 class InstX8632Call : public InstX8632 {
368 public: 371 public:
369 static InstX8632Call *create(Cfg *Func, Variable *Dest, Operand *CallTarget) { 372 static InstX8632Call *create(Cfg *Func, Variable *Dest, Operand *CallTarget) {
370 return new (Func->allocate<InstX8632Call>()) 373 return new (Func->allocate<InstX8632Call>())
371 InstX8632Call(Func, Dest, CallTarget); 374 InstX8632Call(Func, Dest, CallTarget);
372 } 375 }
373 Operand *getCallTarget() const { return getSrc(0); } 376 Operand *getCallTarget() const { return getSrc(0); }
374 virtual void emit(const Cfg *Func) const; 377 virtual void emit(const Cfg *Func) const;
378 virtual void emitIAS(const Cfg *Func) const;
375 virtual void dump(const Cfg *Func) const; 379 virtual void dump(const Cfg *Func) const;
376 static bool classof(const Inst *Inst) { return isClassof(Inst, Call); } 380 static bool classof(const Inst *Inst) { return isClassof(Inst, Call); }
377 381
378 private: 382 private:
379 InstX8632Call(Cfg *Func, Variable *Dest, Operand *CallTarget); 383 InstX8632Call(Cfg *Func, Variable *Dest, Operand *CallTarget);
380 InstX8632Call(const InstX8632Call &) LLVM_DELETED_FUNCTION; 384 InstX8632Call(const InstX8632Call &) LLVM_DELETED_FUNCTION;
381 InstX8632Call &operator=(const InstX8632Call &) LLVM_DELETED_FUNCTION; 385 InstX8632Call &operator=(const InstX8632Call &) LLVM_DELETED_FUNCTION;
382 virtual ~InstX8632Call() {} 386 virtual ~InstX8632Call() {}
383 }; 387 };
384 388
385 // Instructions of the form x := op(x). 389 // Instructions of the form x := op(x).
386 template <InstX8632::InstKindX8632 K> 390 template <InstX8632::InstKindX8632 K>
387 class InstX8632Inplaceop : public InstX8632 { 391 class InstX8632Inplaceop : public InstX8632 {
388 public: 392 public:
389 static InstX8632Inplaceop *create(Cfg *Func, Operand *SrcDest) { 393 static InstX8632Inplaceop *create(Cfg *Func, Operand *SrcDest) {
390 return new (Func->allocate<InstX8632Inplaceop>()) 394 return new (Func->allocate<InstX8632Inplaceop>())
391 InstX8632Inplaceop(Func, SrcDest); 395 InstX8632Inplaceop(Func, SrcDest);
392 } 396 }
393 virtual void emit(const Cfg *Func) const { 397 virtual void emit(const Cfg *Func) const {
394 Ostream &Str = Func->getContext()->getStrEmit(); 398 Ostream &Str = Func->getContext()->getStrEmit();
395 assert(getSrcSize() == 1); 399 assert(getSrcSize() == 1);
396 Str << "\t" << Opcode << "\t"; 400 Str << "\t" << Opcode << "\t";
397 getSrc(0)->emit(Func); 401 getSrc(0)->emit(Func);
398 Str << "\n"; 402 Str << "\n";
399 } 403 }
404 virtual void emitIAS(const Cfg *Func) const { emit(Func); }
400 virtual void dump(const Cfg *Func) const { 405 virtual void dump(const Cfg *Func) const {
401 Ostream &Str = Func->getContext()->getStrDump(); 406 Ostream &Str = Func->getContext()->getStrDump();
402 dumpDest(Func); 407 dumpDest(Func);
403 Str << " = " << Opcode << "." << getDest()->getType() << " "; 408 Str << " = " << Opcode << "." << getDest()->getType() << " ";
404 dumpSources(Func); 409 dumpSources(Func);
405 } 410 }
406 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } 411 static bool classof(const Inst *Inst) { return isClassof(Inst, K); }
407 412
408 private: 413 private:
409 InstX8632Inplaceop(Cfg *Func, Operand *SrcDest) 414 InstX8632Inplaceop(Cfg *Func, Operand *SrcDest)
(...skipping 17 matching lines...) Expand all
427 } 432 }
428 virtual void emit(const Cfg *Func) const { 433 virtual void emit(const Cfg *Func) const {
429 Ostream &Str = Func->getContext()->getStrEmit(); 434 Ostream &Str = Func->getContext()->getStrEmit();
430 assert(getSrcSize() == 1); 435 assert(getSrcSize() == 1);
431 Str << "\t" << Opcode << "\t"; 436 Str << "\t" << Opcode << "\t";
432 getDest()->emit(Func); 437 getDest()->emit(Func);
433 Str << ", "; 438 Str << ", ";
434 getSrc(0)->emit(Func); 439 getSrc(0)->emit(Func);
435 Str << "\n"; 440 Str << "\n";
436 } 441 }
442 virtual void emitIAS(const Cfg *Func) const { emit(Func); }
437 virtual void dump(const Cfg *Func) const { 443 virtual void dump(const Cfg *Func) const {
438 Ostream &Str = Func->getContext()->getStrDump(); 444 Ostream &Str = Func->getContext()->getStrDump();
439 dumpDest(Func); 445 dumpDest(Func);
440 Str << " = " << Opcode << "." << getDest()->getType() << " "; 446 Str << " = " << Opcode << "." << getDest()->getType() << " ";
441 dumpSources(Func); 447 dumpSources(Func);
442 } 448 }
443 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } 449 static bool classof(const Inst *Inst) { return isClassof(Inst, K); }
444 450
445 private: 451 private:
446 InstX8632Unaryop(Cfg *Func, Variable *Dest, Operand *Src) 452 InstX8632Unaryop(Cfg *Func, Variable *Dest, Operand *Src)
(...skipping 15 matching lines...) Expand all
462 class InstX8632Binop : public InstX8632 { 468 class InstX8632Binop : public InstX8632 {
463 public: 469 public:
464 // Create an ordinary binary-op instruction like add or sub. 470 // Create an ordinary binary-op instruction like add or sub.
465 static InstX8632Binop *create(Cfg *Func, Variable *Dest, Operand *Source) { 471 static InstX8632Binop *create(Cfg *Func, Variable *Dest, Operand *Source) {
466 return new (Func->allocate<InstX8632Binop>()) 472 return new (Func->allocate<InstX8632Binop>())
467 InstX8632Binop(Func, Dest, Source); 473 InstX8632Binop(Func, Dest, Source);
468 } 474 }
469 virtual void emit(const Cfg *Func) const { 475 virtual void emit(const Cfg *Func) const {
470 emitTwoAddress(Opcode, this, Func, ShiftHack); 476 emitTwoAddress(Opcode, this, Func, ShiftHack);
471 } 477 }
478 virtual void emitIAS(const Cfg *Func) const { emit(Func); }
472 virtual void dump(const Cfg *Func) const { 479 virtual void dump(const Cfg *Func) const {
473 Ostream &Str = Func->getContext()->getStrDump(); 480 Ostream &Str = Func->getContext()->getStrDump();
474 dumpDest(Func); 481 dumpDest(Func);
475 Str << " = " << Opcode << "." << getDest()->getType() << " "; 482 Str << " = " << Opcode << "." << getDest()->getType() << " ";
476 dumpSources(Func); 483 dumpSources(Func);
477 } 484 }
478 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } 485 static bool classof(const Inst *Inst) { return isClassof(Inst, K); }
479 486
480 private: 487 private:
481 InstX8632Binop(Cfg *Func, Variable *Dest, Operand *Source) 488 InstX8632Binop(Cfg *Func, Variable *Dest, Operand *Source)
(...skipping 19 matching lines...) Expand all
501 Ostream &Str = Func->getContext()->getStrEmit(); 508 Ostream &Str = Func->getContext()->getStrEmit();
502 assert(getSrcSize() == 3); 509 assert(getSrcSize() == 3);
503 Str << "\t" << Opcode << "\t"; 510 Str << "\t" << Opcode << "\t";
504 getDest()->emit(Func); 511 getDest()->emit(Func);
505 Str << ", "; 512 Str << ", ";
506 getSrc(1)->emit(Func); 513 getSrc(1)->emit(Func);
507 Str << ", "; 514 Str << ", ";
508 getSrc(2)->emit(Func); 515 getSrc(2)->emit(Func);
509 Str << "\n"; 516 Str << "\n";
510 } 517 }
518 virtual void emitIAS(const Cfg *Func) const { emit(Func); }
511 virtual void dump(const Cfg *Func) const { 519 virtual void dump(const Cfg *Func) const {
512 Ostream &Str = Func->getContext()->getStrDump(); 520 Ostream &Str = Func->getContext()->getStrDump();
513 dumpDest(Func); 521 dumpDest(Func);
514 Str << " = " << Opcode << "." << getDest()->getType() << " "; 522 Str << " = " << Opcode << "." << getDest()->getType() << " ";
515 dumpSources(Func); 523 dumpSources(Func);
516 } 524 }
517 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } 525 static bool classof(const Inst *Inst) { return isClassof(Inst, K); }
518 526
519 private: 527 private:
520 InstX8632Ternop(Cfg *Func, Variable *Dest, Operand *Source1, Operand *Source2) 528 InstX8632Ternop(Cfg *Func, Variable *Dest, Operand *Source1, Operand *Source2)
(...skipping 21 matching lines...) Expand all
542 Ostream &Str = Func->getContext()->getStrEmit(); 550 Ostream &Str = Func->getContext()->getStrEmit();
543 assert(getSrcSize() == 2); 551 assert(getSrcSize() == 2);
544 Str << "\t" << Opcode << "\t"; 552 Str << "\t" << Opcode << "\t";
545 getDest()->emit(Func); 553 getDest()->emit(Func);
546 Str << ", "; 554 Str << ", ";
547 getSrc(0)->emit(Func); 555 getSrc(0)->emit(Func);
548 Str << ", "; 556 Str << ", ";
549 getSrc(1)->emit(Func); 557 getSrc(1)->emit(Func);
550 Str << "\n"; 558 Str << "\n";
551 } 559 }
560 virtual void emitIAS(const Cfg *Func) const { emit(Func); }
552 virtual void dump(const Cfg *Func) const { 561 virtual void dump(const Cfg *Func) const {
553 Ostream &Str = Func->getContext()->getStrDump(); 562 Ostream &Str = Func->getContext()->getStrDump();
554 dumpDest(Func); 563 dumpDest(Func);
555 Str << " = " << Opcode << "." << getDest()->getType() << " "; 564 Str << " = " << Opcode << "." << getDest()->getType() << " ";
556 dumpSources(Func); 565 dumpSources(Func);
557 } 566 }
558 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } 567 static bool classof(const Inst *Inst) { return isClassof(Inst, K); }
559 568
560 private: 569 private:
561 InstX8632ThreeAddressop(Cfg *Func, Variable *Dest, Operand *Source0, 570 InstX8632ThreeAddressop(Cfg *Func, Variable *Dest, Operand *Source0,
(...skipping 17 matching lines...) Expand all
579 class InstX8632Movlike : public InstX8632 { 588 class InstX8632Movlike : public InstX8632 {
580 public: 589 public:
581 static InstX8632Movlike *create(Cfg *Func, Variable *Dest, Operand *Source) { 590 static InstX8632Movlike *create(Cfg *Func, Variable *Dest, Operand *Source) {
582 return new (Func->allocate<InstX8632Movlike>()) 591 return new (Func->allocate<InstX8632Movlike>())
583 InstX8632Movlike(Func, Dest, Source); 592 InstX8632Movlike(Func, Dest, Source);
584 } 593 }
585 virtual bool isRedundantAssign() const { 594 virtual bool isRedundantAssign() const {
586 return checkForRedundantAssign(getDest(), getSrc(0)); 595 return checkForRedundantAssign(getDest(), getSrc(0));
587 } 596 }
588 virtual void emit(const Cfg *Func) const; 597 virtual void emit(const Cfg *Func) const;
598 virtual void emitIAS(const Cfg *Func) const { emit(Func); }
589 virtual void dump(const Cfg *Func) const { 599 virtual void dump(const Cfg *Func) const {
590 Ostream &Str = Func->getContext()->getStrDump(); 600 Ostream &Str = Func->getContext()->getStrDump();
591 Str << Opcode << "." << getDest()->getType() << " "; 601 Str << Opcode << "." << getDest()->getType() << " ";
592 dumpDest(Func); 602 dumpDest(Func);
593 Str << ", "; 603 Str << ", ";
594 dumpSources(Func); 604 dumpSources(Func);
595 } 605 }
596 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } 606 static bool classof(const Inst *Inst) { return isClassof(Inst, K); }
597 607
598 private: 608 private:
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 768
759 // Conditional move instruction. 769 // Conditional move instruction.
760 class InstX8632Cmov : public InstX8632 { 770 class InstX8632Cmov : public InstX8632 {
761 public: 771 public:
762 static InstX8632Cmov *create(Cfg *Func, Variable *Dest, Operand *Source, 772 static InstX8632Cmov *create(Cfg *Func, Variable *Dest, Operand *Source,
763 BrCond Cond) { 773 BrCond Cond) {
764 return new (Func->allocate<InstX8632Cmov>()) 774 return new (Func->allocate<InstX8632Cmov>())
765 InstX8632Cmov(Func, Dest, Source, Cond); 775 InstX8632Cmov(Func, Dest, Source, Cond);
766 } 776 }
767 virtual void emit(const Cfg *Func) const; 777 virtual void emit(const Cfg *Func) const;
778 virtual void emitIAS(const Cfg *Func) const;
768 virtual void dump(const Cfg *Func) const; 779 virtual void dump(const Cfg *Func) const;
769 static bool classof(const Inst *Inst) { return isClassof(Inst, Cmov); } 780 static bool classof(const Inst *Inst) { return isClassof(Inst, Cmov); }
770 781
771 private: 782 private:
772 InstX8632Cmov(Cfg *Func, Variable *Dest, Operand *Source, BrCond Cond); 783 InstX8632Cmov(Cfg *Func, Variable *Dest, Operand *Source, BrCond Cond);
773 InstX8632Cmov(const InstX8632Cmov &) LLVM_DELETED_FUNCTION; 784 InstX8632Cmov(const InstX8632Cmov &) LLVM_DELETED_FUNCTION;
774 InstX8632Cmov &operator=(const InstX8632Cmov &) LLVM_DELETED_FUNCTION; 785 InstX8632Cmov &operator=(const InstX8632Cmov &) LLVM_DELETED_FUNCTION;
775 virtual ~InstX8632Cmov() {} 786 virtual ~InstX8632Cmov() {}
776 787
777 BrCond Condition; 788 BrCond Condition;
778 }; 789 };
779 790
780 // Cmpps instruction - compare packed singled-precision floating point 791 // Cmpps instruction - compare packed singled-precision floating point
781 // values 792 // values
782 class InstX8632Cmpps : public InstX8632 { 793 class InstX8632Cmpps : public InstX8632 {
783 public: 794 public:
784 enum CmppsCond { 795 enum CmppsCond {
785 #define X(tag, emit) tag, 796 #define X(tag, emit) tag,
786 ICEINSTX8632CMPPS_TABLE 797 ICEINSTX8632CMPPS_TABLE
787 #undef X 798 #undef X
788 Cmpps_Invalid 799 Cmpps_Invalid
789 }; 800 };
790 801
791 static InstX8632Cmpps *create(Cfg *Func, Variable *Dest, Operand *Source, 802 static InstX8632Cmpps *create(Cfg *Func, Variable *Dest, Operand *Source,
792 CmppsCond Condition) { 803 CmppsCond Condition) {
793 return new (Func->allocate<InstX8632Cmpps>()) 804 return new (Func->allocate<InstX8632Cmpps>())
794 InstX8632Cmpps(Func, Dest, Source, Condition); 805 InstX8632Cmpps(Func, Dest, Source, Condition);
795 } 806 }
796 virtual void emit(const Cfg *Func) const; 807 virtual void emit(const Cfg *Func) const;
808 virtual void emitIAS(const Cfg *Func) const;
797 virtual void dump(const Cfg *Func) const; 809 virtual void dump(const Cfg *Func) const;
798 static bool classof(const Inst *Inst) { return isClassof(Inst, Cmpps); } 810 static bool classof(const Inst *Inst) { return isClassof(Inst, Cmpps); }
799 811
800 private: 812 private:
801 InstX8632Cmpps(Cfg *Func, Variable *Dest, Operand *Source, CmppsCond Cond); 813 InstX8632Cmpps(Cfg *Func, Variable *Dest, Operand *Source, CmppsCond Cond);
802 InstX8632Cmpps(const InstX8632Cmpps &) LLVM_DELETED_FUNCTION; 814 InstX8632Cmpps(const InstX8632Cmpps &) LLVM_DELETED_FUNCTION;
803 InstX8632Cmpps &operator=(const InstX8632Cmpps &) LLVM_DELETED_FUNCTION; 815 InstX8632Cmpps &operator=(const InstX8632Cmpps &) LLVM_DELETED_FUNCTION;
804 virtual ~InstX8632Cmpps() {} 816 virtual ~InstX8632Cmpps() {}
805 817
806 CmppsCond Condition; 818 CmppsCond Condition;
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
1025 1037
1026 // Movsx - copy from a narrower integer type to a wider integer 1038 // Movsx - copy from a narrower integer type to a wider integer
1027 // type, with sign extension. 1039 // type, with sign extension.
1028 class InstX8632Movsx : public InstX8632 { 1040 class InstX8632Movsx : public InstX8632 {
1029 public: 1041 public:
1030 static InstX8632Movsx *create(Cfg *Func, Variable *Dest, Operand *Source) { 1042 static InstX8632Movsx *create(Cfg *Func, Variable *Dest, Operand *Source) {
1031 return new (Func->allocate<InstX8632Movsx>()) 1043 return new (Func->allocate<InstX8632Movsx>())
1032 InstX8632Movsx(Func, Dest, Source); 1044 InstX8632Movsx(Func, Dest, Source);
1033 } 1045 }
1034 virtual void emit(const Cfg *Func) const; 1046 virtual void emit(const Cfg *Func) const;
1047 virtual void emitIAS(const Cfg *Func) const;
1035 virtual void dump(const Cfg *Func) const; 1048 virtual void dump(const Cfg *Func) const;
1036 static bool classof(const Inst *Inst) { return isClassof(Inst, Movsx); } 1049 static bool classof(const Inst *Inst) { return isClassof(Inst, Movsx); }
1037 1050
1038 private: 1051 private:
1039 InstX8632Movsx(Cfg *Func, Variable *Dest, Operand *Source); 1052 InstX8632Movsx(Cfg *Func, Variable *Dest, Operand *Source);
1040 InstX8632Movsx(const InstX8632Movsx &) LLVM_DELETED_FUNCTION; 1053 InstX8632Movsx(const InstX8632Movsx &) LLVM_DELETED_FUNCTION;
1041 InstX8632Movsx &operator=(const InstX8632Movsx &) LLVM_DELETED_FUNCTION; 1054 InstX8632Movsx &operator=(const InstX8632Movsx &) LLVM_DELETED_FUNCTION;
1042 virtual ~InstX8632Movsx() {} 1055 virtual ~InstX8632Movsx() {}
1043 }; 1056 };
1044 1057
1045 // Movsx - copy from a narrower integer type to a wider integer 1058 // Movsx - copy from a narrower integer type to a wider integer
1046 // type, with zero extension. 1059 // type, with zero extension.
1047 class InstX8632Movzx : public InstX8632 { 1060 class InstX8632Movzx : public InstX8632 {
1048 public: 1061 public:
1049 static InstX8632Movzx *create(Cfg *Func, Variable *Dest, Operand *Source) { 1062 static InstX8632Movzx *create(Cfg *Func, Variable *Dest, Operand *Source) {
1050 return new (Func->allocate<InstX8632Movzx>()) 1063 return new (Func->allocate<InstX8632Movzx>())
1051 InstX8632Movzx(Func, Dest, Source); 1064 InstX8632Movzx(Func, Dest, Source);
1052 } 1065 }
1053 virtual void emit(const Cfg *Func) const; 1066 virtual void emit(const Cfg *Func) const;
1067 virtual void emitIAS(const Cfg *Func) const;
1054 virtual void dump(const Cfg *Func) const; 1068 virtual void dump(const Cfg *Func) const;
1055 static bool classof(const Inst *Inst) { return isClassof(Inst, Movzx); } 1069 static bool classof(const Inst *Inst) { return isClassof(Inst, Movzx); }
1056 1070
1057 private: 1071 private:
1058 InstX8632Movzx(Cfg *Func, Variable *Dest, Operand *Source); 1072 InstX8632Movzx(Cfg *Func, Variable *Dest, Operand *Source);
1059 InstX8632Movzx(const InstX8632Movzx &) LLVM_DELETED_FUNCTION; 1073 InstX8632Movzx(const InstX8632Movzx &) LLVM_DELETED_FUNCTION;
1060 InstX8632Movzx &operator=(const InstX8632Movzx &) LLVM_DELETED_FUNCTION; 1074 InstX8632Movzx &operator=(const InstX8632Movzx &) LLVM_DELETED_FUNCTION;
1061 virtual ~InstX8632Movzx() {} 1075 virtual ~InstX8632Movzx() {}
1062 }; 1076 };
1063 1077
1064 // Nop instructions of varying length 1078 // Nop instructions of varying length
1065 class InstX8632Nop : public InstX8632 { 1079 class InstX8632Nop : public InstX8632 {
1066 public: 1080 public:
1067 // TODO: Replace with enum. 1081 // TODO: Replace with enum.
1068 typedef unsigned NopVariant; 1082 typedef unsigned NopVariant;
1069 1083
1070 static InstX8632Nop *create(Cfg *Func, NopVariant Variant) { 1084 static InstX8632Nop *create(Cfg *Func, NopVariant Variant) {
1071 return new (Func->allocate<InstX8632Nop>()) InstX8632Nop(Func, Variant); 1085 return new (Func->allocate<InstX8632Nop>()) InstX8632Nop(Func, Variant);
1072 } 1086 }
1073 virtual void emit(const Cfg *Func) const; 1087 virtual void emit(const Cfg *Func) const;
1088 virtual void emitIAS(const Cfg *Func) const;
1074 virtual void dump(const Cfg *Func) const; 1089 virtual void dump(const Cfg *Func) const;
1075 static bool classof(const Inst *Inst) { return isClassof(Inst, Nop); } 1090 static bool classof(const Inst *Inst) { return isClassof(Inst, Nop); }
1076 1091
1077 private: 1092 private:
1078 InstX8632Nop(Cfg *Func, SizeT Length); 1093 InstX8632Nop(Cfg *Func, SizeT Length);
1079 InstX8632Nop(const InstX8632Nop &) LLVM_DELETED_FUNCTION; 1094 InstX8632Nop(const InstX8632Nop &) LLVM_DELETED_FUNCTION;
1080 InstX8632Nop &operator=(const InstX8632Nop &) LLVM_DELETED_FUNCTION; 1095 InstX8632Nop &operator=(const InstX8632Nop &) LLVM_DELETED_FUNCTION;
1081 virtual ~InstX8632Nop() {} 1096 virtual ~InstX8632Nop() {}
1082 1097
1083 NopVariant Variant; 1098 NopVariant Variant;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1116 InstX8632Fstp &operator=(const InstX8632Fstp &) LLVM_DELETED_FUNCTION; 1131 InstX8632Fstp &operator=(const InstX8632Fstp &) LLVM_DELETED_FUNCTION;
1117 virtual ~InstX8632Fstp() {} 1132 virtual ~InstX8632Fstp() {}
1118 }; 1133 };
1119 1134
1120 class InstX8632Pop : public InstX8632 { 1135 class InstX8632Pop : public InstX8632 {
1121 public: 1136 public:
1122 static InstX8632Pop *create(Cfg *Func, Variable *Dest) { 1137 static InstX8632Pop *create(Cfg *Func, Variable *Dest) {
1123 return new (Func->allocate<InstX8632Pop>()) InstX8632Pop(Func, Dest); 1138 return new (Func->allocate<InstX8632Pop>()) InstX8632Pop(Func, Dest);
1124 } 1139 }
1125 virtual void emit(const Cfg *Func) const; 1140 virtual void emit(const Cfg *Func) const;
1141 virtual void emitIAS(const Cfg *Func) const;
1126 virtual void dump(const Cfg *Func) const; 1142 virtual void dump(const Cfg *Func) const;
1127 static bool classof(const Inst *Inst) { return isClassof(Inst, Pop); } 1143 static bool classof(const Inst *Inst) { return isClassof(Inst, Pop); }
1128 1144
1129 private: 1145 private:
1130 InstX8632Pop(Cfg *Func, Variable *Dest); 1146 InstX8632Pop(Cfg *Func, Variable *Dest);
1131 InstX8632Pop(const InstX8632Pop &) LLVM_DELETED_FUNCTION; 1147 InstX8632Pop(const InstX8632Pop &) LLVM_DELETED_FUNCTION;
1132 InstX8632Pop &operator=(const InstX8632Pop &) LLVM_DELETED_FUNCTION; 1148 InstX8632Pop &operator=(const InstX8632Pop &) LLVM_DELETED_FUNCTION;
1133 virtual ~InstX8632Pop() {} 1149 virtual ~InstX8632Pop() {}
1134 }; 1150 };
1135 1151
(...skipping 19 matching lines...) Expand all
1155 // Ret instruction. Currently only supports the "ret" version that 1171 // Ret instruction. Currently only supports the "ret" version that
1156 // does not pop arguments. This instruction takes a Source operand 1172 // does not pop arguments. This instruction takes a Source operand
1157 // (for non-void returning functions) for liveness analysis, though 1173 // (for non-void returning functions) for liveness analysis, though
1158 // a FakeUse before the ret would do just as well. 1174 // a FakeUse before the ret would do just as well.
1159 class InstX8632Ret : public InstX8632 { 1175 class InstX8632Ret : public InstX8632 {
1160 public: 1176 public:
1161 static InstX8632Ret *create(Cfg *Func, Variable *Source = NULL) { 1177 static InstX8632Ret *create(Cfg *Func, Variable *Source = NULL) {
1162 return new (Func->allocate<InstX8632Ret>()) InstX8632Ret(Func, Source); 1178 return new (Func->allocate<InstX8632Ret>()) InstX8632Ret(Func, Source);
1163 } 1179 }
1164 virtual void emit(const Cfg *Func) const; 1180 virtual void emit(const Cfg *Func) const;
1181 virtual void emitIAS(const Cfg *Func) const;
1165 virtual void dump(const Cfg *Func) const; 1182 virtual void dump(const Cfg *Func) const;
1166 static bool classof(const Inst *Inst) { return isClassof(Inst, Ret); } 1183 static bool classof(const Inst *Inst) { return isClassof(Inst, Ret); }
1167 1184
1168 private: 1185 private:
1169 InstX8632Ret(Cfg *Func, Variable *Source); 1186 InstX8632Ret(Cfg *Func, Variable *Source);
1170 InstX8632Ret(const InstX8632Ret &) LLVM_DELETED_FUNCTION; 1187 InstX8632Ret(const InstX8632Ret &) LLVM_DELETED_FUNCTION;
1171 InstX8632Ret &operator=(const InstX8632Ret &) LLVM_DELETED_FUNCTION; 1188 InstX8632Ret &operator=(const InstX8632Ret &) LLVM_DELETED_FUNCTION;
1172 virtual ~InstX8632Ret() {} 1189 virtual ~InstX8632Ret() {}
1173 }; 1190 };
1174 1191
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1239 template <> void InstX8632Pextr::emit(const Cfg *Func) const; 1256 template <> void InstX8632Pextr::emit(const Cfg *Func) const;
1240 template <> void InstX8632Pinsr::emit(const Cfg *Func) const; 1257 template <> void InstX8632Pinsr::emit(const Cfg *Func) const;
1241 template <> void InstX8632Pmull::emit(const Cfg *Func) const; 1258 template <> void InstX8632Pmull::emit(const Cfg *Func) const;
1242 template <> void InstX8632Pmuludq::emit(const Cfg *Func) const; 1259 template <> void InstX8632Pmuludq::emit(const Cfg *Func) const;
1243 template <> void InstX8632Psll::emit(const Cfg *Func) const; 1260 template <> void InstX8632Psll::emit(const Cfg *Func) const;
1244 template <> void InstX8632Psra::emit(const Cfg *Func) const; 1261 template <> void InstX8632Psra::emit(const Cfg *Func) const;
1245 template <> void InstX8632Psub::emit(const Cfg *Func) const; 1262 template <> void InstX8632Psub::emit(const Cfg *Func) const;
1246 template <> void InstX8632Sqrtss::emit(const Cfg *Func) const; 1263 template <> void InstX8632Sqrtss::emit(const Cfg *Func) const;
1247 template <> void InstX8632Subss::emit(const Cfg *Func) const; 1264 template <> void InstX8632Subss::emit(const Cfg *Func) const;
1248 1265
1266 // Same with emitIAS() methods.
1267 template <> void InstX8632Addps::emitIAS(const Cfg *Func) const;
1268 template <> void InstX8632Addss::emitIAS(const Cfg *Func) const;
1269 template <> void InstX8632Cbwdq::emitIAS(const Cfg *Func) const;
1270 template <> void InstX8632Divps::emitIAS(const Cfg *Func) const;
1271 template <> void InstX8632Divss::emitIAS(const Cfg *Func) const;
1272 template <> void InstX8632Mulps::emitIAS(const Cfg *Func) const;
1273 template <> void InstX8632Mulss::emitIAS(const Cfg *Func) const;
1274 template <> void InstX8632Sqrtss::emitIAS(const Cfg *Func) const;
1275 template <> void InstX8632Subps::emitIAS(const Cfg *Func) const;
1276 template <> void InstX8632Subss::emitIAS(const Cfg *Func) const;
1277
1249 } // end of namespace Ice 1278 } // end of namespace Ice
1250 1279
1251 #endif // SUBZERO_SRC_ICEINSTX8632_H 1280 #endif // SUBZERO_SRC_ICEINSTX8632_H
OLDNEW
« no previous file with comments | « src/IceInst.cpp ('k') | src/IceInstX8632.cpp » ('j') | src/IceUtils.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698