| 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 // Verify internal state. | 125 // Verify internal state. |
| 126 assert(capacity() == new_capacity); | 126 assert(capacity() == new_capacity); |
| 127 assert(size() == old_size); | 127 assert(size() == old_size); |
| 128 } | 128 } |
| 129 | 129 |
| 130 llvm::StringRef Assembler::getBufferView() const { | 130 llvm::StringRef Assembler::getBufferView() const { |
| 131 return llvm::StringRef(reinterpret_cast<const char *>(Buffer.contents()), | 131 return llvm::StringRef(reinterpret_cast<const char *>(Buffer.contents()), |
| 132 Buffer.size()); | 132 Buffer.size()); |
| 133 } | 133 } |
| 134 | 134 |
| 135 void Assembler::emitIASBytes() const { | 135 void Assembler::emitIASBytes(GlobalContext *Ctx) const { |
| 136 Ostream &Str = Ctx->getStrEmit(); | 136 Ostream &Str = Ctx->getStrEmit(); |
| 137 intptr_t EndPosition = Buffer.size(); | 137 intptr_t EndPosition = Buffer.size(); |
| 138 intptr_t CurPosition = 0; | 138 intptr_t CurPosition = 0; |
| 139 for (const AssemblerFixup *NextFixup : fixups()) { | 139 for (const AssemblerFixup *NextFixup : fixups()) { |
| 140 intptr_t NextFixupLoc = NextFixup->position(); | 140 intptr_t NextFixupLoc = NextFixup->position(); |
| 141 for (intptr_t i = CurPosition; i < NextFixupLoc; ++i) { | 141 for (intptr_t i = CurPosition; i < NextFixupLoc; ++i) { |
| 142 Str << "\t.byte 0x"; | 142 Str << "\t.byte 0x"; |
| 143 Str.write_hex(Buffer.load<uint8_t>(i)); | 143 Str.write_hex(Buffer.load<uint8_t>(i)); |
| 144 Str << "\n"; | 144 Str << "\n"; |
| 145 } | 145 } |
| 146 CurPosition = NextFixupLoc + NextFixup->emit(Ctx, *this); | 146 CurPosition = NextFixupLoc + NextFixup->emit(Ctx, *this); |
| 147 assert(CurPosition <= EndPosition); | 147 assert(CurPosition <= EndPosition); |
| 148 } | 148 } |
| 149 // Handle any bytes that are not prefixed by a fixup. | 149 // Handle any bytes that are not prefixed by a fixup. |
| 150 for (intptr_t i = CurPosition; i < EndPosition; ++i) { | 150 for (intptr_t i = CurPosition; i < EndPosition; ++i) { |
| 151 Str << "\t.byte 0x"; | 151 Str << "\t.byte 0x"; |
| 152 Str.write_hex(Buffer.load<uint8_t>(i)); | 152 Str.write_hex(Buffer.load<uint8_t>(i)); |
| 153 Str << "\n"; | 153 Str << "\n"; |
| 154 } | 154 } |
| 155 } | 155 } |
| 156 | 156 |
| 157 } // end of namespace Ice | 157 } // end of namespace Ice |
| OLD | NEW |