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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
149 Cvt, | 149 Cvt, |
150 Div, | 150 Div, |
151 Divps, | 151 Divps, |
152 Divss, | 152 Divss, |
153 Fld, | 153 Fld, |
154 Fstp, | 154 Fstp, |
155 Icmp, | 155 Icmp, |
156 Idiv, | 156 Idiv, |
157 Imul, | 157 Imul, |
158 Label, | 158 Label, |
159 Lea, | |
159 Load, | 160 Load, |
160 Mfence, | 161 Mfence, |
161 Mov, | 162 Mov, |
163 Movd, | |
162 Movp, | 164 Movp, |
163 Movq, | 165 Movq, |
166 Movss, | |
164 Movsx, | 167 Movsx, |
165 Movzx, | 168 Movzx, |
166 Mul, | 169 Mul, |
167 Mulps, | 170 Mulps, |
168 Mulss, | 171 Mulss, |
169 Neg, | 172 Neg, |
170 Or, | 173 Or, |
171 Pand, | 174 Pand, |
172 Pcmpeq, | 175 Pcmpeq, |
173 Pcmpgt, | 176 Pcmpgt, |
177 Pextrw, | |
178 Pinsrw, | |
174 Pop, | 179 Pop, |
180 Pshufd, | |
175 Push, | 181 Push, |
176 Psll, | 182 Psll, |
177 Psra, | 183 Psra, |
178 Psub, | 184 Psub, |
179 Pxor, | 185 Pxor, |
180 Ret, | 186 Ret, |
181 Sar, | 187 Sar, |
182 Sbb, | 188 Sbb, |
183 Shl, | 189 Shl, |
184 Shld, | 190 Shld, |
185 Shr, | 191 Shr, |
186 Shrd, | 192 Shrd, |
193 Shufps, | |
187 Sqrtss, | 194 Sqrtss, |
188 Store, | 195 Store, |
189 StoreQ, | 196 StoreQ, |
190 Sub, | 197 Sub, |
191 Subps, | 198 Subps, |
192 Subss, | 199 Subss, |
193 Test, | 200 Test, |
194 Ucomiss, | 201 Ucomiss, |
195 UD2, | 202 UD2, |
196 Xadd, | 203 Xadd, |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
417 // Create a ternary-op instruction like div or idiv. | 424 // Create a ternary-op instruction like div or idiv. |
418 static InstX8632Ternop *create(Cfg *Func, Variable *Dest, Operand *Source1, | 425 static InstX8632Ternop *create(Cfg *Func, Variable *Dest, Operand *Source1, |
419 Operand *Source2) { | 426 Operand *Source2) { |
420 return new (Func->allocate<InstX8632Ternop>()) | 427 return new (Func->allocate<InstX8632Ternop>()) |
421 InstX8632Ternop(Func, Dest, Source1, Source2); | 428 InstX8632Ternop(Func, Dest, Source1, Source2); |
422 } | 429 } |
423 virtual void emit(const Cfg *Func) const { | 430 virtual void emit(const Cfg *Func) const { |
424 Ostream &Str = Func->getContext()->getStrEmit(); | 431 Ostream &Str = Func->getContext()->getStrEmit(); |
425 assert(getSrcSize() == 3); | 432 assert(getSrcSize() == 3); |
426 Str << "\t" << Opcode << "\t"; | 433 Str << "\t" << Opcode << "\t"; |
434 getDest()->emit(Func); | |
Jim Stichnoth
2014/07/17 19:49:01
Hmm, do the existing div/idiv instructions still e
| |
435 Str << ", "; | |
427 getSrc(1)->emit(Func); | 436 getSrc(1)->emit(Func); |
437 Str << ", "; | |
438 getSrc(2)->emit(Func); | |
428 Str << "\n"; | 439 Str << "\n"; |
429 } | 440 } |
430 virtual void dump(const Cfg *Func) const { | 441 virtual void dump(const Cfg *Func) const { |
431 Ostream &Str = Func->getContext()->getStrDump(); | 442 Ostream &Str = Func->getContext()->getStrDump(); |
432 dumpDest(Func); | 443 dumpDest(Func); |
433 Str << " = " << Opcode << "." << getDest()->getType() << " "; | 444 Str << " = " << Opcode << "." << getDest()->getType() << " "; |
434 dumpSources(Func); | 445 dumpSources(Func); |
435 } | 446 } |
436 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } | 447 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } |
437 | 448 |
438 private: | 449 private: |
439 InstX8632Ternop(Cfg *Func, Variable *Dest, Operand *Source1, Operand *Source2) | 450 InstX8632Ternop(Cfg *Func, Variable *Dest, Operand *Source1, Operand *Source2) |
440 : InstX8632(Func, K, 3, Dest) { | 451 : InstX8632(Func, K, 3, Dest) { |
441 addSource(Dest); | 452 addSource(Dest); |
442 addSource(Source1); | 453 addSource(Source1); |
443 addSource(Source2); | 454 addSource(Source2); |
444 } | 455 } |
445 InstX8632Ternop(const InstX8632Ternop &) LLVM_DELETED_FUNCTION; | 456 InstX8632Ternop(const InstX8632Ternop &) LLVM_DELETED_FUNCTION; |
446 InstX8632Ternop &operator=(const InstX8632Ternop &) LLVM_DELETED_FUNCTION; | 457 InstX8632Ternop &operator=(const InstX8632Ternop &) LLVM_DELETED_FUNCTION; |
447 virtual ~InstX8632Ternop() {} | 458 virtual ~InstX8632Ternop() {} |
448 static const char *Opcode; | 459 static const char *Opcode; |
449 }; | 460 }; |
450 | 461 |
462 // Instructions of the form x := y op z | |
463 template <InstX8632::InstKindX8632 K> | |
464 class InstX8632ThreeAddressop : public InstX8632 { | |
465 public: | |
466 static InstX8632ThreeAddressop *create(Cfg *Func, Variable *Dest, | |
467 Operand *Source0, Operand *Source1) { | |
468 return new (Func->allocate<InstX8632ThreeAddressop>()) | |
469 InstX8632ThreeAddressop(Func, Dest, Source0, Source1); | |
470 } | |
471 virtual void emit(const Cfg *Func) const { | |
472 Ostream &Str = Func->getContext()->getStrEmit(); | |
473 assert(getSrcSize() == 2); | |
474 Str << "\t" << Opcode << "\t"; | |
475 getDest()->emit(Func); | |
476 Str << ", "; | |
477 getSrc(0)->emit(Func); | |
478 Str << ", "; | |
479 getSrc(1)->emit(Func); | |
480 Str << "\n"; | |
481 } | |
482 virtual void dump(const Cfg *Func) const { | |
483 Ostream &Str = Func->getContext()->getStrDump(); | |
484 dumpDest(Func); | |
485 Str << " = " << Opcode << "." << getDest()->getType() << " "; | |
486 dumpSources(Func); | |
487 } | |
488 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } | |
489 | |
490 private: | |
491 InstX8632ThreeAddressop(Cfg *Func, Variable *Dest, Operand *Source0, | |
492 Operand *Source1) | |
493 : InstX8632(Func, K, 2, Dest) { | |
494 addSource(Source0); | |
495 addSource(Source1); | |
496 } | |
497 InstX8632ThreeAddressop(const InstX8632ThreeAddressop &) | |
498 LLVM_DELETED_FUNCTION; | |
499 InstX8632ThreeAddressop & | |
500 operator=(const InstX8632ThreeAddressop &) LLVM_DELETED_FUNCTION; | |
501 virtual ~InstX8632ThreeAddressop() {} | |
502 static const char *Opcode; | |
503 }; | |
504 | |
451 typedef InstX8632Unaryop<InstX8632::Bsf> InstX8632Bsf; | 505 typedef InstX8632Unaryop<InstX8632::Bsf> InstX8632Bsf; |
452 typedef InstX8632Unaryop<InstX8632::Bsr> InstX8632Bsr; | 506 typedef InstX8632Unaryop<InstX8632::Bsr> InstX8632Bsr; |
507 typedef InstX8632Unaryop<InstX8632::Lea> InstX8632Lea; | |
508 typedef InstX8632Unaryop<InstX8632::Movd> InstX8632Movd; | |
509 typedef InstX8632Unaryop<InstX8632::Movss> InstX8632Movss; | |
453 typedef InstX8632Unaryop<InstX8632::Sqrtss> InstX8632Sqrtss; | 510 typedef InstX8632Unaryop<InstX8632::Sqrtss> InstX8632Sqrtss; |
454 typedef InstX8632Binop<InstX8632::Add> InstX8632Add; | 511 typedef InstX8632Binop<InstX8632::Add> InstX8632Add; |
455 typedef InstX8632Binop<InstX8632::Addps> InstX8632Addps; | 512 typedef InstX8632Binop<InstX8632::Addps> InstX8632Addps; |
456 typedef InstX8632Binop<InstX8632::Adc> InstX8632Adc; | 513 typedef InstX8632Binop<InstX8632::Adc> InstX8632Adc; |
457 typedef InstX8632Binop<InstX8632::Addss> InstX8632Addss; | 514 typedef InstX8632Binop<InstX8632::Addss> InstX8632Addss; |
458 typedef InstX8632Binop<InstX8632::Sub> InstX8632Sub; | 515 typedef InstX8632Binop<InstX8632::Sub> InstX8632Sub; |
459 typedef InstX8632Binop<InstX8632::Subps> InstX8632Subps; | 516 typedef InstX8632Binop<InstX8632::Subps> InstX8632Subps; |
460 typedef InstX8632Binop<InstX8632::Subss> InstX8632Subss; | 517 typedef InstX8632Binop<InstX8632::Subss> InstX8632Subss; |
461 typedef InstX8632Binop<InstX8632::Sbb> InstX8632Sbb; | 518 typedef InstX8632Binop<InstX8632::Sbb> InstX8632Sbb; |
462 typedef InstX8632Binop<InstX8632::Psub> InstX8632Psub; | 519 typedef InstX8632Binop<InstX8632::Psub> InstX8632Psub; |
463 typedef InstX8632Binop<InstX8632::And> InstX8632And; | 520 typedef InstX8632Binop<InstX8632::And> InstX8632And; |
464 typedef InstX8632Binop<InstX8632::Pand> InstX8632Pand; | 521 typedef InstX8632Binop<InstX8632::Pand> InstX8632Pand; |
465 typedef InstX8632Binop<InstX8632::Or> InstX8632Or; | 522 typedef InstX8632Binop<InstX8632::Or> InstX8632Or; |
466 typedef InstX8632Binop<InstX8632::Xor> InstX8632Xor; | 523 typedef InstX8632Binop<InstX8632::Xor> InstX8632Xor; |
467 typedef InstX8632Binop<InstX8632::Pxor> InstX8632Pxor; | 524 typedef InstX8632Binop<InstX8632::Pxor> InstX8632Pxor; |
468 typedef InstX8632Binop<InstX8632::Imul> InstX8632Imul; | 525 typedef InstX8632Binop<InstX8632::Imul> InstX8632Imul; |
469 typedef InstX8632Binop<InstX8632::Mulps> InstX8632Mulps; | 526 typedef InstX8632Binop<InstX8632::Mulps> InstX8632Mulps; |
470 typedef InstX8632Binop<InstX8632::Mulss> InstX8632Mulss; | 527 typedef InstX8632Binop<InstX8632::Mulss> InstX8632Mulss; |
471 typedef InstX8632Binop<InstX8632::Divps> InstX8632Divps; | 528 typedef InstX8632Binop<InstX8632::Divps> InstX8632Divps; |
472 typedef InstX8632Binop<InstX8632::Divss> InstX8632Divss; | 529 typedef InstX8632Binop<InstX8632::Divss> InstX8632Divss; |
473 typedef InstX8632Binop<InstX8632::Shl, true> InstX8632Shl; | 530 typedef InstX8632Binop<InstX8632::Shl, true> InstX8632Shl; |
474 typedef InstX8632Binop<InstX8632::Psll> InstX8632Psll; | 531 typedef InstX8632Binop<InstX8632::Psll> InstX8632Psll; |
475 typedef InstX8632Binop<InstX8632::Shr, true> InstX8632Shr; | 532 typedef InstX8632Binop<InstX8632::Shr, true> InstX8632Shr; |
476 typedef InstX8632Binop<InstX8632::Sar, true> InstX8632Sar; | 533 typedef InstX8632Binop<InstX8632::Sar, true> InstX8632Sar; |
477 typedef InstX8632Binop<InstX8632::Psra> InstX8632Psra; | 534 typedef InstX8632Binop<InstX8632::Psra> InstX8632Psra; |
478 typedef InstX8632Binop<InstX8632::Pcmpeq> InstX8632Pcmpeq; | 535 typedef InstX8632Binop<InstX8632::Pcmpeq> InstX8632Pcmpeq; |
479 typedef InstX8632Binop<InstX8632::Pcmpgt> InstX8632Pcmpgt; | 536 typedef InstX8632Binop<InstX8632::Pcmpgt> InstX8632Pcmpgt; |
480 typedef InstX8632Ternop<InstX8632::Idiv> InstX8632Idiv; | 537 typedef InstX8632Ternop<InstX8632::Idiv> InstX8632Idiv; |
481 typedef InstX8632Ternop<InstX8632::Div> InstX8632Div; | 538 typedef InstX8632Ternop<InstX8632::Div> InstX8632Div; |
539 typedef InstX8632Ternop<InstX8632::Pinsrw> InstX8632Pinsrw; | |
540 typedef InstX8632Ternop<InstX8632::Shufps> InstX8632Shufps; | |
541 typedef InstX8632ThreeAddressop<InstX8632::Pextrw> InstX8632Pextrw; | |
542 typedef InstX8632ThreeAddressop<InstX8632::Pshufd> InstX8632Pshufd; | |
482 | 543 |
483 // Base class for a lockable x86-32 instruction (emits a locked prefix). | 544 // Base class for a lockable x86-32 instruction (emits a locked prefix). |
484 class InstX8632Lockable : public InstX8632 { | 545 class InstX8632Lockable : public InstX8632 { |
485 public: | 546 public: |
486 virtual void emit(const Cfg *Func) const = 0; | 547 virtual void emit(const Cfg *Func) const = 0; |
487 virtual void dump(const Cfg *Func) const; | 548 virtual void dump(const Cfg *Func) const; |
488 | 549 |
489 protected: | 550 protected: |
490 bool Locked; | 551 bool Locked; |
491 | 552 |
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1048 private: | 1109 private: |
1049 InstX8632Xchg(Cfg *Func, Operand *Dest, Variable *Source); | 1110 InstX8632Xchg(Cfg *Func, Operand *Dest, Variable *Source); |
1050 InstX8632Xchg(const InstX8632Xchg &) LLVM_DELETED_FUNCTION; | 1111 InstX8632Xchg(const InstX8632Xchg &) LLVM_DELETED_FUNCTION; |
1051 InstX8632Xchg &operator=(const InstX8632Xchg &) LLVM_DELETED_FUNCTION; | 1112 InstX8632Xchg &operator=(const InstX8632Xchg &) LLVM_DELETED_FUNCTION; |
1052 virtual ~InstX8632Xchg() {} | 1113 virtual ~InstX8632Xchg() {} |
1053 }; | 1114 }; |
1054 | 1115 |
1055 } // end of namespace Ice | 1116 } // end of namespace Ice |
1056 | 1117 |
1057 #endif // SUBZERO_SRC_ICEINSTX8632_H | 1118 #endif // SUBZERO_SRC_ICEINSTX8632_H |
OLD | NEW |