| 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 |
| 11 /// \brief Declares generic fixup types. | 11 /// \brief Declares generic fixup types. |
| 12 /// | 12 /// |
| 13 //===----------------------------------------------------------------------===// | 13 //===----------------------------------------------------------------------===// |
| 14 | 14 |
| 15 #ifndef SUBZERO_SRC_ICEFIXUPS_H | 15 #ifndef SUBZERO_SRC_ICEFIXUPS_H |
| 16 #define SUBZERO_SRC_ICEFIXUPS_H | 16 #define SUBZERO_SRC_ICEFIXUPS_H |
| 17 | 17 |
| 18 #include "IceDefs.h" | 18 #include "IceDefs.h" |
| 19 #include "IceStringPool.h" |
| 19 | 20 |
| 20 namespace Ice { | 21 namespace Ice { |
| 21 | 22 |
| 22 /// Each target and container format has a different namespace of relocations. | 23 /// Each target and container format has a different namespace of relocations. |
| 23 /// This holds the specific target+container format's relocation number. | 24 /// This holds the specific target+container format's relocation number. |
| 24 using FixupKind = uint32_t; | 25 using FixupKind = uint32_t; |
| 25 | 26 |
| 26 struct ELFSym; | 27 struct ELFSym; |
| 27 | 28 |
| 28 /// Assembler fixups are positions in generated code/data that hold relocation | 29 /// Assembler fixups are positions in generated code/data that hold relocation |
| 29 /// information that needs to be processed before finalizing the code/data. | 30 /// information that needs to be processed before finalizing the code/data. |
| 30 class AssemblerFixup { | 31 class AssemblerFixup { |
| 31 AssemblerFixup &operator=(const AssemblerFixup &) = delete; | 32 AssemblerFixup &operator=(const AssemblerFixup &) = delete; |
| 32 | 33 |
| 33 public: | 34 public: |
| 34 AssemblerFixup() = default; | 35 AssemblerFixup() = default; |
| 35 AssemblerFixup(const AssemblerFixup &) = default; | 36 AssemblerFixup(const AssemblerFixup &) = default; |
| 36 virtual ~AssemblerFixup() = default; | 37 virtual ~AssemblerFixup() = default; |
| 37 intptr_t position() const { return position_; } | 38 intptr_t position() const { return position_; } |
| 38 void set_position(intptr_t Position) { position_ = Position; } | 39 void set_position(intptr_t Position) { position_ = Position; } |
| 39 | 40 |
| 40 FixupKind kind() const { return kind_; } | 41 FixupKind kind() const { return kind_; } |
| 41 void set_kind(FixupKind Kind) { kind_ = Kind; } | 42 void set_kind(FixupKind Kind) { kind_ = Kind; } |
| 42 | 43 |
| 43 RelocOffsetT offset() const; | 44 RelocOffsetT offset() const; |
| 44 IceString symbol() const; | 45 GlobalString symbol() const; |
| 45 | 46 |
| 46 static const Constant *NullSymbol; | 47 static const Constant *NullSymbol; |
| 47 bool isNullSymbol() const { return ConstValue == NullSymbol; } | 48 bool isNullSymbol() const { return ConstValue == NullSymbol; } |
| 48 | 49 |
| 49 static constexpr AssemblerFixup *NoFixup = nullptr; | 50 static constexpr AssemblerFixup *NoFixup = nullptr; |
| 50 | 51 |
| 51 bool valueIsSymbol() const { return ValueIsSymbol; } | 52 bool valueIsSymbol() const { return ValueIsSymbol; } |
| 52 void set_value(const Constant *Value) { | 53 void set_value(const Constant *Value) { |
| 53 ValueIsSymbol = false; | 54 ValueIsSymbol = false; |
| 54 ConstValue = Value; | 55 ConstValue = Value; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 const std::string Message; | 107 const std::string Message; |
| 107 const size_t NumBytes; | 108 const size_t NumBytes; |
| 108 }; | 109 }; |
| 109 | 110 |
| 110 using FixupList = std::vector<AssemblerFixup>; | 111 using FixupList = std::vector<AssemblerFixup>; |
| 111 using FixupRefList = std::vector<AssemblerFixup *>; | 112 using FixupRefList = std::vector<AssemblerFixup *>; |
| 112 | 113 |
| 113 } // end of namespace Ice | 114 } // end of namespace Ice |
| 114 | 115 |
| 115 #endif // SUBZERO_SRC_ICEFIXUPS_H | 116 #endif // SUBZERO_SRC_ICEFIXUPS_H |
| OLD | NEW |