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

Side by Side Diff: src/IceAssemblerX86Base.h

Issue 1265023003: Clarify which type "Label" refers to (generic vs X86) (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: simplify the get Created 5 years, 4 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/IceAssemblerX86Base.h - base x86 assembler -*- C++ -*---===// 1 //===- subzero/src/IceAssemblerX86Base.h - base x86 assembler -*- C++ -*---===//
2 // 2 //
3 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 3 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
4 // for details. All rights reserved. Use of this source code is governed by a 4 // for details. All rights reserved. Use of this source code is governed by a
5 // BSD-style license that can be found in the LICENSE file. 5 // BSD-style license that can be found in the LICENSE file.
6 // 6 //
7 // Modified by the Subzero authors. 7 // Modified by the Subzero authors.
8 // 8 //
9 //===----------------------------------------------------------------------===// 9 //===----------------------------------------------------------------------===//
10 // 10 //
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 bool is_uint16() const { 65 bool is_uint16() const {
66 return fixup_ == nullptr && Utils::IsUint(16, value_); 66 return fixup_ == nullptr && Utils::IsUint(16, value_);
67 } 67 }
68 68
69 private: 69 private:
70 const int32_t value_; 70 const int32_t value_;
71 AssemblerFixup *fixup_ = nullptr; 71 AssemblerFixup *fixup_ = nullptr;
72 }; 72 };
73 73
74 /// X86 allows near and far jumps. 74 /// X86 allows near and far jumps.
75 class Label final : public Ice::Label { 75 class Label final : public LabelBase {
76 Label(const Label &) = delete; 76 Label(const Label &) = delete;
77 Label &operator=(const Label &) = delete; 77 Label &operator=(const Label &) = delete;
78 78
79 public: 79 public:
80 Label() = default; 80 Label() = default;
81 ~Label() = default; 81 ~Label() = default;
82 82
83 void finalCheck() const override { 83 void finalCheck() const override {
84 Ice::Label::finalCheck(); 84 Ice::LabelBase::finalCheck();
85 assert(!hasNear()); 85 assert(!hasNear());
86 } 86 }
87 87
88 /// Returns the position of an earlier branch instruction which assumes that 88 /// Returns the position of an earlier branch instruction which assumes that
89 /// this label is "near", and bumps iterator to the next near position. 89 /// this label is "near", and bumps iterator to the next near position.
90 intptr_t getNearPosition() { 90 intptr_t getNearPosition() {
91 assert(hasNear()); 91 assert(hasNear());
92 intptr_t Pos = UnresolvedNearPositions.back(); 92 intptr_t Pos = UnresolvedNearPositions.back();
93 UnresolvedNearPositions.pop_back(); 93 UnresolvedNearPositions.pop_back();
94 return Pos; 94 return Pos;
95 } 95 }
96 96
97 bool hasNear() const { return !UnresolvedNearPositions.empty(); } 97 bool hasNear() const { return !UnresolvedNearPositions.empty(); }
98 bool isUnused() const override { 98 bool isUnused() const override {
99 return Ice::Label::isUnused() && !hasNear(); 99 return Ice::LabelBase::isUnused() && !hasNear();
100 } 100 }
101 101
102 private: 102 private:
103 void nearLinkTo(intptr_t position) { 103 void nearLinkTo(intptr_t position) {
104 assert(!isBound()); 104 assert(!isBound());
105 UnresolvedNearPositions.push_back(position); 105 UnresolvedNearPositions.push_back(position);
106 } 106 }
107 107
108 llvm::SmallVector<intptr_t, 20> UnresolvedNearPositions; 108 llvm::SmallVector<intptr_t, 20> UnresolvedNearPositions;
109 109
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 143
144 void padWithNop(intptr_t Padding) override { 144 void padWithNop(intptr_t Padding) override {
145 while (Padding > MAX_NOP_SIZE) { 145 while (Padding > MAX_NOP_SIZE) {
146 nop(MAX_NOP_SIZE); 146 nop(MAX_NOP_SIZE);
147 Padding -= MAX_NOP_SIZE; 147 Padding -= MAX_NOP_SIZE;
148 } 148 }
149 if (Padding) 149 if (Padding)
150 nop(Padding); 150 nop(Padding);
151 } 151 }
152 152
153 Label *getOrCreateCfgNodeLabel(SizeT NodeNumber) override; 153 LabelBase *getCfgNodeLabel(SizeT NodeNumber) override;
154 void bindCfgNodeLabel(SizeT NodeNumber) override; 154 void bindCfgNodeLabel(SizeT NodeNumber) override;
155 Label *getOrCreateCfgNodeLabel(SizeT Number);
155 Label *getOrCreateLocalLabel(SizeT Number); 156 Label *getOrCreateLocalLabel(SizeT Number);
156 void bindLocalLabel(SizeT Number); 157 void bindLocalLabel(SizeT Number);
157 158
158 bool fixupIsPCRel(FixupKind Kind) const override { 159 bool fixupIsPCRel(FixupKind Kind) const override {
159 // Currently assuming this is the only PC-rel relocation type used. 160 // Currently assuming this is the only PC-rel relocation type used.
160 // TODO(jpp): Traits.PcRelTypes.count(Kind) != 0 161 // TODO(jpp): Traits.PcRelTypes.count(Kind) != 0
161 return Kind == Traits::PcRelFixup; 162 return Kind == Traits::PcRelFixup;
162 } 163 }
163 164
164 // Operations to emit GPR instructions (and dispatch on operand type). 165 // Operations to emit GPR instructions (and dispatch on operand type).
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 emitUint8(0x66); 1039 emitUint8(0x66);
1039 } 1040 }
1040 1041
1041 } // end of namespace X86Internal 1042 } // end of namespace X86Internal
1042 1043
1043 } // end of namespace Ice 1044 } // end of namespace Ice
1044 1045
1045 #include "IceAssemblerX86BaseImpl.h" 1046 #include "IceAssemblerX86BaseImpl.h"
1046 1047
1047 #endif // SUBZERO_SRC_ICEASSEMBLERX86BASE_H 1048 #endif // SUBZERO_SRC_ICEASSEMBLERX86BASE_H
OLDNEW
« src/IceAssembler.h ('K') | « src/IceAssemblerX8632.h ('k') | src/IceAssemblerX86BaseImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698