OLD | NEW |
1 //===- subzero/src/IceAssembler.h - Integrated assembler --------*- C++ -*-===// | 1 //===- subzero/src/IceAssembler.h - Integrated assembler --------*- C++ -*-===// |
2 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 2 // Copyright (c) 2012, 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 89 |
90 bool HasEnsuredCapacity; | 90 bool HasEnsuredCapacity; |
91 bool hasEnsuredCapacity() const { return HasEnsuredCapacity; } | 91 bool hasEnsuredCapacity() const { return HasEnsuredCapacity; } |
92 #else // NDEBUG | 92 #else // NDEBUG |
93 class EnsureCapacity { | 93 class EnsureCapacity { |
94 EnsureCapacity(const EnsureCapacity &) = delete; | 94 EnsureCapacity(const EnsureCapacity &) = delete; |
95 EnsureCapacity &operator=(const EnsureCapacity &) = delete; | 95 EnsureCapacity &operator=(const EnsureCapacity &) = delete; |
96 | 96 |
97 public: | 97 public: |
98 explicit EnsureCapacity(AssemblerBuffer *Buffer) { | 98 explicit EnsureCapacity(AssemblerBuffer *Buffer) { |
99 if (Buffer->cursor() >= buffer->limit()) | 99 if (Buffer->cursor() >= Buffer->limit()) |
100 buffer->extendCapacity(); | 100 Buffer->extendCapacity(); |
101 } | 101 } |
102 }; | 102 }; |
103 | 103 |
104 // When building the C++ tests, assertion code is enabled. To allow | 104 // When building the C++ tests, assertion code is enabled. To allow |
105 // asserting that the user of the assembler buffer has ensured the | 105 // asserting that the user of the assembler buffer has ensured the |
106 // capacity needed for emitting, we add a dummy method in non-debug mode. | 106 // capacity needed for emitting, we add a dummy method in non-debug mode. |
107 bool hasEnsuredCapacity() const { return true; } | 107 bool hasEnsuredCapacity() const { return true; } |
108 #endif // NDEBUG | 108 #endif // NDEBUG |
109 | 109 |
110 // Returns the position in the instruction stream. | 110 // Returns the position in the instruction stream. |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 protected: | 228 protected: |
229 // Buffer's constructor uses the Allocator, so it needs to appear after it. | 229 // Buffer's constructor uses the Allocator, so it needs to appear after it. |
230 // TODO(jpp): dependencies on construction order are a nice way of shooting | 230 // TODO(jpp): dependencies on construction order are a nice way of shooting |
231 // yourself in the foot. Fix this. | 231 // yourself in the foot. Fix this. |
232 AssemblerBuffer Buffer; | 232 AssemblerBuffer Buffer; |
233 }; | 233 }; |
234 | 234 |
235 } // end of namespace Ice | 235 } // end of namespace Ice |
236 | 236 |
237 #endif // SUBZERO_SRC_ICEASSEMBLER_H_ | 237 #endif // SUBZERO_SRC_ICEASSEMBLER_H_ |
OLD | NEW |