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 28 matching lines...) Expand all Loading... |
39 | 39 |
40 RelocOffsetT offset() const; | 40 RelocOffsetT offset() const; |
41 IceString symbol(const GlobalContext *Ctx) const; | 41 IceString symbol(const GlobalContext *Ctx) const; |
42 | 42 |
43 static const Constant *NullSymbol; | 43 static const Constant *NullSymbol; |
44 bool isNullSymbol() const { return value_ == NullSymbol; } | 44 bool isNullSymbol() const { return value_ == NullSymbol; } |
45 | 45 |
46 void set_value(const Constant *Value) { value_ = Value; } | 46 void set_value(const Constant *Value) { value_ = Value; } |
47 | 47 |
48 /// Emits fixup, then returns the number of bytes to skip. | 48 /// Emits fixup, then returns the number of bytes to skip. |
49 virtual size_t emit(GlobalContext *Ctx, RelocOffsetT OverrideOffset, | 49 virtual size_t emit(GlobalContext *Ctx, const Assembler &Asm) const; |
50 bool IsPCRel) const; | |
51 | 50 |
52 private: | 51 private: |
53 intptr_t position_ = 0; | 52 intptr_t position_ = 0; |
54 FixupKind kind_ = 0; | 53 FixupKind kind_ = 0; |
55 const Constant *value_ = nullptr; | 54 const Constant *value_ = nullptr; |
56 }; | 55 }; |
57 | 56 |
58 /// Extends a fixup to be textual. That is, it emits text instead of a sequence | 57 /// Extends a fixup to be textual. That is, it emits text instead of a sequence |
59 /// of bytes. This class is used as a fallback for unimplemented emitIAS | 58 /// of bytes. This class is used as a fallback for unimplemented emitIAS |
60 /// methods, allowing them to generate compilable assembly code. | 59 /// methods, allowing them to generate compilable assembly code. |
61 class AssemblerTextFixup : public AssemblerFixup { | 60 class AssemblerTextFixup : public AssemblerFixup { |
62 AssemblerTextFixup() = delete; | 61 AssemblerTextFixup() = delete; |
63 AssemblerTextFixup(const AssemblerTextFixup &) = delete; | 62 AssemblerTextFixup(const AssemblerTextFixup &) = delete; |
64 AssemblerTextFixup &operator=(const AssemblerTextFixup &) = delete; | 63 AssemblerTextFixup &operator=(const AssemblerTextFixup &) = delete; |
65 | 64 |
66 public: | 65 public: |
67 AssemblerTextFixup(const std::string &Message, size_t NumBytes) | 66 AssemblerTextFixup(const std::string &Message, size_t NumBytes) |
68 : AssemblerFixup(), Message(Message), NumBytes(NumBytes) {} | 67 : AssemblerFixup(), Message(Message), NumBytes(NumBytes) {} |
69 ~AssemblerTextFixup() = default; | 68 ~AssemblerTextFixup() = default; |
70 virtual size_t emit(GlobalContext *Ctx, RelocOffsetT OverrideOffset, | 69 size_t emit(GlobalContext *Ctx, const Assembler &Asm) const override; |
71 bool isPcRel) const; | |
72 | 70 |
73 private: | 71 private: |
74 const std::string Message; | 72 const std::string Message; |
75 const size_t NumBytes; | 73 const size_t NumBytes; |
76 }; | 74 }; |
77 | 75 |
78 using FixupList = std::vector<AssemblerFixup>; | 76 using FixupList = std::vector<AssemblerFixup>; |
79 using FixupRefList = std::vector<AssemblerFixup *>; | 77 using FixupRefList = std::vector<AssemblerFixup *>; |
80 | 78 |
81 } // end of namespace Ice | 79 } // end of namespace Ice |
82 | 80 |
83 #endif // SUBZERO_SRC_ICEFIXUPS_H | 81 #endif // SUBZERO_SRC_ICEFIXUPS_H |
OLD | NEW |