Jan Voung | 8acded0 | 2014-09-22 18:02:25 -0700 | [diff] [blame] | 1 | //===- subzero/src/IceFixups.h - Assembler fixup kinds ----------*- C++ -*-===// |
| 2 | // |
| 3 | // The Subzero Code Generator |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file declares generic fixup types. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef SUBZERO_SRC_ICEFIXUPS_H |
| 15 | #define SUBZERO_SRC_ICEFIXUPS_H |
| 16 | |
Jan Voung | ec27073 | 2015-01-12 17:00:22 -0800 | [diff] [blame^] | 17 | #include "IceDefs.h" |
Jan Voung | 8acded0 | 2014-09-22 18:02:25 -0700 | [diff] [blame] | 18 | |
| 19 | namespace Ice { |
| 20 | |
Jan Voung | ec27073 | 2015-01-12 17:00:22 -0800 | [diff] [blame^] | 21 | // Each target and container format has a different namespace of relocations. |
| 22 | // This holds the specific target+container format's relocation number. |
| 23 | typedef uint32_t FixupKind; |
Jan Voung | 8acded0 | 2014-09-22 18:02:25 -0700 | [diff] [blame] | 24 | |
Jan Voung | ec27073 | 2015-01-12 17:00:22 -0800 | [diff] [blame^] | 25 | // Assembler fixups are positions in generated code/data that hold relocation |
| 26 | // information that needs to be processed before finalizing the code/data. |
| 27 | struct AssemblerFixup { |
| 28 | public: |
| 29 | intptr_t position() const { return position_; } |
| 30 | void set_position(intptr_t Position) { position_ = Position; } |
| 31 | |
| 32 | FixupKind kind() const { return kind_; } |
| 33 | void set_kind(FixupKind Kind) { kind_ = Kind; } |
| 34 | |
| 35 | RelocOffsetT offset() const; |
| 36 | IceString symbol(const GlobalContext *Ctx) const; |
| 37 | void set_value(const Constant *Value) { value_ = Value; } |
| 38 | |
| 39 | void emit(GlobalContext *Ctx) const; |
| 40 | |
| 41 | private: |
| 42 | intptr_t position_; |
| 43 | FixupKind kind_; |
| 44 | const Constant *value_; |
Jan Voung | 8acded0 | 2014-09-22 18:02:25 -0700 | [diff] [blame] | 45 | }; |
| 46 | |
Jan Voung | ec27073 | 2015-01-12 17:00:22 -0800 | [diff] [blame^] | 47 | typedef std::vector<AssemblerFixup> FixupList; |
| 48 | typedef std::vector<AssemblerFixup *> FixupRefList; |
| 49 | |
Jan Voung | 8acded0 | 2014-09-22 18:02:25 -0700 | [diff] [blame] | 50 | } // end of namespace Ice |
| 51 | |
| 52 | #endif // SUBZERO_SRC_ICEFIXUPS_H |