| OLD | NEW |
| 1 //===- subzero/src/assembler_ia32.h - Assembler for x86-32 ------*- C++ -*-===// | 1 //===- subzero/src/assembler_ia32.h - Assembler for x86-32 ------*- C++ -*-===// |
| 2 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 2 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 3 // for details. All rights reserved. Use of this source code is governed by a | 3 // for details. All rights reserved. Use of this source code is governed by a |
| 4 // BSD-style license that can be found in the LICENSE file. | 4 // BSD-style license that can be found in the LICENSE file. |
| 5 // | 5 // |
| 6 // Modified by the Subzero authors. | 6 // Modified by the Subzero authors. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 // | 9 // |
| 10 // The Subzero Code Generator | 10 // The Subzero Code Generator |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 DisplacementRelocation(const DisplacementRelocation &) = delete; | 49 DisplacementRelocation(const DisplacementRelocation &) = delete; |
| 50 DisplacementRelocation &operator=(const DisplacementRelocation &) = delete; | 50 DisplacementRelocation &operator=(const DisplacementRelocation &) = delete; |
| 51 | 51 |
| 52 public: | 52 public: |
| 53 static DisplacementRelocation *create(Assembler *Asm, FixupKind Kind, | 53 static DisplacementRelocation *create(Assembler *Asm, FixupKind Kind, |
| 54 const ConstantRelocatable *Sym) { | 54 const ConstantRelocatable *Sym) { |
| 55 return new (Asm->Allocate<DisplacementRelocation>()) | 55 return new (Asm->Allocate<DisplacementRelocation>()) |
| 56 DisplacementRelocation(Kind, Sym); | 56 DisplacementRelocation(Kind, Sym); |
| 57 } | 57 } |
| 58 | 58 |
| 59 void Process(const MemoryRegion ®ion, intptr_t position) override { | |
| 60 (void)region; | |
| 61 (void)position; | |
| 62 llvm_unreachable("We might not be using this Process() method later."); | |
| 63 } | |
| 64 | |
| 65 private: | 59 private: |
| 66 DisplacementRelocation(FixupKind Kind, const ConstantRelocatable *Sym) | 60 DisplacementRelocation(FixupKind Kind, const ConstantRelocatable *Sym) |
| 67 : AssemblerFixup(Kind, Sym) {} | 61 : AssemblerFixup(Kind, Sym) {} |
| 68 }; | 62 }; |
| 69 | 63 |
| 70 class Immediate { | 64 class Immediate { |
| 71 Immediate(const Immediate &) = delete; | 65 Immediate(const Immediate &) = delete; |
| 72 Immediate &operator=(const Immediate &) = delete; | 66 Immediate &operator=(const Immediate &) = delete; |
| 73 | 67 |
| 74 public: | 68 public: |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 explicit AssemblerX86(bool use_far_branches = false) : Assembler() { | 361 explicit AssemblerX86(bool use_far_branches = false) : Assembler() { |
| 368 // This mode is only needed and implemented for MIPS and ARM. | 362 // This mode is only needed and implemented for MIPS and ARM. |
| 369 assert(!use_far_branches); | 363 assert(!use_far_branches); |
| 370 (void)use_far_branches; | 364 (void)use_far_branches; |
| 371 } | 365 } |
| 372 ~AssemblerX86() override; | 366 ~AssemblerX86() override; |
| 373 | 367 |
| 374 static const bool kNearJump = true; | 368 static const bool kNearJump = true; |
| 375 static const bool kFarJump = false; | 369 static const bool kFarJump = false; |
| 376 | 370 |
| 371 void alignFunction() override; |
| 372 |
| 373 SizeT getBundleAlignLog2Bytes() const override { return 5; } |
| 374 |
| 375 llvm::ArrayRef<uint8_t> getNonExecBundlePadding() const override { |
| 376 static const uint8_t Padding[] = {0xF4}; |
| 377 return llvm::ArrayRef<uint8_t>(Padding, 1); |
| 378 } |
| 379 |
| 377 Label *GetOrCreateCfgNodeLabel(SizeT NodeNumber); | 380 Label *GetOrCreateCfgNodeLabel(SizeT NodeNumber); |
| 378 void BindCfgNodeLabel(SizeT NodeNumber) override; | 381 void BindCfgNodeLabel(SizeT NodeNumber) override; |
| 379 Label *GetOrCreateLocalLabel(SizeT Number); | 382 Label *GetOrCreateLocalLabel(SizeT Number); |
| 380 void BindLocalLabel(SizeT Number); | 383 void BindLocalLabel(SizeT Number); |
| 381 | 384 |
| 382 // Operations to emit GPR instructions (and dispatch on operand type). | 385 // Operations to emit GPR instructions (and dispatch on operand type). |
| 383 typedef void (AssemblerX86::*TypedEmitGPR)(Type, GPRRegister); | 386 typedef void (AssemblerX86::*TypedEmitGPR)(Type, GPRRegister); |
| 384 typedef void (AssemblerX86::*TypedEmitAddr)(Type, const Address &); | 387 typedef void (AssemblerX86::*TypedEmitAddr)(Type, const Address &); |
| 385 struct GPREmitterOneOp { | 388 struct GPREmitterOneOp { |
| 386 TypedEmitGPR Reg; | 389 TypedEmitGPR Reg; |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 } | 821 } |
| 819 | 822 |
| 820 void EmitSegmentOverride(uint8_t prefix); | 823 void EmitSegmentOverride(uint8_t prefix); |
| 821 | 824 |
| 822 intptr_t PreferredLoopAlignment() { return 16; } | 825 intptr_t PreferredLoopAlignment() { return 16; } |
| 823 void Align(intptr_t alignment, intptr_t offset); | 826 void Align(intptr_t alignment, intptr_t offset); |
| 824 void Bind(Label *label); | 827 void Bind(Label *label); |
| 825 | 828 |
| 826 intptr_t CodeSize() const { return buffer_.Size(); } | 829 intptr_t CodeSize() const { return buffer_.Size(); } |
| 827 | 830 |
| 828 void FinalizeInstructions(const MemoryRegion ®ion) { | |
| 829 buffer_.FinalizeInstructions(region); | |
| 830 } | |
| 831 | |
| 832 private: | 831 private: |
| 833 inline void EmitUint8(uint8_t value); | 832 inline void EmitUint8(uint8_t value); |
| 834 inline void EmitInt16(int16_t value); | 833 inline void EmitInt16(int16_t value); |
| 835 inline void EmitInt32(int32_t value); | 834 inline void EmitInt32(int32_t value); |
| 836 inline void EmitRegisterOperand(int rm, int reg); | 835 inline void EmitRegisterOperand(int rm, int reg); |
| 837 inline void EmitXmmRegisterOperand(int rm, XmmRegister reg); | 836 inline void EmitXmmRegisterOperand(int rm, XmmRegister reg); |
| 838 inline void EmitFixup(AssemblerFixup *fixup); | 837 inline void EmitFixup(AssemblerFixup *fixup); |
| 839 inline void EmitOperandSizeOverride(); | 838 inline void EmitOperandSizeOverride(); |
| 840 | 839 |
| 841 void EmitOperand(int rm, const Operand &operand); | 840 void EmitOperand(int rm, const Operand &operand); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 885 inline void AssemblerX86::EmitFixup(AssemblerFixup *fixup) { | 884 inline void AssemblerX86::EmitFixup(AssemblerFixup *fixup) { |
| 886 buffer_.EmitFixup(fixup); | 885 buffer_.EmitFixup(fixup); |
| 887 } | 886 } |
| 888 | 887 |
| 889 inline void AssemblerX86::EmitOperandSizeOverride() { EmitUint8(0x66); } | 888 inline void AssemblerX86::EmitOperandSizeOverride() { EmitUint8(0x66); } |
| 890 | 889 |
| 891 } // end of namespace x86 | 890 } // end of namespace x86 |
| 892 } // end of namespace Ice | 891 } // end of namespace Ice |
| 893 | 892 |
| 894 #endif // SUBZERO_SRC_ASSEMBLER_IA32_H_ | 893 #endif // SUBZERO_SRC_ASSEMBLER_IA32_H_ |
| OLD | NEW |