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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 Ostream &Str = Ctx->getStrEmit(); | 137 Ostream &Str = Ctx->getStrEmit(); |
138 intptr_t EndPosition = Buffer.size(); | 138 intptr_t EndPosition = Buffer.size(); |
139 intptr_t CurPosition = 0; | 139 intptr_t CurPosition = 0; |
140 for (const AssemblerFixup *NextFixup : fixups()) { | 140 for (const AssemblerFixup *NextFixup : fixups()) { |
141 intptr_t NextFixupLoc = NextFixup->position(); | 141 intptr_t NextFixupLoc = NextFixup->position(); |
142 for (intptr_t i = CurPosition; i < NextFixupLoc; ++i) { | 142 for (intptr_t i = CurPosition; i < NextFixupLoc; ++i) { |
143 Str << "\t.byte 0x"; | 143 Str << "\t.byte 0x"; |
144 Str.write_hex(Buffer.load<uint8_t>(i)); | 144 Str.write_hex(Buffer.load<uint8_t>(i)); |
145 Str << "\n"; | 145 Str << "\n"; |
146 } | 146 } |
147 // For PCRel fixups, we write the pc-offset from a symbol into the Buffer | 147 CurPosition = NextFixupLoc + NextFixup->emit(Ctx, *this); |
148 // (e.g., -4), but we don't represent that in the fixup's offset. Otherwise | |
149 // the fixup holds the true offset, and so does the Buffer. Just load the | |
150 // offset from the buffer. | |
151 CurPosition = NextFixupLoc + | |
152 NextFixup->emit(Ctx, Buffer.load<RelocOffsetT>(NextFixupLoc), | |
153 fixupIsPCRel(NextFixup->kind())); | |
154 assert(CurPosition <= EndPosition); | 148 assert(CurPosition <= EndPosition); |
155 } | 149 } |
156 // Handle any bytes that are not prefixed by a fixup. | 150 // Handle any bytes that are not prefixed by a fixup. |
157 for (intptr_t i = CurPosition; i < EndPosition; ++i) { | 151 for (intptr_t i = CurPosition; i < EndPosition; ++i) { |
158 Str << "\t.byte 0x"; | 152 Str << "\t.byte 0x"; |
159 Str.write_hex(Buffer.load<uint8_t>(i)); | 153 Str.write_hex(Buffer.load<uint8_t>(i)); |
160 Str << "\n"; | 154 Str << "\n"; |
161 } | 155 } |
162 } | 156 } |
163 | 157 |
164 } // end of namespace Ice | 158 } // end of namespace Ice |
OLD | NEW |