OLD | NEW |
1 //===- subzero/src/IceFixups.h - Assembler fixup kinds ----------*- C++ -*-===// | 1 //===- subzero/src/IceFixups.h - Assembler fixup kinds ----------*- C++ -*-===// |
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 36 matching lines...) Loading... |
47 IceString symbol(const GlobalContext *Ctx, const Assembler *Asm) const; | 47 IceString symbol(const GlobalContext *Ctx, const Assembler *Asm) const; |
48 | 48 |
49 static const Constant *NullSymbol; | 49 static const Constant *NullSymbol; |
50 bool isNullSymbol() const { return value_ == NullSymbol; } | 50 bool isNullSymbol() const { return value_ == NullSymbol; } |
51 | 51 |
52 static constexpr AssemblerFixup *NoFixup = nullptr; | 52 static constexpr AssemblerFixup *NoFixup = nullptr; |
53 | 53 |
54 void set_value(const Constant *Value) { value_ = Value; } | 54 void set_value(const Constant *Value) { value_ = Value; } |
55 | 55 |
56 void set_addend(RelocOffsetT Addend) { addend_ = Addend; } | 56 void set_addend(RelocOffsetT Addend) { addend_ = Addend; } |
| 57 RelocOffsetT get_addend() const { return addend_; } |
57 | 58 |
58 /// Emits fixup, then returns the number of bytes to skip. | 59 /// Emits fixup, then returns the number of bytes to skip. |
59 virtual size_t emit(GlobalContext *Ctx, const Assembler &Asm) const; | 60 virtual size_t emit(GlobalContext *Ctx, const Assembler &Asm) const; |
60 | 61 |
| 62 /// Emits offset() (little endian) in position_. If your fixup requires |
| 63 /// something smarter, you must create your own fixup type. |
| 64 virtual void emitOffset(Assembler *Asm) const; |
| 65 |
61 private: | 66 private: |
62 bool position_was_set_ = false; | 67 bool position_was_set_ = false; |
63 intptr_t position_ = 0; | 68 intptr_t position_ = 0; |
64 FixupKind kind_ = 0; | 69 FixupKind kind_ = 0; |
65 const Constant *value_ = nullptr; | 70 const Constant *value_ = nullptr; |
66 // An offset addend to the fixup offset (as returned by offset()), in case the | 71 // An offset addend to the fixup offset (as returned by offset()), in case the |
67 // assembler needs to adjust it. | 72 // assembler needs to adjust it. |
68 RelocOffsetT addend_ = 0; | 73 RelocOffsetT addend_ = 0; |
69 }; | 74 }; |
70 | 75 |
(...skipping 15 matching lines...) Loading... |
86 const std::string Message; | 91 const std::string Message; |
87 const size_t NumBytes; | 92 const size_t NumBytes; |
88 }; | 93 }; |
89 | 94 |
90 using FixupList = std::vector<AssemblerFixup>; | 95 using FixupList = std::vector<AssemblerFixup>; |
91 using FixupRefList = std::vector<AssemblerFixup *>; | 96 using FixupRefList = std::vector<AssemblerFixup *>; |
92 | 97 |
93 } // end of namespace Ice | 98 } // end of namespace Ice |
94 | 99 |
95 #endif // SUBZERO_SRC_ICEFIXUPS_H | 100 #endif // SUBZERO_SRC_ICEFIXUPS_H |
OLD | NEW |