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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 enum InstKindX8632 { | 134 enum InstKindX8632 { |
135 k__Start = Inst::Target, | 135 k__Start = Inst::Target, |
136 Adc, | 136 Adc, |
137 Add, | 137 Add, |
138 Addps, | 138 Addps, |
139 Addss, | 139 Addss, |
140 And, | 140 And, |
141 Br, | 141 Br, |
142 Bsf, | 142 Bsf, |
143 Bsr, | 143 Bsr, |
| 144 Bswap, |
144 Call, | 145 Call, |
145 Cdq, | 146 Cdq, |
146 Cmov, | 147 Cmov, |
147 Cmpxchg, | 148 Cmpxchg, |
148 Cmpxchg8b, | 149 Cmpxchg8b, |
149 Cvt, | 150 Cvt, |
150 Div, | 151 Div, |
151 Divps, | 152 Divps, |
152 Divss, | 153 Divss, |
153 Fld, | 154 Fld, |
(...skipping 27 matching lines...) Expand all Loading... |
181 Pmuludq, | 182 Pmuludq, |
182 Pop, | 183 Pop, |
183 Por, | 184 Por, |
184 Pshufd, | 185 Pshufd, |
185 Psll, | 186 Psll, |
186 Psra, | 187 Psra, |
187 Psub, | 188 Psub, |
188 Push, | 189 Push, |
189 Pxor, | 190 Pxor, |
190 Ret, | 191 Ret, |
| 192 Rol, |
191 Sar, | 193 Sar, |
192 Sbb, | 194 Sbb, |
193 Shl, | 195 Shl, |
194 Shld, | 196 Shld, |
195 Shr, | 197 Shr, |
196 Shrd, | 198 Shrd, |
197 Shufps, | 199 Shufps, |
198 Sqrtss, | 200 Sqrtss, |
199 Store, | 201 Store, |
200 StoreQ, | 202 StoreQ, |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 virtual void dump(const Cfg *Func) const; | 347 virtual void dump(const Cfg *Func) const; |
346 static bool classof(const Inst *Inst) { return isClassof(Inst, Call); } | 348 static bool classof(const Inst *Inst) { return isClassof(Inst, Call); } |
347 | 349 |
348 private: | 350 private: |
349 InstX8632Call(Cfg *Func, Variable *Dest, Operand *CallTarget); | 351 InstX8632Call(Cfg *Func, Variable *Dest, Operand *CallTarget); |
350 InstX8632Call(const InstX8632Call &) LLVM_DELETED_FUNCTION; | 352 InstX8632Call(const InstX8632Call &) LLVM_DELETED_FUNCTION; |
351 InstX8632Call &operator=(const InstX8632Call &) LLVM_DELETED_FUNCTION; | 353 InstX8632Call &operator=(const InstX8632Call &) LLVM_DELETED_FUNCTION; |
352 virtual ~InstX8632Call() {} | 354 virtual ~InstX8632Call() {} |
353 }; | 355 }; |
354 | 356 |
| 357 // Instructions of the form x := op(x). |
| 358 template <InstX8632::InstKindX8632 K> |
| 359 class InstX8632Inplaceop : public InstX8632 { |
| 360 public: |
| 361 static InstX8632Inplaceop *create(Cfg *Func, Operand *SrcDest) { |
| 362 return new (Func->allocate<InstX8632Inplaceop>()) |
| 363 InstX8632Inplaceop(Func, SrcDest); |
| 364 } |
| 365 virtual void emit(const Cfg *Func) const { |
| 366 Ostream &Str = Func->getContext()->getStrEmit(); |
| 367 assert(getSrcSize() == 1); |
| 368 Str << "\t" << Opcode << "\t"; |
| 369 getSrc(0)->emit(Func); |
| 370 Str << "\n"; |
| 371 } |
| 372 virtual void dump(const Cfg *Func) const { |
| 373 Ostream &Str = Func->getContext()->getStrDump(); |
| 374 dumpDest(Func); |
| 375 Str << " = " << Opcode << "." << getDest()->getType() << " "; |
| 376 dumpSources(Func); |
| 377 } |
| 378 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } |
| 379 |
| 380 private: |
| 381 InstX8632Inplaceop(Cfg *Func, Operand *SrcDest) |
| 382 : InstX8632(Func, K, 1, llvm::dyn_cast<Variable>(SrcDest)) { |
| 383 addSource(SrcDest); |
| 384 } |
| 385 InstX8632Inplaceop(const InstX8632Inplaceop &) LLVM_DELETED_FUNCTION; |
| 386 InstX8632Inplaceop & |
| 387 operator=(const InstX8632Inplaceop &) LLVM_DELETED_FUNCTION; |
| 388 virtual ~InstX8632Inplaceop() {} |
| 389 static const char *Opcode; |
| 390 }; |
| 391 |
| 392 // Instructions of the form x := op(y) |
355 template <InstX8632::InstKindX8632 K> | 393 template <InstX8632::InstKindX8632 K> |
356 class InstX8632Unaryop : public InstX8632 { | 394 class InstX8632Unaryop : public InstX8632 { |
357 public: | 395 public: |
358 static InstX8632Unaryop *create(Cfg *Func, Variable *Dest, Operand *Src) { | 396 static InstX8632Unaryop *create(Cfg *Func, Variable *Dest, Operand *Src) { |
359 return new (Func->allocate<InstX8632Unaryop>()) | 397 return new (Func->allocate<InstX8632Unaryop>()) |
360 InstX8632Unaryop(Func, Dest, Src); | 398 InstX8632Unaryop(Func, Dest, Src); |
361 } | 399 } |
362 virtual void emit(const Cfg *Func) const { | 400 virtual void emit(const Cfg *Func) const { |
363 Ostream &Str = Func->getContext()->getStrEmit(); | 401 Ostream &Str = Func->getContext()->getStrEmit(); |
364 assert(getSrcSize() == 1); | 402 assert(getSrcSize() == 1); |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 addSource(Source1); | 537 addSource(Source1); |
500 } | 538 } |
501 InstX8632ThreeAddressop(const InstX8632ThreeAddressop &) | 539 InstX8632ThreeAddressop(const InstX8632ThreeAddressop &) |
502 LLVM_DELETED_FUNCTION; | 540 LLVM_DELETED_FUNCTION; |
503 InstX8632ThreeAddressop & | 541 InstX8632ThreeAddressop & |
504 operator=(const InstX8632ThreeAddressop &) LLVM_DELETED_FUNCTION; | 542 operator=(const InstX8632ThreeAddressop &) LLVM_DELETED_FUNCTION; |
505 virtual ~InstX8632ThreeAddressop() {} | 543 virtual ~InstX8632ThreeAddressop() {} |
506 static const char *Opcode; | 544 static const char *Opcode; |
507 }; | 545 }; |
508 | 546 |
| 547 typedef InstX8632Inplaceop<InstX8632::Bswap> InstX8632Bswap; |
| 548 typedef InstX8632Inplaceop<InstX8632::Neg> InstX8632Neg; |
509 typedef InstX8632Unaryop<InstX8632::Bsf> InstX8632Bsf; | 549 typedef InstX8632Unaryop<InstX8632::Bsf> InstX8632Bsf; |
510 typedef InstX8632Unaryop<InstX8632::Bsr> InstX8632Bsr; | 550 typedef InstX8632Unaryop<InstX8632::Bsr> InstX8632Bsr; |
511 typedef InstX8632Unaryop<InstX8632::Lea> InstX8632Lea; | 551 typedef InstX8632Unaryop<InstX8632::Lea> InstX8632Lea; |
512 typedef InstX8632Unaryop<InstX8632::Movd> InstX8632Movd; | 552 typedef InstX8632Unaryop<InstX8632::Movd> InstX8632Movd; |
513 typedef InstX8632Unaryop<InstX8632::Movss> InstX8632Movss; | 553 typedef InstX8632Unaryop<InstX8632::Movss> InstX8632Movss; |
514 typedef InstX8632Unaryop<InstX8632::Sqrtss> InstX8632Sqrtss; | 554 typedef InstX8632Unaryop<InstX8632::Sqrtss> InstX8632Sqrtss; |
515 typedef InstX8632Binop<InstX8632::Add> InstX8632Add; | 555 typedef InstX8632Binop<InstX8632::Add> InstX8632Add; |
516 typedef InstX8632Binop<InstX8632::Addps> InstX8632Addps; | 556 typedef InstX8632Binop<InstX8632::Addps> InstX8632Addps; |
517 typedef InstX8632Binop<InstX8632::Adc> InstX8632Adc; | 557 typedef InstX8632Binop<InstX8632::Adc> InstX8632Adc; |
518 typedef InstX8632Binop<InstX8632::Addss> InstX8632Addss; | 558 typedef InstX8632Binop<InstX8632::Addss> InstX8632Addss; |
519 typedef InstX8632Binop<InstX8632::Padd> InstX8632Padd; | 559 typedef InstX8632Binop<InstX8632::Padd> InstX8632Padd; |
520 typedef InstX8632Binop<InstX8632::Sub> InstX8632Sub; | 560 typedef InstX8632Binop<InstX8632::Sub> InstX8632Sub; |
521 typedef InstX8632Binop<InstX8632::Subps> InstX8632Subps; | 561 typedef InstX8632Binop<InstX8632::Subps> InstX8632Subps; |
522 typedef InstX8632Binop<InstX8632::Subss> InstX8632Subss; | 562 typedef InstX8632Binop<InstX8632::Subss> InstX8632Subss; |
523 typedef InstX8632Binop<InstX8632::Sbb> InstX8632Sbb; | 563 typedef InstX8632Binop<InstX8632::Sbb> InstX8632Sbb; |
524 typedef InstX8632Binop<InstX8632::Psub> InstX8632Psub; | 564 typedef InstX8632Binop<InstX8632::Psub> InstX8632Psub; |
525 typedef InstX8632Binop<InstX8632::And> InstX8632And; | 565 typedef InstX8632Binop<InstX8632::And> InstX8632And; |
526 typedef InstX8632Binop<InstX8632::Pand> InstX8632Pand; | 566 typedef InstX8632Binop<InstX8632::Pand> InstX8632Pand; |
527 typedef InstX8632Binop<InstX8632::Or> InstX8632Or; | 567 typedef InstX8632Binop<InstX8632::Or> InstX8632Or; |
528 typedef InstX8632Binop<InstX8632::Por> InstX8632Por; | 568 typedef InstX8632Binop<InstX8632::Por> InstX8632Por; |
529 typedef InstX8632Binop<InstX8632::Xor> InstX8632Xor; | 569 typedef InstX8632Binop<InstX8632::Xor> InstX8632Xor; |
530 typedef InstX8632Binop<InstX8632::Pxor> InstX8632Pxor; | 570 typedef InstX8632Binop<InstX8632::Pxor> InstX8632Pxor; |
531 typedef InstX8632Binop<InstX8632::Imul> InstX8632Imul; | 571 typedef InstX8632Binop<InstX8632::Imul> InstX8632Imul; |
532 typedef InstX8632Binop<InstX8632::Mulps> InstX8632Mulps; | 572 typedef InstX8632Binop<InstX8632::Mulps> InstX8632Mulps; |
533 typedef InstX8632Binop<InstX8632::Mulss> InstX8632Mulss; | 573 typedef InstX8632Binop<InstX8632::Mulss> InstX8632Mulss; |
534 typedef InstX8632Binop<InstX8632::Pmullw> InstX8632Pmullw; | 574 typedef InstX8632Binop<InstX8632::Pmullw> InstX8632Pmullw; |
535 typedef InstX8632Binop<InstX8632::Pmuludq> InstX8632Pmuludq; | 575 typedef InstX8632Binop<InstX8632::Pmuludq> InstX8632Pmuludq; |
536 typedef InstX8632Binop<InstX8632::Divps> InstX8632Divps; | 576 typedef InstX8632Binop<InstX8632::Divps> InstX8632Divps; |
537 typedef InstX8632Binop<InstX8632::Divss> InstX8632Divss; | 577 typedef InstX8632Binop<InstX8632::Divss> InstX8632Divss; |
| 578 typedef InstX8632Binop<InstX8632::Rol, true> InstX8632Rol; |
538 typedef InstX8632Binop<InstX8632::Shl, true> InstX8632Shl; | 579 typedef InstX8632Binop<InstX8632::Shl, true> InstX8632Shl; |
539 typedef InstX8632Binop<InstX8632::Psll> InstX8632Psll; | 580 typedef InstX8632Binop<InstX8632::Psll> InstX8632Psll; |
540 typedef InstX8632Binop<InstX8632::Shr, true> InstX8632Shr; | 581 typedef InstX8632Binop<InstX8632::Shr, true> InstX8632Shr; |
541 typedef InstX8632Binop<InstX8632::Sar, true> InstX8632Sar; | 582 typedef InstX8632Binop<InstX8632::Sar, true> InstX8632Sar; |
542 typedef InstX8632Binop<InstX8632::Psra> InstX8632Psra; | 583 typedef InstX8632Binop<InstX8632::Psra> InstX8632Psra; |
543 typedef InstX8632Binop<InstX8632::Pcmpeq> InstX8632Pcmpeq; | 584 typedef InstX8632Binop<InstX8632::Pcmpeq> InstX8632Pcmpeq; |
544 typedef InstX8632Binop<InstX8632::Pcmpgt> InstX8632Pcmpgt; | 585 typedef InstX8632Binop<InstX8632::Pcmpgt> InstX8632Pcmpgt; |
545 typedef InstX8632Ternop<InstX8632::Idiv> InstX8632Idiv; | 586 typedef InstX8632Ternop<InstX8632::Idiv> InstX8632Idiv; |
546 typedef InstX8632Ternop<InstX8632::Div> InstX8632Div; | 587 typedef InstX8632Ternop<InstX8632::Div> InstX8632Div; |
547 typedef InstX8632Ternop<InstX8632::Pinsrw> InstX8632Pinsrw; | 588 typedef InstX8632Ternop<InstX8632::Pinsrw> InstX8632Pinsrw; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 virtual void dump(const Cfg *Func) const; | 624 virtual void dump(const Cfg *Func) const; |
584 static bool classof(const Inst *Inst) { return isClassof(Inst, Mul); } | 625 static bool classof(const Inst *Inst) { return isClassof(Inst, Mul); } |
585 | 626 |
586 private: | 627 private: |
587 InstX8632Mul(Cfg *Func, Variable *Dest, Variable *Source1, Operand *Source2); | 628 InstX8632Mul(Cfg *Func, Variable *Dest, Variable *Source1, Operand *Source2); |
588 InstX8632Mul(const InstX8632Mul &) LLVM_DELETED_FUNCTION; | 629 InstX8632Mul(const InstX8632Mul &) LLVM_DELETED_FUNCTION; |
589 InstX8632Mul &operator=(const InstX8632Mul &) LLVM_DELETED_FUNCTION; | 630 InstX8632Mul &operator=(const InstX8632Mul &) LLVM_DELETED_FUNCTION; |
590 virtual ~InstX8632Mul() {} | 631 virtual ~InstX8632Mul() {} |
591 }; | 632 }; |
592 | 633 |
593 // Neg instruction - Two's complement negation. | |
594 class InstX8632Neg : public InstX8632 { | |
595 public: | |
596 static InstX8632Neg *create(Cfg *Func, Operand *SrcDest) { | |
597 return new (Func->allocate<InstX8632Neg>()) InstX8632Neg(Func, SrcDest); | |
598 } | |
599 virtual void emit(const Cfg *Func) const; | |
600 virtual void dump(const Cfg *Func) const; | |
601 static bool classof(const Inst *Inst) { return isClassof(Inst, Neg); } | |
602 | |
603 private: | |
604 InstX8632Neg(Cfg *Func, Operand *SrcDest); | |
605 InstX8632Neg(const InstX8632Neg &) LLVM_DELETED_FUNCTION; | |
606 InstX8632Neg &operator=(const InstX8632Neg &) LLVM_DELETED_FUNCTION; | |
607 virtual ~InstX8632Neg() {} | |
608 }; | |
609 | |
610 // Shld instruction - shift across a pair of operands. TODO: Verify | 634 // Shld instruction - shift across a pair of operands. TODO: Verify |
611 // that the validator accepts the shld instruction. | 635 // that the validator accepts the shld instruction. |
612 class InstX8632Shld : public InstX8632 { | 636 class InstX8632Shld : public InstX8632 { |
613 public: | 637 public: |
614 static InstX8632Shld *create(Cfg *Func, Variable *Dest, Variable *Source1, | 638 static InstX8632Shld *create(Cfg *Func, Variable *Dest, Variable *Source1, |
615 Variable *Source2) { | 639 Variable *Source2) { |
616 return new (Func->allocate<InstX8632Shld>()) | 640 return new (Func->allocate<InstX8632Shld>()) |
617 InstX8632Shld(Func, Dest, Source1, Source2); | 641 InstX8632Shld(Func, Dest, Source1, Source2); |
618 } | 642 } |
619 virtual void emit(const Cfg *Func) const; | 643 virtual void emit(const Cfg *Func) const; |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1117 private: | 1141 private: |
1118 InstX8632Xchg(Cfg *Func, Operand *Dest, Variable *Source); | 1142 InstX8632Xchg(Cfg *Func, Operand *Dest, Variable *Source); |
1119 InstX8632Xchg(const InstX8632Xchg &) LLVM_DELETED_FUNCTION; | 1143 InstX8632Xchg(const InstX8632Xchg &) LLVM_DELETED_FUNCTION; |
1120 InstX8632Xchg &operator=(const InstX8632Xchg &) LLVM_DELETED_FUNCTION; | 1144 InstX8632Xchg &operator=(const InstX8632Xchg &) LLVM_DELETED_FUNCTION; |
1121 virtual ~InstX8632Xchg() {} | 1145 virtual ~InstX8632Xchg() {} |
1122 }; | 1146 }; |
1123 | 1147 |
1124 } // end of namespace Ice | 1148 } // end of namespace Ice |
1125 | 1149 |
1126 #endif // SUBZERO_SRC_ICEINSTX8632_H | 1150 #endif // SUBZERO_SRC_ICEINSTX8632_H |
OLD | NEW |