OLD | NEW |
1 //===- subzero/src/IceAssembler.cpp - Assembler base class ----------------===// | 1 //===- subzero/src/IceAssembler.cpp - Assembler base class ----------------===// |
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 // This is forked from Dart revision 39313. | 8 // This is forked from Dart revision 39313. |
9 // Please update the revision if we merge back changes from Dart. | 9 // Please update the revision if we merge back changes from Dart. |
10 // https://code.google.com/p/dart/wiki/GettingTheSource | 10 // https://code.google.com/p/dart/wiki/GettingTheSource |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 // Verify internal state. | 112 // Verify internal state. |
113 assert(capacity() == new_capacity); | 113 assert(capacity() == new_capacity); |
114 assert(size() == old_size); | 114 assert(size() == old_size); |
115 } | 115 } |
116 | 116 |
117 llvm::StringRef Assembler::getBufferView() const { | 117 llvm::StringRef Assembler::getBufferView() const { |
118 return llvm::StringRef(reinterpret_cast<const char *>(Buffer.contents()), | 118 return llvm::StringRef(reinterpret_cast<const char *>(Buffer.contents()), |
119 Buffer.size()); | 119 Buffer.size()); |
120 } | 120 } |
121 | 121 |
122 void Assembler::emitIASBytes(GlobalContext *Ctx) const { | 122 void Assembler::emitIASBytes() const { |
123 Ostream &Str = Ctx->getStrEmit(); | 123 Ostream &Str = Ctx->getStrEmit(); |
124 intptr_t EndPosition = Buffer.size(); | 124 intptr_t EndPosition = Buffer.size(); |
125 intptr_t CurPosition = 0; | 125 intptr_t CurPosition = 0; |
126 const intptr_t FixupSize = 4; | 126 const intptr_t FixupSize = 4; |
127 for (const AssemblerFixup *NextFixup : fixups()) { | 127 for (const AssemblerFixup *NextFixup : fixups()) { |
128 intptr_t NextFixupLoc = NextFixup->position(); | 128 intptr_t NextFixupLoc = NextFixup->position(); |
129 for (intptr_t i = CurPosition; i < NextFixupLoc; ++i) { | 129 for (intptr_t i = CurPosition; i < NextFixupLoc; ++i) { |
130 Str << "\t.byte 0x"; | 130 Str << "\t.byte 0x"; |
131 Str.write_hex(Buffer.load<uint8_t>(i)); | 131 Str.write_hex(Buffer.load<uint8_t>(i)); |
132 Str << "\n"; | 132 Str << "\n"; |
(...skipping 12 matching lines...) Expand all Loading... |
145 } | 145 } |
146 // Handle any bytes that are not prefixed by a fixup. | 146 // Handle any bytes that are not prefixed by a fixup. |
147 for (intptr_t i = CurPosition; i < EndPosition; ++i) { | 147 for (intptr_t i = CurPosition; i < EndPosition; ++i) { |
148 Str << "\t.byte 0x"; | 148 Str << "\t.byte 0x"; |
149 Str.write_hex(Buffer.load<uint8_t>(i)); | 149 Str.write_hex(Buffer.load<uint8_t>(i)); |
150 Str << "\n"; | 150 Str << "\n"; |
151 } | 151 } |
152 } | 152 } |
153 | 153 |
154 } // end of namespace Ice | 154 } // end of namespace Ice |
OLD | NEW |