| 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 |
| 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 Loading... |
| 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 Loading... |
| 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 Loading... |
| 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 Loading... |
| 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 Loading... |
| 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 Loading... |
| 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 Loading... |
| 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 Loading... |
| 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 Loading... |
| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 881 }; | 893 }; |
| 882 | 894 |
| 883 // cmp - Integer compare instruction. | 895 // cmp - Integer compare instruction. |
| 884 class InstX8632Icmp : public InstX8632 { | 896 class InstX8632Icmp : public InstX8632 { |
| 885 public: | 897 public: |
| 886 static InstX8632Icmp *create(Cfg *Func, Operand *Src1, Operand *Src2) { | 898 static InstX8632Icmp *create(Cfg *Func, Operand *Src1, Operand *Src2) { |
| 887 return new (Func->allocate<InstX8632Icmp>()) | 899 return new (Func->allocate<InstX8632Icmp>()) |
| 888 InstX8632Icmp(Func, Src1, Src2); | 900 InstX8632Icmp(Func, Src1, Src2); |
| 889 } | 901 } |
| 890 virtual void emit(const Cfg *Func) const; | 902 virtual void emit(const Cfg *Func) const; |
| 903 virtual void emitIAS(const Cfg *Func) const; |
| 891 virtual void dump(const Cfg *Func) const; | 904 virtual void dump(const Cfg *Func) const; |
| 892 static bool classof(const Inst *Inst) { return isClassof(Inst, Icmp); } | 905 static bool classof(const Inst *Inst) { return isClassof(Inst, Icmp); } |
| 893 | 906 |
| 894 private: | 907 private: |
| 895 InstX8632Icmp(Cfg *Func, Operand *Src1, Operand *Src2); | 908 InstX8632Icmp(Cfg *Func, Operand *Src1, Operand *Src2); |
| 896 InstX8632Icmp(const InstX8632Icmp &) LLVM_DELETED_FUNCTION; | 909 InstX8632Icmp(const InstX8632Icmp &) LLVM_DELETED_FUNCTION; |
| 897 InstX8632Icmp &operator=(const InstX8632Icmp &) LLVM_DELETED_FUNCTION; | 910 InstX8632Icmp &operator=(const InstX8632Icmp &) LLVM_DELETED_FUNCTION; |
| 898 virtual ~InstX8632Icmp() {} | 911 virtual ~InstX8632Icmp() {} |
| 899 }; | 912 }; |
| 900 | 913 |
| 901 // ucomiss/ucomisd - floating-point compare instruction. | 914 // ucomiss/ucomisd - floating-point compare instruction. |
| 902 class InstX8632Ucomiss : public InstX8632 { | 915 class InstX8632Ucomiss : public InstX8632 { |
| 903 public: | 916 public: |
| 904 static InstX8632Ucomiss *create(Cfg *Func, Operand *Src1, Operand *Src2) { | 917 static InstX8632Ucomiss *create(Cfg *Func, Operand *Src1, Operand *Src2) { |
| 905 return new (Func->allocate<InstX8632Ucomiss>()) | 918 return new (Func->allocate<InstX8632Ucomiss>()) |
| 906 InstX8632Ucomiss(Func, Src1, Src2); | 919 InstX8632Ucomiss(Func, Src1, Src2); |
| 907 } | 920 } |
| 908 virtual void emit(const Cfg *Func) const; | 921 virtual void emit(const Cfg *Func) const; |
| 922 virtual void emitIAS(const Cfg *Func) const; |
| 909 virtual void dump(const Cfg *Func) const; | 923 virtual void dump(const Cfg *Func) const; |
| 910 static bool classof(const Inst *Inst) { return isClassof(Inst, Ucomiss); } | 924 static bool classof(const Inst *Inst) { return isClassof(Inst, Ucomiss); } |
| 911 | 925 |
| 912 private: | 926 private: |
| 913 InstX8632Ucomiss(Cfg *Func, Operand *Src1, Operand *Src2); | 927 InstX8632Ucomiss(Cfg *Func, Operand *Src1, Operand *Src2); |
| 914 InstX8632Ucomiss(const InstX8632Ucomiss &) LLVM_DELETED_FUNCTION; | 928 InstX8632Ucomiss(const InstX8632Ucomiss &) LLVM_DELETED_FUNCTION; |
| 915 InstX8632Ucomiss &operator=(const InstX8632Ucomiss &) LLVM_DELETED_FUNCTION; | 929 InstX8632Ucomiss &operator=(const InstX8632Ucomiss &) LLVM_DELETED_FUNCTION; |
| 916 virtual ~InstX8632Ucomiss() {} | 930 virtual ~InstX8632Ucomiss() {} |
| 917 }; | 931 }; |
| 918 | 932 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1027 | 1041 |
| 1028 // Movsx - copy from a narrower integer type to a wider integer | 1042 // Movsx - copy from a narrower integer type to a wider integer |
| 1029 // type, with sign extension. | 1043 // type, with sign extension. |
| 1030 class InstX8632Movsx : public InstX8632 { | 1044 class InstX8632Movsx : public InstX8632 { |
| 1031 public: | 1045 public: |
| 1032 static InstX8632Movsx *create(Cfg *Func, Variable *Dest, Operand *Source) { | 1046 static InstX8632Movsx *create(Cfg *Func, Variable *Dest, Operand *Source) { |
| 1033 return new (Func->allocate<InstX8632Movsx>()) | 1047 return new (Func->allocate<InstX8632Movsx>()) |
| 1034 InstX8632Movsx(Func, Dest, Source); | 1048 InstX8632Movsx(Func, Dest, Source); |
| 1035 } | 1049 } |
| 1036 virtual void emit(const Cfg *Func) const; | 1050 virtual void emit(const Cfg *Func) const; |
| 1051 virtual void emitIAS(const Cfg *Func) const; |
| 1037 virtual void dump(const Cfg *Func) const; | 1052 virtual void dump(const Cfg *Func) const; |
| 1038 static bool classof(const Inst *Inst) { return isClassof(Inst, Movsx); } | 1053 static bool classof(const Inst *Inst) { return isClassof(Inst, Movsx); } |
| 1039 | 1054 |
| 1040 private: | 1055 private: |
| 1041 InstX8632Movsx(Cfg *Func, Variable *Dest, Operand *Source); | 1056 InstX8632Movsx(Cfg *Func, Variable *Dest, Operand *Source); |
| 1042 InstX8632Movsx(const InstX8632Movsx &) LLVM_DELETED_FUNCTION; | 1057 InstX8632Movsx(const InstX8632Movsx &) LLVM_DELETED_FUNCTION; |
| 1043 InstX8632Movsx &operator=(const InstX8632Movsx &) LLVM_DELETED_FUNCTION; | 1058 InstX8632Movsx &operator=(const InstX8632Movsx &) LLVM_DELETED_FUNCTION; |
| 1044 virtual ~InstX8632Movsx() {} | 1059 virtual ~InstX8632Movsx() {} |
| 1045 }; | 1060 }; |
| 1046 | 1061 |
| 1047 // Movsx - copy from a narrower integer type to a wider integer | 1062 // Movsx - copy from a narrower integer type to a wider integer |
| 1048 // type, with zero extension. | 1063 // type, with zero extension. |
| 1049 class InstX8632Movzx : public InstX8632 { | 1064 class InstX8632Movzx : public InstX8632 { |
| 1050 public: | 1065 public: |
| 1051 static InstX8632Movzx *create(Cfg *Func, Variable *Dest, Operand *Source) { | 1066 static InstX8632Movzx *create(Cfg *Func, Variable *Dest, Operand *Source) { |
| 1052 return new (Func->allocate<InstX8632Movzx>()) | 1067 return new (Func->allocate<InstX8632Movzx>()) |
| 1053 InstX8632Movzx(Func, Dest, Source); | 1068 InstX8632Movzx(Func, Dest, Source); |
| 1054 } | 1069 } |
| 1055 virtual void emit(const Cfg *Func) const; | 1070 virtual void emit(const Cfg *Func) const; |
| 1071 virtual void emitIAS(const Cfg *Func) const; |
| 1056 virtual void dump(const Cfg *Func) const; | 1072 virtual void dump(const Cfg *Func) const; |
| 1057 static bool classof(const Inst *Inst) { return isClassof(Inst, Movzx); } | 1073 static bool classof(const Inst *Inst) { return isClassof(Inst, Movzx); } |
| 1058 | 1074 |
| 1059 private: | 1075 private: |
| 1060 InstX8632Movzx(Cfg *Func, Variable *Dest, Operand *Source); | 1076 InstX8632Movzx(Cfg *Func, Variable *Dest, Operand *Source); |
| 1061 InstX8632Movzx(const InstX8632Movzx &) LLVM_DELETED_FUNCTION; | 1077 InstX8632Movzx(const InstX8632Movzx &) LLVM_DELETED_FUNCTION; |
| 1062 InstX8632Movzx &operator=(const InstX8632Movzx &) LLVM_DELETED_FUNCTION; | 1078 InstX8632Movzx &operator=(const InstX8632Movzx &) LLVM_DELETED_FUNCTION; |
| 1063 virtual ~InstX8632Movzx() {} | 1079 virtual ~InstX8632Movzx() {} |
| 1064 }; | 1080 }; |
| 1065 | 1081 |
| 1066 // Nop instructions of varying length | 1082 // Nop instructions of varying length |
| 1067 class InstX8632Nop : public InstX8632 { | 1083 class InstX8632Nop : public InstX8632 { |
| 1068 public: | 1084 public: |
| 1069 // TODO: Replace with enum. | 1085 // TODO: Replace with enum. |
| 1070 typedef unsigned NopVariant; | 1086 typedef unsigned NopVariant; |
| 1071 | 1087 |
| 1072 static InstX8632Nop *create(Cfg *Func, NopVariant Variant) { | 1088 static InstX8632Nop *create(Cfg *Func, NopVariant Variant) { |
| 1073 return new (Func->allocate<InstX8632Nop>()) InstX8632Nop(Func, Variant); | 1089 return new (Func->allocate<InstX8632Nop>()) InstX8632Nop(Func, Variant); |
| 1074 } | 1090 } |
| 1075 virtual void emit(const Cfg *Func) const; | 1091 virtual void emit(const Cfg *Func) const; |
| 1092 virtual void emitIAS(const Cfg *Func) const; |
| 1076 virtual void dump(const Cfg *Func) const; | 1093 virtual void dump(const Cfg *Func) const; |
| 1077 static bool classof(const Inst *Inst) { return isClassof(Inst, Nop); } | 1094 static bool classof(const Inst *Inst) { return isClassof(Inst, Nop); } |
| 1078 | 1095 |
| 1079 private: | 1096 private: |
| 1080 InstX8632Nop(Cfg *Func, SizeT Length); | 1097 InstX8632Nop(Cfg *Func, SizeT Length); |
| 1081 InstX8632Nop(const InstX8632Nop &) LLVM_DELETED_FUNCTION; | 1098 InstX8632Nop(const InstX8632Nop &) LLVM_DELETED_FUNCTION; |
| 1082 InstX8632Nop &operator=(const InstX8632Nop &) LLVM_DELETED_FUNCTION; | 1099 InstX8632Nop &operator=(const InstX8632Nop &) LLVM_DELETED_FUNCTION; |
| 1083 virtual ~InstX8632Nop() {} | 1100 virtual ~InstX8632Nop() {} |
| 1084 | 1101 |
| 1085 NopVariant Variant; | 1102 NopVariant Variant; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1118 InstX8632Fstp &operator=(const InstX8632Fstp &) LLVM_DELETED_FUNCTION; | 1135 InstX8632Fstp &operator=(const InstX8632Fstp &) LLVM_DELETED_FUNCTION; |
| 1119 virtual ~InstX8632Fstp() {} | 1136 virtual ~InstX8632Fstp() {} |
| 1120 }; | 1137 }; |
| 1121 | 1138 |
| 1122 class InstX8632Pop : public InstX8632 { | 1139 class InstX8632Pop : public InstX8632 { |
| 1123 public: | 1140 public: |
| 1124 static InstX8632Pop *create(Cfg *Func, Variable *Dest) { | 1141 static InstX8632Pop *create(Cfg *Func, Variable *Dest) { |
| 1125 return new (Func->allocate<InstX8632Pop>()) InstX8632Pop(Func, Dest); | 1142 return new (Func->allocate<InstX8632Pop>()) InstX8632Pop(Func, Dest); |
| 1126 } | 1143 } |
| 1127 virtual void emit(const Cfg *Func) const; | 1144 virtual void emit(const Cfg *Func) const; |
| 1145 virtual void emitIAS(const Cfg *Func) const; |
| 1128 virtual void dump(const Cfg *Func) const; | 1146 virtual void dump(const Cfg *Func) const; |
| 1129 static bool classof(const Inst *Inst) { return isClassof(Inst, Pop); } | 1147 static bool classof(const Inst *Inst) { return isClassof(Inst, Pop); } |
| 1130 | 1148 |
| 1131 private: | 1149 private: |
| 1132 InstX8632Pop(Cfg *Func, Variable *Dest); | 1150 InstX8632Pop(Cfg *Func, Variable *Dest); |
| 1133 InstX8632Pop(const InstX8632Pop &) LLVM_DELETED_FUNCTION; | 1151 InstX8632Pop(const InstX8632Pop &) LLVM_DELETED_FUNCTION; |
| 1134 InstX8632Pop &operator=(const InstX8632Pop &) LLVM_DELETED_FUNCTION; | 1152 InstX8632Pop &operator=(const InstX8632Pop &) LLVM_DELETED_FUNCTION; |
| 1135 virtual ~InstX8632Pop() {} | 1153 virtual ~InstX8632Pop() {} |
| 1136 }; | 1154 }; |
| 1137 | 1155 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1157 // Ret instruction. Currently only supports the "ret" version that | 1175 // Ret instruction. Currently only supports the "ret" version that |
| 1158 // does not pop arguments. This instruction takes a Source operand | 1176 // does not pop arguments. This instruction takes a Source operand |
| 1159 // (for non-void returning functions) for liveness analysis, though | 1177 // (for non-void returning functions) for liveness analysis, though |
| 1160 // a FakeUse before the ret would do just as well. | 1178 // a FakeUse before the ret would do just as well. |
| 1161 class InstX8632Ret : public InstX8632 { | 1179 class InstX8632Ret : public InstX8632 { |
| 1162 public: | 1180 public: |
| 1163 static InstX8632Ret *create(Cfg *Func, Variable *Source = NULL) { | 1181 static InstX8632Ret *create(Cfg *Func, Variable *Source = NULL) { |
| 1164 return new (Func->allocate<InstX8632Ret>()) InstX8632Ret(Func, Source); | 1182 return new (Func->allocate<InstX8632Ret>()) InstX8632Ret(Func, Source); |
| 1165 } | 1183 } |
| 1166 virtual void emit(const Cfg *Func) const; | 1184 virtual void emit(const Cfg *Func) const; |
| 1185 virtual void emitIAS(const Cfg *Func) const; |
| 1167 virtual void dump(const Cfg *Func) const; | 1186 virtual void dump(const Cfg *Func) const; |
| 1168 static bool classof(const Inst *Inst) { return isClassof(Inst, Ret); } | 1187 static bool classof(const Inst *Inst) { return isClassof(Inst, Ret); } |
| 1169 | 1188 |
| 1170 private: | 1189 private: |
| 1171 InstX8632Ret(Cfg *Func, Variable *Source); | 1190 InstX8632Ret(Cfg *Func, Variable *Source); |
| 1172 InstX8632Ret(const InstX8632Ret &) LLVM_DELETED_FUNCTION; | 1191 InstX8632Ret(const InstX8632Ret &) LLVM_DELETED_FUNCTION; |
| 1173 InstX8632Ret &operator=(const InstX8632Ret &) LLVM_DELETED_FUNCTION; | 1192 InstX8632Ret &operator=(const InstX8632Ret &) LLVM_DELETED_FUNCTION; |
| 1174 virtual ~InstX8632Ret() {} | 1193 virtual ~InstX8632Ret() {} |
| 1175 }; | 1194 }; |
| 1176 | 1195 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1241 template <> void InstX8632Pextr::emit(const Cfg *Func) const; | 1260 template <> void InstX8632Pextr::emit(const Cfg *Func) const; |
| 1242 template <> void InstX8632Pinsr::emit(const Cfg *Func) const; | 1261 template <> void InstX8632Pinsr::emit(const Cfg *Func) const; |
| 1243 template <> void InstX8632Pmull::emit(const Cfg *Func) const; | 1262 template <> void InstX8632Pmull::emit(const Cfg *Func) const; |
| 1244 template <> void InstX8632Pmuludq::emit(const Cfg *Func) const; | 1263 template <> void InstX8632Pmuludq::emit(const Cfg *Func) const; |
| 1245 template <> void InstX8632Psll::emit(const Cfg *Func) const; | 1264 template <> void InstX8632Psll::emit(const Cfg *Func) const; |
| 1246 template <> void InstX8632Psra::emit(const Cfg *Func) const; | 1265 template <> void InstX8632Psra::emit(const Cfg *Func) const; |
| 1247 template <> void InstX8632Psub::emit(const Cfg *Func) const; | 1266 template <> void InstX8632Psub::emit(const Cfg *Func) const; |
| 1248 template <> void InstX8632Sqrtss::emit(const Cfg *Func) const; | 1267 template <> void InstX8632Sqrtss::emit(const Cfg *Func) const; |
| 1249 template <> void InstX8632Subss::emit(const Cfg *Func) const; | 1268 template <> void InstX8632Subss::emit(const Cfg *Func) const; |
| 1250 | 1269 |
| 1270 // Same with emitIAS() methods. |
| 1271 template <> void InstX8632Adc::emitIAS(const Cfg *Func) const; |
| 1272 template <> void InstX8632Add::emitIAS(const Cfg *Func) const; |
| 1273 template <> void InstX8632Addps::emitIAS(const Cfg *Func) const; |
| 1274 template <> void InstX8632Addss::emitIAS(const Cfg *Func) const; |
| 1275 template <> void InstX8632And::emitIAS(const Cfg *Func) const; |
| 1276 template <> void InstX8632Cbwdq::emitIAS(const Cfg *Func) const; |
| 1277 template <> void InstX8632Divps::emitIAS(const Cfg *Func) const; |
| 1278 template <> void InstX8632Divss::emitIAS(const Cfg *Func) const; |
| 1279 template <> void InstX8632Mulps::emitIAS(const Cfg *Func) const; |
| 1280 template <> void InstX8632Mulss::emitIAS(const Cfg *Func) const; |
| 1281 template <> void InstX8632Or::emitIAS(const Cfg *Func) const; |
| 1282 template <> void InstX8632Sbb::emitIAS(const Cfg *Func) const; |
| 1283 template <> void InstX8632Sqrtss::emitIAS(const Cfg *Func) const; |
| 1284 template <> void InstX8632Sub::emitIAS(const Cfg *Func) const; |
| 1285 template <> void InstX8632Subps::emitIAS(const Cfg *Func) const; |
| 1286 template <> void InstX8632Subss::emitIAS(const Cfg *Func) const; |
| 1287 template <> void InstX8632Xor::emitIAS(const Cfg *Func) const; |
| 1288 |
| 1251 } // end of namespace Ice | 1289 } // end of namespace Ice |
| 1252 | 1290 |
| 1253 #endif // SUBZERO_SRC_ICEINSTX8632_H | 1291 #endif // SUBZERO_SRC_ICEINSTX8632_H |
| OLD | NEW |