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 // | 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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 private: | 245 private: |
246 Address() = default; // Needed by Address::Absolute. | 246 Address() = default; // Needed by Address::Absolute. |
247 }; | 247 }; |
248 | 248 |
249 class Label { | 249 class Label { |
250 Label(const Label &) = delete; | 250 Label(const Label &) = delete; |
251 Label &operator=(const Label &) = delete; | 251 Label &operator=(const Label &) = delete; |
252 | 252 |
253 public: | 253 public: |
254 Label() { | 254 Label() { |
255 #ifndef NDEBUG | 255 if (BuildDefs::asserts()) { |
256 for (int i = 0; i < kMaxUnresolvedBranches; i++) { | 256 for (int i = 0; i < kMaxUnresolvedBranches; i++) { |
257 unresolved_near_positions_[i] = -1; | 257 unresolved_near_positions_[i] = -1; |
| 258 } |
258 } | 259 } |
259 #endif // !NDEBUG | |
260 } | 260 } |
261 | 261 |
262 ~Label() = default; | 262 ~Label() = default; |
263 | 263 |
264 void FinalCheck() const { | 264 void FinalCheck() const { |
265 // Assert if label is being destroyed with unresolved branches pending. | 265 // Assert if label is being destroyed with unresolved branches pending. |
266 assert(!IsLinked()); | 266 assert(!IsLinked()); |
267 assert(!HasNear()); | 267 assert(!HasNear()); |
268 } | 268 } |
269 | 269 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 position_ = position + kWordSize; | 314 position_ = position + kWordSize; |
315 assert(IsLinked()); | 315 assert(IsLinked()); |
316 } | 316 } |
317 | 317 |
318 void NearLinkTo(intptr_t position) { | 318 void NearLinkTo(intptr_t position) { |
319 assert(!IsBound()); | 319 assert(!IsBound()); |
320 assert(num_unresolved_ < kMaxUnresolvedBranches); | 320 assert(num_unresolved_ < kMaxUnresolvedBranches); |
321 unresolved_near_positions_[num_unresolved_++] = position; | 321 unresolved_near_positions_[num_unresolved_++] = position; |
322 } | 322 } |
323 | 323 |
324 static const int kMaxUnresolvedBranches = 20; | 324 static constexpr int kMaxUnresolvedBranches = 20; |
325 | 325 |
326 intptr_t position_ = 0; | 326 intptr_t position_ = 0; |
327 intptr_t num_unresolved_ = 0; | 327 intptr_t num_unresolved_ = 0; |
328 // TODO(stichnot,jvoung): Can this instead be | 328 // TODO(stichnot,jvoung): Can this instead be |
329 // llvm::SmallVector<intptr_t, kMaxUnresolvedBranches> ? | 329 // llvm::SmallVector<intptr_t, kMaxUnresolvedBranches> ? |
330 intptr_t unresolved_near_positions_[kMaxUnresolvedBranches]; | 330 intptr_t unresolved_near_positions_[kMaxUnresolvedBranches]; |
331 | 331 |
332 friend class AssemblerX8632; | 332 friend class AssemblerX8632; |
333 }; | 333 }; |
334 | 334 |
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 inline void AssemblerX8632::emitFixup(AssemblerFixup *fixup) { | 915 inline void AssemblerX8632::emitFixup(AssemblerFixup *fixup) { |
916 Buffer.emitFixup(fixup); | 916 Buffer.emitFixup(fixup); |
917 } | 917 } |
918 | 918 |
919 inline void AssemblerX8632::emitOperandSizeOverride() { emitUint8(0x66); } | 919 inline void AssemblerX8632::emitOperandSizeOverride() { emitUint8(0x66); } |
920 | 920 |
921 } // end of namespace X8632 | 921 } // end of namespace X8632 |
922 } // end of namespace Ice | 922 } // end of namespace Ice |
923 | 923 |
924 #endif // SUBZERO_SRC_ICEASSEMBLERX8632_H | 924 #endif // SUBZERO_SRC_ICEASSEMBLERX8632_H |
OLD | NEW |