Chromium Code Reviews| 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 // This file declares generic fixup types. | 10 // This file declares generic fixup types. |
| 11 // | 11 // |
| 12 //===----------------------------------------------------------------------===// | 12 //===----------------------------------------------------------------------===// |
| 13 | 13 |
| 14 #ifndef SUBZERO_SRC_ICEFIXUPS_H | 14 #ifndef SUBZERO_SRC_ICEFIXUPS_H |
| 15 #define SUBZERO_SRC_ICEFIXUPS_H | 15 #define SUBZERO_SRC_ICEFIXUPS_H |
| 16 | 16 |
| 17 #include "IceTypes.def" | 17 #include "IceDefs.h" |
| 18 | 18 |
| 19 namespace Ice { | 19 namespace Ice { |
| 20 | 20 |
| 21 enum FixupKind { | 21 class ConstantRelocatable; |
|
Jim Stichnoth
2015/01/12 21:39:32
Is this forward declaration needed?
jvoung (off chromium)
2015/01/12 22:41:28
Oops no -- done.
| |
| 22 // Specify some of the most common relocation types. | |
| 23 FK_Abs_4 = 0, | |
| 24 FK_PcRel_4 = 1, | |
| 25 | 22 |
| 26 // Target specific relocation types follow this. | 23 // Each target and container format has a different namespace of relocations. |
| 27 FK_FirstTargetSpecific = 1 << 4 | 24 // This holds the specific target+container format's relocation number. |
| 25 typedef uint32_t FixupKind; | |
| 26 | |
| 27 // Assembler fixups are positions in generated code/data that hold relocation | |
| 28 // information that needs to be processed before finalizing the code/data. | |
| 29 struct AssemblerFixup { | |
| 30 public: | |
| 31 intptr_t position() const { return position_; } | |
| 32 void set_position(intptr_t Position) { position_ = Position; } | |
| 33 | |
| 34 FixupKind kind() const { return kind_; } | |
| 35 void set_kind(FixupKind Kind) { kind_ = Kind; } | |
| 36 | |
| 37 RelocOffsetT offset() const; | |
| 38 IceString symbol(const GlobalContext *Ctx) const; | |
| 39 void set_value(const Constant *Value) { value_ = Value; } | |
| 40 | |
| 41 void emit(GlobalContext *Ctx) const; | |
| 42 | |
| 43 private: | |
| 44 intptr_t position_; | |
| 45 FixupKind kind_; | |
| 46 const Constant *value_; | |
| 28 }; | 47 }; |
| 29 | 48 |
| 49 typedef std::vector<AssemblerFixup> FixupList; | |
| 50 typedef std::vector<AssemblerFixup *> FixupRefList; | |
| 51 | |
| 30 } // end of namespace Ice | 52 } // end of namespace Ice |
| 31 | 53 |
| 32 #endif // SUBZERO_SRC_ICEFIXUPS_H | 54 #endif // SUBZERO_SRC_ICEFIXUPS_H |
| OLD | NEW |