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

Side by Side Diff: src/IceFixups.h

Issue 1428443002: Enhance address mode recovery (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Streamline absolute addressing support (rip-relative on x64) Created 5 years, 1 month 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 13 matching lines...) Expand all
24 using FixupKind = uint32_t; 24 using FixupKind = uint32_t;
25 25
26 /// Assembler fixups are positions in generated code/data that hold relocation 26 /// Assembler fixups are positions in generated code/data that hold relocation
27 /// information that needs to be processed before finalizing the code/data. 27 /// information that needs to be processed before finalizing the code/data.
28 struct AssemblerFixup { 28 struct AssemblerFixup {
29 AssemblerFixup &operator=(const AssemblerFixup &) = delete; 29 AssemblerFixup &operator=(const AssemblerFixup &) = delete;
30 30
31 public: 31 public:
32 AssemblerFixup() = default; 32 AssemblerFixup() = default;
33 AssemblerFixup(const AssemblerFixup &) = default; 33 AssemblerFixup(const AssemblerFixup &) = default;
34 intptr_t position() const { return position_; } 34 intptr_t position() const {
35 void set_position(intptr_t Position) { position_ = Position; } 35 assert(position_was_set_);
36 return position_;
37 }
38 void set_position(intptr_t Position) {
39 position_ = Position;
40 position_was_set_ = true;
41 }
36 42
37 FixupKind kind() const { return kind_; } 43 FixupKind kind() const { return kind_; }
38 void set_kind(FixupKind Kind) { kind_ = Kind; } 44 void set_kind(FixupKind Kind) { kind_ = Kind; }
39 45
40 RelocOffsetT offset() const; 46 RelocOffsetT offset() const;
41 IceString symbol(const GlobalContext *Ctx) const; 47 IceString symbol(const GlobalContext *Ctx) const;
42 48
43 static const Constant *NullSymbol; 49 static const Constant *NullSymbol;
44 bool isNullSymbol() const { return value_ == NullSymbol; } 50 bool isNullSymbol() const { return value_ == NullSymbol; }
45 51
46 void set_value(const Constant *Value) { value_ = Value; } 52 void set_value(const Constant *Value) { value_ = Value; }
47 53
48 /// Emits fixup, then returns the number of bytes to skip. 54 /// Emits fixup, then returns the number of bytes to skip.
49 virtual size_t emit(GlobalContext *Ctx, RelocOffsetT OverrideOffset, 55 virtual size_t emit(GlobalContext *Ctx, RelocOffsetT OverrideOffset,
50 bool IsPCRel) const; 56 bool IsPCRel) const;
51 57
52 private: 58 private:
59 bool position_was_set_ = false;
53 intptr_t position_ = 0; 60 intptr_t position_ = 0;
54 FixupKind kind_ = 0; 61 FixupKind kind_ = 0;
55 const Constant *value_ = nullptr; 62 const Constant *value_ = nullptr;
56 }; 63 };
57 64
58 /// Extends a fixup to be textual. That is, it emits text instead of a sequence 65 /// 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 66 /// of bytes. This class is used as a fallback for unimplemented emitIAS
60 /// methods, allowing them to generate compilable assembly code. 67 /// methods, allowing them to generate compilable assembly code.
61 class AssemblerTextFixup : public AssemblerFixup { 68 class AssemblerTextFixup : public AssemblerFixup {
62 AssemblerTextFixup() = delete; 69 AssemblerTextFixup() = delete;
(...skipping 11 matching lines...) Expand all
74 const std::string Message; 81 const std::string Message;
75 const size_t NumBytes; 82 const size_t NumBytes;
76 }; 83 };
77 84
78 using FixupList = std::vector<AssemblerFixup>; 85 using FixupList = std::vector<AssemblerFixup>;
79 using FixupRefList = std::vector<AssemblerFixup *>; 86 using FixupRefList = std::vector<AssemblerFixup *>;
80 87
81 } // end of namespace Ice 88 } // end of namespace Ice
82 89
83 #endif // SUBZERO_SRC_ICEFIXUPS_H 90 #endif // SUBZERO_SRC_ICEFIXUPS_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698