Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(428)

Side by Side Diff: src/IceFixups.h

Issue 1669443002: Subzero. Uses fixups to calculate addend to relocations. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Addresses comments. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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...) Expand 10 before | Expand all | Expand 10 after
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...) Expand all
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698