| 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 17 matching lines...) Expand all Loading... |
| 28 #include "IceGlobalContext.h" | 28 #include "IceGlobalContext.h" |
| 29 #include "IceOperand.h" | 29 #include "IceOperand.h" |
| 30 | 30 |
| 31 namespace Ice { | 31 namespace Ice { |
| 32 | 32 |
| 33 static uintptr_t NewContents(Assembler &Assemblr, intptr_t Capacity) { | 33 static uintptr_t NewContents(Assembler &Assemblr, intptr_t Capacity) { |
| 34 uintptr_t Result = Assemblr.allocateBytes(Capacity); | 34 uintptr_t Result = Assemblr.allocateBytes(Capacity); |
| 35 return Result; | 35 return Result; |
| 36 } | 36 } |
| 37 | 37 |
| 38 void Label::linkTo(const Assembler &Asm, intptr_t Pos) { |
| 39 // We must not set the link until the position is absolutely known. This means |
| 40 // not during the preliminary (sandboxing) pass, and not when the instruction |
| 41 // needs a text fixup (hybrid iasm mode). |
| 42 if (Asm.getPreliminary() || Asm.needsTextFixup()) |
| 43 return; |
| 44 assert(!isBound()); |
| 45 Position = Pos + kWordSize; |
| 46 assert(isLinked()); |
| 47 } |
| 48 |
| 38 void AssemblerBuffer::installFixup(AssemblerFixup *F) { | 49 void AssemblerBuffer::installFixup(AssemblerFixup *F) { |
| 39 if (!Assemblr.getPreliminary()) | 50 if (!Assemblr.getPreliminary()) |
| 40 Fixups.push_back(F); | 51 Fixups.push_back(F); |
| 41 } | 52 } |
| 42 | 53 |
| 43 AssemblerFixup *AssemblerBuffer::createFixup(FixupKind Kind, | 54 AssemblerFixup *AssemblerBuffer::createFixup(FixupKind Kind, |
| 44 const Constant *Value) { | 55 const Constant *Value) { |
| 45 AssemblerFixup *F = | 56 AssemblerFixup *F = |
| 46 new (Assemblr.allocate<AssemblerFixup>()) AssemblerFixup(); | 57 new (Assemblr.allocate<AssemblerFixup>()) AssemblerFixup(); |
| 47 F->set_kind(Kind); | 58 F->set_kind(Kind); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 } | 159 } |
| 149 // Handle any bytes that are not prefixed by a fixup. | 160 // Handle any bytes that are not prefixed by a fixup. |
| 150 for (intptr_t i = CurPosition; i < EndPosition; ++i) { | 161 for (intptr_t i = CurPosition; i < EndPosition; ++i) { |
| 151 Str << "\t.byte 0x"; | 162 Str << "\t.byte 0x"; |
| 152 Str.write_hex(Buffer.load<uint8_t>(i)); | 163 Str.write_hex(Buffer.load<uint8_t>(i)); |
| 153 Str << "\n"; | 164 Str << "\n"; |
| 154 } | 165 } |
| 155 } | 166 } |
| 156 | 167 |
| 157 } // end of namespace Ice | 168 } // end of namespace Ice |
| OLD | NEW |