OLD | NEW |
1 //===- subzero/src/IceAssemblerX86Base.h - base x86 assembler -*- C++ -*---===// | 1 //===- subzero/src/IceAssemblerX86Base.h - base x86 assembler -*- 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 // |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 return Asm->getKind() == Traits::AsmKind; | 66 return Asm->getKind() == Traits::AsmKind; |
67 } | 67 } |
68 | 68 |
69 class Immediate { | 69 class Immediate { |
70 Immediate(const Immediate &) = delete; | 70 Immediate(const Immediate &) = delete; |
71 Immediate &operator=(const Immediate &) = delete; | 71 Immediate &operator=(const Immediate &) = delete; |
72 | 72 |
73 public: | 73 public: |
74 explicit Immediate(int32_t value) : value_(value) {} | 74 explicit Immediate(int32_t value) : value_(value) {} |
75 | 75 |
76 Immediate(RelocOffsetT offset, AssemblerFixup *fixup) | 76 explicit Immediate(AssemblerFixup *fixup) : fixup_(fixup) {} |
77 : value_(offset), fixup_(fixup) { | |
78 // Use the Offset in the "value" for now. If we decide to process fixups, | |
79 // we'll need to patch that offset with the true value. | |
80 } | |
81 | 77 |
82 int32_t value() const { return value_; } | 78 int32_t value() const { return value_; } |
83 AssemblerFixup *fixup() const { return fixup_; } | 79 AssemblerFixup *fixup() const { return fixup_; } |
84 | 80 |
85 bool is_int8() const { | 81 bool is_int8() const { |
86 // We currently only allow 32-bit fixups, and they usually have value = 0, | 82 // We currently only allow 32-bit fixups, and they usually have value = 0, |
87 // so if fixup_ != nullptr, it shouldn't be classified as int8/16. | 83 // so if fixup_ != nullptr, it shouldn't be classified as int8/16. |
88 return fixup_ == nullptr && Utils::IsInt(8, value_); | 84 return fixup_ == nullptr && Utils::IsInt(8, value_); |
89 } | 85 } |
90 bool is_uint8() const { | 86 bool is_uint8() const { |
91 return fixup_ == nullptr && Utils::IsUint(8, value_); | 87 return fixup_ == nullptr && Utils::IsUint(8, value_); |
92 } | 88 } |
93 bool is_uint16() const { | 89 bool is_uint16() const { |
94 return fixup_ == nullptr && Utils::IsUint(16, value_); | 90 return fixup_ == nullptr && Utils::IsUint(16, value_); |
95 } | 91 } |
96 | 92 |
97 private: | 93 private: |
98 const int32_t value_; | 94 const int32_t value_ = 0; |
99 AssemblerFixup *fixup_ = nullptr; | 95 AssemblerFixup *fixup_ = nullptr; |
100 }; | 96 }; |
101 | 97 |
102 /// X86 allows near and far jumps. | 98 /// X86 allows near and far jumps. |
103 class Label final : public Ice::Label { | 99 class Label final : public Ice::Label { |
104 Label(const Label &) = delete; | 100 Label(const Label &) = delete; |
105 Label &operator=(const Label &) = delete; | 101 Label &operator=(const Label &) = delete; |
106 | 102 |
107 public: | 103 public: |
108 Label() = default; | 104 Label() = default; |
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
917 emitUint8(0x66); | 913 emitUint8(0x66); |
918 } | 914 } |
919 | 915 |
920 } // end of namespace X86NAMESPACE | 916 } // end of namespace X86NAMESPACE |
921 | 917 |
922 } // end of namespace Ice | 918 } // end of namespace Ice |
923 | 919 |
924 #include "IceAssemblerX86BaseImpl.h" | 920 #include "IceAssemblerX86BaseImpl.h" |
925 | 921 |
926 #endif // SUBZERO_SRC_ICEASSEMBLERX86BASE_H | 922 #endif // SUBZERO_SRC_ICEASSEMBLERX86BASE_H |
OLD | NEW |