| OLD | NEW |
| 1 //===- subzero/src/IceFixups.cpp - Implementation of Assembler Fixups -----===// | 1 //===- subzero/src/IceFixups.cpp - Implementation of Assembler Fixups -----===// |
| 2 // | 2 // |
| 3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 /// | 9 /// |
| 10 /// \file | 10 /// \file |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 Str << Ctx->mangleName(CR->getName()); | 41 Str << Ctx->mangleName(CR->getName()); |
| 42 } else { | 42 } else { |
| 43 // NOTE: currently only float/doubles are put into constant pools. In the | 43 // NOTE: currently only float/doubles are put into constant pools. In the |
| 44 // future we may put integers as well. | 44 // future we may put integers as well. |
| 45 assert(llvm::isa<ConstantFloat>(C) || llvm::isa<ConstantDouble>(C)); | 45 assert(llvm::isa<ConstantFloat>(C) || llvm::isa<ConstantDouble>(C)); |
| 46 C->emitPoolLabel(Str, Ctx); | 46 C->emitPoolLabel(Str, Ctx); |
| 47 } | 47 } |
| 48 return Str.str(); | 48 return Str.str(); |
| 49 } | 49 } |
| 50 | 50 |
| 51 size_t AssemblerFixup::emit(GlobalContext *Ctx, RelocOffsetT OverrideOffset, | 51 size_t AssemblerFixup::emit(GlobalContext *Ctx, const Assembler &Asm) const { |
| 52 bool IsPCRel) const { | |
| 53 static constexpr const size_t FixupSize = 4; | 52 static constexpr const size_t FixupSize = 4; |
| 54 if (!BuildDefs::dump()) | 53 if (!BuildDefs::dump()) |
| 55 return FixupSize; | 54 return FixupSize; |
| 56 Ostream &Str = Ctx->getStrEmit(); | 55 Ostream &Str = Ctx->getStrEmit(); |
| 57 Str << "\t.long "; | 56 Str << "\t.long "; |
| 58 if (isNullSymbol()) | 57 if (isNullSymbol()) |
| 59 Str << "__Sz_AbsoluteZero"; | 58 Str << "__Sz_AbsoluteZero"; |
| 60 else | 59 else |
| 61 Str << symbol(Ctx); | 60 Str << symbol(Ctx); |
| 62 RelocOffsetT Offset = OverrideOffset; | 61 RelocOffsetT Offset = Asm.load<RelocOffsetT>(position()); |
| 63 if (Offset) | 62 if (Offset) |
| 64 Str << " + " << Offset; | 63 Str << " + " << Offset; |
| 65 // For PCRel fixups, we write the pc-offset from a symbol into the Buffer | 64 // For PCRel fixups, we write the pc-offset from a symbol into the Buffer |
| 66 // (e.g., -4), but we don't represent that in the fixup's offset. Otherwise | 65 // (e.g., -4), but we don't represent that in the fixup's offset. Otherwise |
| 67 // the fixup holds the true offset, and so does the Buffer. Just load the | 66 // the fixup holds the true offset, and so does the Buffer. Just load the |
| 68 // offset from the buffer. | 67 // offset from the buffer. |
| 69 if (IsPCRel) | 68 if (Asm.fixupIsPCRel(kind())) |
| 70 Str << " - ."; | 69 Str << " - ."; |
| 71 Str << "\n"; | 70 Str << "\n"; |
| 72 return FixupSize; | 71 return FixupSize; |
| 73 } | 72 } |
| 74 | 73 |
| 75 size_t AssemblerTextFixup::emit(GlobalContext *Ctx, RelocOffsetT OverrideOffset, | 74 size_t AssemblerTextFixup::emit(GlobalContext *Ctx, const Assembler &) const { |
| 76 bool IsPCRel) const { | |
| 77 (void)OverrideOffset; | |
| 78 (void)IsPCRel; | |
| 79 Ctx->getStrEmit() << Message << "\n"; | 75 Ctx->getStrEmit() << Message << "\n"; |
| 80 return NumBytes; | 76 return NumBytes; |
| 81 } | 77 } |
| 82 | 78 |
| 83 } // end of namespace Ice | 79 } // end of namespace Ice |
| OLD | NEW |