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

Side by Side Diff: src/IceAssemblerX8632.h

Issue 1179563004: Renames the assembler* files. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Changes the top comment for IceAssemblerX8632.cpp Created 5 years, 6 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
« no previous file with comments | « src/IceAssemblerARM32.h ('k') | src/IceAssemblerX8632.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/assembler_ia32.h - Assembler for x86-32 ------*- C++ -*-===// 1 //===- subzero/src/assembler_ia32.h - Assembler for x86-32 ------*- C++ -*-===//
2 // 2 //
3 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 3 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
4 // for details. All rights reserved. Use of this source code is governed by a 4 // for details. All rights reserved. Use of this source code is governed by a
5 // BSD-style license that can be found in the LICENSE file. 5 // BSD-style license that can be found in the LICENSE file.
6 // 6 //
7 // Modified by the Subzero authors. 7 // Modified by the Subzero authors.
8 // 8 //
9 //===----------------------------------------------------------------------===// 9 //===----------------------------------------------------------------------===//
10 // 10 //
11 // The Subzero Code Generator 11 // The Subzero Code Generator
12 // 12 //
13 // This file is distributed under the University of Illinois Open Source 13 // This file is distributed under the University of Illinois Open Source
14 // License. See LICENSE.TXT for details. 14 // License. See LICENSE.TXT for details.
15 // 15 //
16 //===----------------------------------------------------------------------===// 16 //===----------------------------------------------------------------------===//
17 // 17 //
18 // This file implements the Assembler class for x86-32. 18 // This file implements the Assembler class for x86-32.
19 // 19 //
20 //===----------------------------------------------------------------------===// 20 //===----------------------------------------------------------------------===//
21 21
22 #ifndef SUBZERO_SRC_ASSEMBLER_IA32_H 22 #ifndef SUBZERO_SRC_ICEASSEMBLERX8632_H
23 #define SUBZERO_SRC_ASSEMBLER_IA32_H 23 #define SUBZERO_SRC_ICEASSEMBLERX8632_H
24 24
25 #include "IceAssembler.h"
25 #include "IceConditionCodesX8632.h" 26 #include "IceConditionCodesX8632.h"
26 #include "IceDefs.h" 27 #include "IceDefs.h"
27 #include "IceOperand.h" 28 #include "IceOperand.h"
28 #include "IceRegistersX8632.h" 29 #include "IceRegistersX8632.h"
29 #include "IceTypes.h" 30 #include "IceTypes.h"
30 #include "IceUtils.h" 31 #include "IceUtils.h"
31 32
32 #include "assembler.h"
33
34 namespace Ice { 33 namespace Ice {
35 34
36 using RegX8632::GPRRegister; 35 using RegX8632::GPRRegister;
37 using RegX8632::XmmRegister; 36 using RegX8632::XmmRegister;
38 using RegX8632::ByteRegister; 37 using RegX8632::ByteRegister;
39 using RegX8632::X87STRegister; 38 using RegX8632::X87STRegister;
40 39
41 namespace X8632 { 40 namespace X8632 {
42 41
43 const int MAX_NOP_SIZE = 8; 42 const int MAX_NOP_SIZE = 8;
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 void padWithNop(intptr_t Padding) override { 361 void padWithNop(intptr_t Padding) override {
363 while (Padding > MAX_NOP_SIZE) { 362 while (Padding > MAX_NOP_SIZE) {
364 nop(MAX_NOP_SIZE); 363 nop(MAX_NOP_SIZE);
365 Padding -= MAX_NOP_SIZE; 364 Padding -= MAX_NOP_SIZE;
366 } 365 }
367 if (Padding) 366 if (Padding)
368 nop(Padding); 367 nop(Padding);
369 } 368 }
370 369
371 Label *GetOrCreateCfgNodeLabel(SizeT NodeNumber); 370 Label *GetOrCreateCfgNodeLabel(SizeT NodeNumber);
372 void BindCfgNodeLabel(SizeT NodeNumber) override; 371 void bindCfgNodeLabel(SizeT NodeNumber) override;
373 Label *GetOrCreateLocalLabel(SizeT Number); 372 Label *GetOrCreateLocalLabel(SizeT Number);
374 void BindLocalLabel(SizeT Number); 373 void BindLocalLabel(SizeT Number);
375 374
376 bool fixupIsPCRel(FixupKind Kind) const override { 375 bool fixupIsPCRel(FixupKind Kind) const override {
377 // Currently assuming this is the only PC-rel relocation type used. 376 // Currently assuming this is the only PC-rel relocation type used.
378 return Kind == llvm::ELF::R_386_PC32; 377 return Kind == llvm::ELF::R_386_PC32;
379 } 378 }
380 379
381 // Operations to emit GPR instructions (and dispatch on operand type). 380 // Operations to emit GPR instructions (and dispatch on operand type).
382 typedef void (AssemblerX8632::*TypedEmitGPR)(Type, GPRRegister); 381 typedef void (AssemblerX8632::*TypedEmitGPR)(Type, GPRRegister);
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 void jmp(const ConstantRelocatable *label); 812 void jmp(const ConstantRelocatable *label);
814 813
815 void mfence(); 814 void mfence();
816 815
817 void lock(); 816 void lock();
818 void cmpxchg(Type Ty, const Address &address, GPRRegister reg, bool Locked); 817 void cmpxchg(Type Ty, const Address &address, GPRRegister reg, bool Locked);
819 void cmpxchg8b(const Address &address, bool Locked); 818 void cmpxchg8b(const Address &address, bool Locked);
820 void xadd(Type Ty, const Address &address, GPRRegister reg, bool Locked); 819 void xadd(Type Ty, const Address &address, GPRRegister reg, bool Locked);
821 void xchg(Type Ty, const Address &address, GPRRegister reg); 820 void xchg(Type Ty, const Address &address, GPRRegister reg);
822 821
823 void EmitSegmentOverride(uint8_t prefix); 822 void emitSegmentOverride(uint8_t prefix);
824 823
825 intptr_t PreferredLoopAlignment() { return 16; } 824 intptr_t preferredLoopAlignment() { return 16; }
826 void Align(intptr_t alignment, intptr_t offset); 825 void align(intptr_t alignment, intptr_t offset);
827 void Bind(Label *label); 826 void bind(Label *label);
828 827
829 intptr_t CodeSize() const { return buffer_.Size(); } 828 intptr_t CodeSize() const { return Buffer.size(); }
830 829
831 private: 830 private:
832 inline void EmitUint8(uint8_t value); 831 inline void emitUint8(uint8_t value);
833 inline void EmitInt16(int16_t value); 832 inline void emitInt16(int16_t value);
834 inline void EmitInt32(int32_t value); 833 inline void emitInt32(int32_t value);
835 inline void EmitRegisterOperand(int rm, int reg); 834 inline void emitRegisterOperand(int rm, int reg);
836 inline void EmitXmmRegisterOperand(int rm, XmmRegister reg); 835 inline void emitXmmRegisterOperand(int rm, XmmRegister reg);
837 inline void EmitFixup(AssemblerFixup *fixup); 836 inline void emitFixup(AssemblerFixup *fixup);
838 inline void EmitOperandSizeOverride(); 837 inline void emitOperandSizeOverride();
839 838
840 void EmitOperand(int rm, const Operand &operand); 839 void emitOperand(int rm, const Operand &operand);
841 void EmitImmediate(Type ty, const Immediate &imm); 840 void emitImmediate(Type ty, const Immediate &imm);
842 void EmitComplexI8(int rm, const Operand &operand, 841 void emitComplexI8(int rm, const Operand &operand,
843 const Immediate &immediate); 842 const Immediate &immediate);
844 void EmitComplex(Type Ty, int rm, const Operand &operand, 843 void emitComplex(Type Ty, int rm, const Operand &operand,
845 const Immediate &immediate); 844 const Immediate &immediate);
846 void EmitLabel(Label *label, intptr_t instruction_size); 845 void emitLabel(Label *label, intptr_t instruction_size);
847 void EmitLabelLink(Label *label); 846 void emitLabelLink(Label *label);
848 void EmitNearLabelLink(Label *label); 847 void emitNearLabelLink(Label *label);
849 848
850 void EmitGenericShift(int rm, Type Ty, GPRRegister reg, const Immediate &imm); 849 void emitGenericShift(int rm, Type Ty, GPRRegister reg, const Immediate &imm);
851 void EmitGenericShift(int rm, Type Ty, const Operand &operand, 850 void emitGenericShift(int rm, Type Ty, const Operand &operand,
852 GPRRegister shifter); 851 GPRRegister shifter);
853 852
854 typedef std::vector<Label *> LabelVector; 853 typedef std::vector<Label *> LabelVector;
855 // A vector of pool-allocated x86 labels for CFG nodes. 854 // A vector of pool-allocated x86 labels for CFG nodes.
856 LabelVector CfgNodeLabels; 855 LabelVector CfgNodeLabels;
857 // A vector of pool-allocated x86 labels for Local labels. 856 // A vector of pool-allocated x86 labels for Local labels.
858 LabelVector LocalLabels; 857 LabelVector LocalLabels;
859 858
860 Label *GetOrCreateLabel(SizeT Number, LabelVector &Labels); 859 Label *GetOrCreateLabel(SizeT Number, LabelVector &Labels);
861 }; 860 };
862 861
863 inline void AssemblerX8632::EmitUint8(uint8_t value) { 862 inline void AssemblerX8632::emitUint8(uint8_t value) {
864 buffer_.Emit<uint8_t>(value); 863 Buffer.emit<uint8_t>(value);
865 } 864 }
866 865
867 inline void AssemblerX8632::EmitInt16(int16_t value) { 866 inline void AssemblerX8632::emitInt16(int16_t value) {
868 buffer_.Emit<int16_t>(value); 867 Buffer.emit<int16_t>(value);
869 } 868 }
870 869
871 inline void AssemblerX8632::EmitInt32(int32_t value) { 870 inline void AssemblerX8632::emitInt32(int32_t value) {
872 buffer_.Emit<int32_t>(value); 871 Buffer.emit<int32_t>(value);
873 } 872 }
874 873
875 inline void AssemblerX8632::EmitRegisterOperand(int rm, int reg) { 874 inline void AssemblerX8632::emitRegisterOperand(int rm, int reg) {
876 assert(rm >= 0 && rm < 8); 875 assert(rm >= 0 && rm < 8);
877 buffer_.Emit<uint8_t>(0xC0 + (rm << 3) + reg); 876 Buffer.emit<uint8_t>(0xC0 + (rm << 3) + reg);
878 } 877 }
879 878
880 inline void AssemblerX8632::EmitXmmRegisterOperand(int rm, XmmRegister reg) { 879 inline void AssemblerX8632::emitXmmRegisterOperand(int rm, XmmRegister reg) {
881 EmitRegisterOperand(rm, static_cast<GPRRegister>(reg)); 880 emitRegisterOperand(rm, static_cast<GPRRegister>(reg));
882 } 881 }
883 882
884 inline void AssemblerX8632::EmitFixup(AssemblerFixup *fixup) { 883 inline void AssemblerX8632::emitFixup(AssemblerFixup *fixup) {
885 buffer_.EmitFixup(fixup); 884 Buffer.emitFixup(fixup);
886 } 885 }
887 886
888 inline void AssemblerX8632::EmitOperandSizeOverride() { EmitUint8(0x66); } 887 inline void AssemblerX8632::emitOperandSizeOverride() { emitUint8(0x66); }
889 888
890 } // end of namespace X8632 889 } // end of namespace X8632
891 } // end of namespace Ice 890 } // end of namespace Ice
892 891
893 #endif // SUBZERO_SRC_ASSEMBLER_IA32_H 892 #endif // SUBZERO_SRC_ICEASSEMBLERX8632_H
OLDNEW
« no previous file with comments | « src/IceAssemblerARM32.h ('k') | src/IceAssemblerX8632.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698