OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 // | 4 // |
5 // Modified by the Subzero authors. | 5 // Modified by the Subzero authors. |
6 // | 6 // |
7 //===- subzero/src/assembler_ia32.h - Assembler for x86-32 ----------------===// | 7 //===- subzero/src/assembler_ia32.h - Assembler for x86-32 ----------------===// |
8 // | 8 // |
9 // The Subzero Code Generator | 9 // The Subzero Code Generator |
10 // | 10 // |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 TypedEmitGPRImm GPRImm; | 354 TypedEmitGPRImm GPRImm; |
355 }; | 355 }; |
356 | 356 |
357 struct GPREmitterShiftOp { | 357 struct GPREmitterShiftOp { |
358 TypedEmitGPRGPR GPRGPR; | 358 TypedEmitGPRGPR GPRGPR; |
359 TypedEmitGPRImm GPRImm; | 359 TypedEmitGPRImm GPRImm; |
360 // Technically, Addr/GPR and Addr/Imm are also allowed, but */Addr are not. | 360 // Technically, Addr/GPR and Addr/Imm are also allowed, but */Addr are not. |
361 // In practice, we always normalize the Dest to a Register first. | 361 // In practice, we always normalize the Dest to a Register first. |
362 }; | 362 }; |
363 | 363 |
| 364 typedef void (AssemblerX86::*TypedEmitAddrGPR)(Type, const Address &, |
| 365 GPRRegister); |
| 366 typedef void (AssemblerX86::*TypedEmitAddrImm)(Type, const Address &, |
| 367 const Immediate &); |
| 368 struct GPREmitterAddrOp { |
| 369 TypedEmitAddrGPR AddrGPR; |
| 370 TypedEmitAddrImm AddrImm; |
| 371 }; |
| 372 |
364 // Operations to emit XMM instructions (and dispatch on operand type). | 373 // Operations to emit XMM instructions (and dispatch on operand type). |
365 typedef void (AssemblerX86::*TypedEmitXmmXmm)(Type, XmmRegister, XmmRegister); | 374 typedef void (AssemblerX86::*TypedEmitXmmXmm)(Type, XmmRegister, XmmRegister); |
366 typedef void (AssemblerX86::*TypedEmitXmmAddr)(Type, XmmRegister, | 375 typedef void (AssemblerX86::*TypedEmitXmmAddr)(Type, XmmRegister, |
367 const Address &); | 376 const Address &); |
368 typedef void (AssemblerX86::*TypedEmitAddrXmm)(Type, const Address &, | 377 struct XmmEmitterRegOp { |
369 XmmRegister); | |
370 struct XmmEmitterTwoOps { | |
371 TypedEmitXmmXmm XmmXmm; | 378 TypedEmitXmmXmm XmmXmm; |
372 TypedEmitXmmAddr XmmAddr; | 379 TypedEmitXmmAddr XmmAddr; |
373 TypedEmitAddrXmm AddrXmm; | 380 }; |
| 381 |
| 382 typedef void (AssemblerX86::*EmitXmmXmm)(XmmRegister, XmmRegister); |
| 383 typedef void (AssemblerX86::*EmitXmmAddr)(XmmRegister, const Address &); |
| 384 typedef void (AssemblerX86::*EmitAddrXmm)(const Address &, XmmRegister); |
| 385 struct XmmEmitterMovOps { |
| 386 EmitXmmXmm XmmXmm; |
| 387 EmitXmmAddr XmmAddr; |
| 388 EmitAddrXmm AddrXmm; |
374 }; | 389 }; |
375 | 390 |
376 typedef void (AssemblerX86::*TypedEmitXmmImm)(Type, XmmRegister, | 391 typedef void (AssemblerX86::*TypedEmitXmmImm)(Type, XmmRegister, |
377 const Immediate &); | 392 const Immediate &); |
378 | 393 |
379 struct XmmEmitterShiftOp { | 394 struct XmmEmitterShiftOp { |
380 TypedEmitXmmXmm XmmXmm; | 395 TypedEmitXmmXmm XmmXmm; |
381 TypedEmitXmmAddr XmmAddr; | 396 TypedEmitXmmAddr XmmAddr; |
382 TypedEmitXmmImm XmmImm; | 397 TypedEmitXmmImm XmmImm; |
383 }; | 398 }; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 | 450 |
436 void movss(XmmRegister dst, const Address &src); | 451 void movss(XmmRegister dst, const Address &src); |
437 void movss(const Address &dst, XmmRegister src); | 452 void movss(const Address &dst, XmmRegister src); |
438 void movss(XmmRegister dst, XmmRegister src); | 453 void movss(XmmRegister dst, XmmRegister src); |
439 | 454 |
440 void movd(XmmRegister dst, GPRRegister src); | 455 void movd(XmmRegister dst, GPRRegister src); |
441 void movd(XmmRegister dst, const Address &src); | 456 void movd(XmmRegister dst, const Address &src); |
442 void movd(GPRRegister dst, XmmRegister src); | 457 void movd(GPRRegister dst, XmmRegister src); |
443 void movd(const Address &dst, XmmRegister src); | 458 void movd(const Address &dst, XmmRegister src); |
444 | 459 |
| 460 void movq(XmmRegister dst, XmmRegister src); |
445 void movq(const Address &dst, XmmRegister src); | 461 void movq(const Address &dst, XmmRegister src); |
446 void movq(XmmRegister dst, const Address &src); | 462 void movq(XmmRegister dst, const Address &src); |
447 | 463 |
448 void addss(Type Ty, XmmRegister dst, XmmRegister src); | 464 void addss(Type Ty, XmmRegister dst, XmmRegister src); |
449 void addss(Type Ty, XmmRegister dst, const Address &src); | 465 void addss(Type Ty, XmmRegister dst, const Address &src); |
450 void subss(Type Ty, XmmRegister dst, XmmRegister src); | 466 void subss(Type Ty, XmmRegister dst, XmmRegister src); |
451 void subss(Type Ty, XmmRegister dst, const Address &src); | 467 void subss(Type Ty, XmmRegister dst, const Address &src); |
452 void mulss(Type Ty, XmmRegister dst, XmmRegister src); | 468 void mulss(Type Ty, XmmRegister dst, XmmRegister src); |
453 void mulss(Type Ty, XmmRegister dst, const Address &src); | 469 void mulss(Type Ty, XmmRegister dst, const Address &src); |
454 void divss(Type Ty, XmmRegister dst, XmmRegister src); | 470 void divss(Type Ty, XmmRegister dst, XmmRegister src); |
455 void divss(Type Ty, XmmRegister dst, const Address &src); | 471 void divss(Type Ty, XmmRegister dst, const Address &src); |
456 | 472 |
457 void movsd(XmmRegister dst, const Address &src); | 473 void movsd(XmmRegister dst, const Address &src); |
458 void movsd(const Address &dst, XmmRegister src); | 474 void movsd(const Address &dst, XmmRegister src); |
459 void movsd(XmmRegister dst, XmmRegister src); | 475 void movsd(XmmRegister dst, XmmRegister src); |
460 | 476 |
461 void movaps(XmmRegister dst, XmmRegister src); | 477 void movaps(XmmRegister dst, XmmRegister src); |
462 | 478 |
| 479 void movups(XmmRegister dst, XmmRegister src); |
463 void movups(XmmRegister dst, const Address &src); | 480 void movups(XmmRegister dst, const Address &src); |
464 void movups(const Address &dst, XmmRegister src); | 481 void movups(const Address &dst, XmmRegister src); |
465 | 482 |
466 void padd(Type Ty, XmmRegister dst, XmmRegister src); | 483 void padd(Type Ty, XmmRegister dst, XmmRegister src); |
467 void padd(Type Ty, XmmRegister dst, const Address &src); | 484 void padd(Type Ty, XmmRegister dst, const Address &src); |
468 void pand(Type Ty, XmmRegister dst, XmmRegister src); | 485 void pand(Type Ty, XmmRegister dst, XmmRegister src); |
469 void pand(Type Ty, XmmRegister dst, const Address &src); | 486 void pand(Type Ty, XmmRegister dst, const Address &src); |
470 void pandn(Type Ty, XmmRegister dst, XmmRegister src); | 487 void pandn(Type Ty, XmmRegister dst, XmmRegister src); |
471 void pandn(Type Ty, XmmRegister dst, const Address &src); | 488 void pandn(Type Ty, XmmRegister dst, const Address &src); |
472 void pmull(Type Ty, XmmRegister dst, XmmRegister src); | 489 void pmull(Type Ty, XmmRegister dst, XmmRegister src); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 void fnstcw(const Address &dst); | 601 void fnstcw(const Address &dst); |
585 void fldcw(const Address &src); | 602 void fldcw(const Address &src); |
586 | 603 |
587 void fistpl(const Address &dst); | 604 void fistpl(const Address &dst); |
588 void fistps(const Address &dst); | 605 void fistps(const Address &dst); |
589 void fildl(const Address &src); | 606 void fildl(const Address &src); |
590 void filds(const Address &src); | 607 void filds(const Address &src); |
591 | 608 |
592 void fincstp(); | 609 void fincstp(); |
593 | 610 |
594 void cmpl(GPRRegister reg, const Immediate &imm); | 611 void cmp(Type Ty, GPRRegister reg0, GPRRegister reg1); |
595 void cmpl(GPRRegister reg0, GPRRegister reg1); | 612 void cmp(Type Ty, GPRRegister reg, const Address &address); |
596 void cmpl(GPRRegister reg, const Address &address); | 613 void cmp(Type Ty, GPRRegister reg, const Immediate &imm); |
597 void cmpl(const Address &address, GPRRegister reg); | 614 void cmp(Type Ty, const Address &address, GPRRegister reg); |
598 void cmpl(const Address &address, const Immediate &imm); | 615 void cmp(Type Ty, const Address &address, const Immediate &imm); |
599 void cmpb(const Address &address, const Immediate &imm); | |
600 | 616 |
601 void testl(GPRRegister reg1, GPRRegister reg2); | 617 void test(Type Ty, GPRRegister reg0, GPRRegister reg1); |
602 void testl(GPRRegister reg, const Immediate &imm); | 618 void test(Type Ty, GPRRegister reg, const Immediate &imm); |
| 619 void test(Type Ty, const Address &address, GPRRegister reg); |
| 620 void test(Type Ty, const Address &address, const Immediate &imm); |
603 | 621 |
604 void And(Type Ty, GPRRegister dst, GPRRegister src); | 622 void And(Type Ty, GPRRegister dst, GPRRegister src); |
605 void And(Type Ty, GPRRegister dst, const Address &address); | 623 void And(Type Ty, GPRRegister dst, const Address &address); |
606 void And(Type Ty, GPRRegister dst, const Immediate &imm); | 624 void And(Type Ty, GPRRegister dst, const Immediate &imm); |
607 | 625 |
608 void Or(Type Ty, GPRRegister dst, GPRRegister src); | 626 void Or(Type Ty, GPRRegister dst, GPRRegister src); |
609 void Or(Type Ty, GPRRegister dst, const Address &address); | 627 void Or(Type Ty, GPRRegister dst, const Address &address); |
610 void Or(Type Ty, GPRRegister dst, const Immediate &imm); | 628 void Or(Type Ty, GPRRegister dst, const Immediate &imm); |
611 | 629 |
612 void Xor(Type Ty, GPRRegister dst, GPRRegister src); | 630 void Xor(Type Ty, GPRRegister dst, GPRRegister src); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 | 709 |
692 void bt(GPRRegister base, GPRRegister offset); | 710 void bt(GPRRegister base, GPRRegister offset); |
693 | 711 |
694 void ret(); | 712 void ret(); |
695 void ret(const Immediate &imm); | 713 void ret(const Immediate &imm); |
696 | 714 |
697 // 'size' indicates size in bytes and must be in the range 1..8. | 715 // 'size' indicates size in bytes and must be in the range 1..8. |
698 void nop(int size = 1); | 716 void nop(int size = 1); |
699 void int3(); | 717 void int3(); |
700 void hlt(); | 718 void hlt(); |
| 719 void ud2(); |
701 | 720 |
702 void j(CondX86::BrCond condition, Label *label, bool near = kFarJump); | 721 void j(CondX86::BrCond condition, Label *label, bool near = kFarJump); |
703 void j(CondX86::BrCond condition, const ConstantRelocatable *label); | 722 void j(CondX86::BrCond condition, const ConstantRelocatable *label); |
704 | 723 |
705 void jmp(GPRRegister reg); | 724 void jmp(GPRRegister reg); |
706 void jmp(Label *label, bool near = kFarJump); | 725 void jmp(Label *label, bool near = kFarJump); |
707 void jmp(const ConstantRelocatable *label); | 726 void jmp(const ConstantRelocatable *label); |
708 | 727 |
709 void mfence(); | 728 void mfence(); |
710 | 729 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 inline void AssemblerX86::EmitFixup(AssemblerFixup *fixup) { | 808 inline void AssemblerX86::EmitFixup(AssemblerFixup *fixup) { |
790 buffer_.EmitFixup(fixup); | 809 buffer_.EmitFixup(fixup); |
791 } | 810 } |
792 | 811 |
793 inline void AssemblerX86::EmitOperandSizeOverride() { EmitUint8(0x66); } | 812 inline void AssemblerX86::EmitOperandSizeOverride() { EmitUint8(0x66); } |
794 | 813 |
795 } // end of namespace x86 | 814 } // end of namespace x86 |
796 } // end of namespace Ice | 815 } // end of namespace Ice |
797 | 816 |
798 #endif // SUBZERO_SRC_ASSEMBLER_IA32_H_ | 817 #endif // SUBZERO_SRC_ASSEMBLER_IA32_H_ |
OLD | NEW |