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

Side by Side Diff: src/compiler/instruction.cc

Issue 1389373002: [turbofan] Create ExplicitOperands to specify operands without virtual registers (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add and tweak tests 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 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/common-operator.h" 5 #include "src/compiler/common-operator.h"
6 #include "src/compiler/graph.h" 6 #include "src/compiler/graph.h"
7 #include "src/compiler/instruction.h" 7 #include "src/compiler/instruction.h"
8 #include "src/compiler/schedule.h" 8 #include "src/compiler/schedule.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 << "]"; 98 << "]";
99 case InstructionOperand::IMMEDIATE: { 99 case InstructionOperand::IMMEDIATE: {
100 auto imm = ImmediateOperand::cast(op); 100 auto imm = ImmediateOperand::cast(op);
101 switch (imm.type()) { 101 switch (imm.type()) {
102 case ImmediateOperand::INLINE: 102 case ImmediateOperand::INLINE:
103 return os << "#" << imm.inline_value(); 103 return os << "#" << imm.inline_value();
104 case ImmediateOperand::INDEXED: 104 case ImmediateOperand::INDEXED:
105 return os << "[immediate:" << imm.indexed_value() << "]"; 105 return os << "[immediate:" << imm.indexed_value() << "]";
106 } 106 }
107 } 107 }
108 case InstructionOperand::EXPLICIT:
108 case InstructionOperand::ALLOCATED: { 109 case InstructionOperand::ALLOCATED: {
109 auto allocated = AllocatedOperand::cast(op); 110 auto allocated = LocationOperand::cast(op);
110 switch (allocated.allocated_kind()) { 111 if (op.IsStackSlot()) {
111 case AllocatedOperand::STACK_SLOT: 112 os << "[stack:" << LocationOperand::cast(op).index();
112 os << "[stack:" << StackSlotOperand::cast(op).index(); 113 } else if (op.IsDoubleStackSlot()) {
113 break; 114 os << "[double_stack:" << LocationOperand::cast(op).index();
114 case AllocatedOperand::DOUBLE_STACK_SLOT: 115 } else if (op.IsRegister()) {
115 os << "[double_stack:" << DoubleStackSlotOperand::cast(op).index(); 116 os << "[" << LocationOperand::cast(op).GetRegister().ToString() << "|R";
116 break; 117 } else {
117 case AllocatedOperand::REGISTER: 118 DCHECK(op.IsDoubleRegister());
118 os << "[" << RegisterOperand::cast(op).GetRegister().ToString() 119 os << "[" << LocationOperand::cast(op).GetDoubleRegister().ToString()
119 << "|R"; 120 << "|R";
120 break; 121 }
121 case AllocatedOperand::DOUBLE_REGISTER: 122 if (allocated.IsExplicit()) {
122 os << "[" 123 os << "|E";
123 << DoubleRegisterOperand::cast(op).GetDoubleRegister().ToString()
124 << "|R";
125 break;
126 } 124 }
127 switch (allocated.machine_type()) { 125 switch (allocated.machine_type()) {
128 case kRepWord32: 126 case kRepWord32:
129 os << "|w32"; 127 os << "|w32";
130 break; 128 break;
131 case kRepWord64: 129 case kRepWord64:
132 os << "|w64"; 130 os << "|w64";
133 break; 131 break;
134 case kRepFloat32: 132 case kRepFloat32:
135 os << "|f32"; 133 os << "|f32";
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 } 172 }
175 return true; 173 return true;
176 } 174 }
177 175
178 176
179 MoveOperands* ParallelMove::PrepareInsertAfter(MoveOperands* move) const { 177 MoveOperands* ParallelMove::PrepareInsertAfter(MoveOperands* move) const {
180 MoveOperands* replacement = nullptr; 178 MoveOperands* replacement = nullptr;
181 MoveOperands* to_eliminate = nullptr; 179 MoveOperands* to_eliminate = nullptr;
182 for (auto curr : *this) { 180 for (auto curr : *this) {
183 if (curr->IsEliminated()) continue; 181 if (curr->IsEliminated()) continue;
184 if (curr->destination().EqualsModuloType(move->source())) { 182 if (curr->destination().EqualsCanonicalized(move->source())) {
185 DCHECK(!replacement); 183 DCHECK(!replacement);
186 replacement = curr; 184 replacement = curr;
187 if (to_eliminate != nullptr) break; 185 if (to_eliminate != nullptr) break;
188 } else if (curr->destination().EqualsModuloType(move->destination())) { 186 } else if (curr->destination().EqualsCanonicalized(move->destination())) {
189 DCHECK(!to_eliminate); 187 DCHECK(!to_eliminate);
190 to_eliminate = curr; 188 to_eliminate = curr;
191 if (replacement != nullptr) break; 189 if (replacement != nullptr) break;
192 } 190 }
193 } 191 }
194 DCHECK_IMPLIES(replacement == to_eliminate, replacement == nullptr); 192 DCHECK_IMPLIES(replacement == to_eliminate, replacement == nullptr);
195 if (replacement != nullptr) move->set_source(replacement->source()); 193 if (replacement != nullptr) move->set_source(replacement->source());
196 return to_eliminate; 194 return to_eliminate;
197 } 195 }
198 196
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 first = false; 254 first = false;
257 PrintableMoveOperands pmo = {printable.register_configuration_, move}; 255 PrintableMoveOperands pmo = {printable.register_configuration_, move};
258 os << pmo; 256 os << pmo;
259 } 257 }
260 return os; 258 return os;
261 } 259 }
262 260
263 261
264 void ReferenceMap::RecordReference(const AllocatedOperand& op) { 262 void ReferenceMap::RecordReference(const AllocatedOperand& op) {
265 // Do not record arguments as pointers. 263 // Do not record arguments as pointers.
266 if (op.IsStackSlot() && StackSlotOperand::cast(op).index() < 0) return; 264 if (op.IsStackSlot() && LocationOperand::cast(op).index() < 0) return;
267 DCHECK(!op.IsDoubleRegister() && !op.IsDoubleStackSlot()); 265 DCHECK(!op.IsDoubleRegister() && !op.IsDoubleStackSlot());
268 reference_operands_.push_back(op); 266 reference_operands_.push_back(op);
269 } 267 }
270 268
271 269
272 std::ostream& operator<<(std::ostream& os, const ReferenceMap& pm) { 270 std::ostream& operator<<(std::ostream& os, const ReferenceMap& pm) {
273 os << "{"; 271 os << "{";
274 bool first = true; 272 bool first = true;
275 PrintableInstructionOperand poi = {RegisterConfiguration::ArchDefault(), 273 PrintableInstructionOperand poi = {RegisterConfiguration::ArchDefault(),
276 InstructionOperand()}; 274 InstructionOperand()};
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 os << " B" << succ.ToInt(); 874 os << " B" << succ.ToInt();
877 } 875 }
878 os << "\n"; 876 os << "\n";
879 } 877 }
880 return os; 878 return os;
881 } 879 }
882 880
883 } // namespace compiler 881 } // namespace compiler
884 } // namespace internal 882 } // namespace internal
885 } // namespace v8 883 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698