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

Side by Side Diff: src/compiler/arm64/instruction-selector-arm64.cc

Issue 814043002: Revert of [turbofan] remove control field from instruction (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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/instruction-selector-impl.h" 5 #include "src/compiler/instruction-selector-impl.h"
6 #include "src/compiler/node-matchers.h" 6 #include "src/compiler/node-matchers.h"
7 7
8 namespace v8 { 8 namespace v8 {
9 namespace internal { 9 namespace internal {
10 namespace compiler { 10 namespace compiler {
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 outputs[output_count++] = g.DefineAsRegister(node); 212 outputs[output_count++] = g.DefineAsRegister(node);
213 if (cont->IsSet()) { 213 if (cont->IsSet()) {
214 outputs[output_count++] = g.DefineAsRegister(cont->result()); 214 outputs[output_count++] = g.DefineAsRegister(cont->result());
215 } 215 }
216 216
217 DCHECK_NE(0, input_count); 217 DCHECK_NE(0, input_count);
218 DCHECK_NE(0, output_count); 218 DCHECK_NE(0, output_count);
219 DCHECK_GE(arraysize(inputs), input_count); 219 DCHECK_GE(arraysize(inputs), input_count);
220 DCHECK_GE(arraysize(outputs), output_count); 220 DCHECK_GE(arraysize(outputs), output_count);
221 221
222 selector->Emit(cont->Encode(opcode), output_count, outputs, input_count, 222 Instruction* instr = selector->Emit(cont->Encode(opcode), output_count,
223 inputs); 223 outputs, input_count, inputs);
224 if (cont->IsBranch()) instr->MarkAsControl();
224 } 225 }
225 226
226 227
227 // Shared routine for multiple binary operations. 228 // Shared routine for multiple binary operations.
228 template <typename Matcher> 229 template <typename Matcher>
229 static void VisitBinop(InstructionSelector* selector, Node* node, 230 static void VisitBinop(InstructionSelector* selector, Node* node,
230 ArchOpcode opcode, ImmediateMode operand_mode) { 231 ArchOpcode opcode, ImmediateMode operand_mode) {
231 FlagsContinuation cont; 232 FlagsContinuation cont;
232 VisitBinop<Matcher>(selector, node, opcode, operand_mode, &cont); 233 VisitBinop<Matcher>(selector, node, opcode, operand_mode, &cont);
233 } 234 }
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after
1155 1156
1156 1157
1157 // Shared routine for multiple compare operations. 1158 // Shared routine for multiple compare operations.
1158 static void VisitCompare(InstructionSelector* selector, InstructionCode opcode, 1159 static void VisitCompare(InstructionSelector* selector, InstructionCode opcode,
1159 InstructionOperand* left, InstructionOperand* right, 1160 InstructionOperand* left, InstructionOperand* right,
1160 FlagsContinuation* cont) { 1161 FlagsContinuation* cont) {
1161 Arm64OperandGenerator g(selector); 1162 Arm64OperandGenerator g(selector);
1162 opcode = cont->Encode(opcode); 1163 opcode = cont->Encode(opcode);
1163 if (cont->IsBranch()) { 1164 if (cont->IsBranch()) {
1164 selector->Emit(opcode, NULL, left, right, g.Label(cont->true_block()), 1165 selector->Emit(opcode, NULL, left, right, g.Label(cont->true_block()),
1165 g.Label(cont->false_block())); 1166 g.Label(cont->false_block()))->MarkAsControl();
1166 } else { 1167 } else {
1167 DCHECK(cont->IsSet()); 1168 DCHECK(cont->IsSet());
1168 selector->Emit(opcode, g.DefineAsRegister(cont->result()), left, right); 1169 selector->Emit(opcode, g.DefineAsRegister(cont->result()), left, right);
1169 } 1170 }
1170 } 1171 }
1171 1172
1172 1173
1173 // Shared routine for multiple word compare operations. 1174 // Shared routine for multiple word compare operations.
1174 static void VisitWordCompare(InstructionSelector* selector, Node* node, 1175 static void VisitWordCompare(InstructionSelector* selector, Node* node,
1175 InstructionCode opcode, FlagsContinuation* cont, 1176 InstructionCode opcode, FlagsContinuation* cont,
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
1343 Int32BinopMatcher m(value); 1344 Int32BinopMatcher m(value);
1344 if (m.right().HasValue() && 1345 if (m.right().HasValue() &&
1345 (base::bits::CountPopulation32(m.right().Value()) == 1)) { 1346 (base::bits::CountPopulation32(m.right().Value()) == 1)) {
1346 // If the mask has only one bit set, we can use tbz/tbnz. 1347 // If the mask has only one bit set, we can use tbz/tbnz.
1347 DCHECK((cont.condition() == kEqual) || 1348 DCHECK((cont.condition() == kEqual) ||
1348 (cont.condition() == kNotEqual)); 1349 (cont.condition() == kNotEqual));
1349 Emit(cont.Encode(kArm64TestAndBranch32), NULL, 1350 Emit(cont.Encode(kArm64TestAndBranch32), NULL,
1350 g.UseRegister(m.left().node()), 1351 g.UseRegister(m.left().node()),
1351 g.TempImmediate( 1352 g.TempImmediate(
1352 base::bits::CountTrailingZeros32(m.right().Value())), 1353 base::bits::CountTrailingZeros32(m.right().Value())),
1353 g.Label(cont.true_block()), g.Label(cont.false_block())); 1354 g.Label(cont.true_block()),
1355 g.Label(cont.false_block()))->MarkAsControl();
1354 return; 1356 return;
1355 } 1357 }
1356 return VisitWordCompare(this, value, kArm64Tst32, &cont, true, 1358 return VisitWordCompare(this, value, kArm64Tst32, &cont, true,
1357 kLogical32Imm); 1359 kLogical32Imm);
1358 } 1360 }
1359 case IrOpcode::kWord64And: { 1361 case IrOpcode::kWord64And: {
1360 Int64BinopMatcher m(value); 1362 Int64BinopMatcher m(value);
1361 if (m.right().HasValue() && 1363 if (m.right().HasValue() &&
1362 (base::bits::CountPopulation64(m.right().Value()) == 1)) { 1364 (base::bits::CountPopulation64(m.right().Value()) == 1)) {
1363 // If the mask has only one bit set, we can use tbz/tbnz. 1365 // If the mask has only one bit set, we can use tbz/tbnz.
1364 DCHECK((cont.condition() == kEqual) || 1366 DCHECK((cont.condition() == kEqual) ||
1365 (cont.condition() == kNotEqual)); 1367 (cont.condition() == kNotEqual));
1366 Emit(cont.Encode(kArm64TestAndBranch), NULL, 1368 Emit(cont.Encode(kArm64TestAndBranch), NULL,
1367 g.UseRegister(m.left().node()), 1369 g.UseRegister(m.left().node()),
1368 g.TempImmediate( 1370 g.TempImmediate(
1369 base::bits::CountTrailingZeros64(m.right().Value())), 1371 base::bits::CountTrailingZeros64(m.right().Value())),
1370 g.Label(cont.true_block()), g.Label(cont.false_block())); 1372 g.Label(cont.true_block()),
1373 g.Label(cont.false_block()))->MarkAsControl();
1371 return; 1374 return;
1372 } 1375 }
1373 return VisitWordCompare(this, value, kArm64Tst, &cont, true, 1376 return VisitWordCompare(this, value, kArm64Tst, &cont, true,
1374 kLogical64Imm); 1377 kLogical64Imm);
1375 } 1378 }
1376 default: 1379 default:
1377 break; 1380 break;
1378 } 1381 }
1379 } 1382 }
1380 1383
1381 // Branch could not be combined with a compare, compare against 0 and branch. 1384 // Branch could not be combined with a compare, compare against 0 and branch.
1382 Emit(cont.Encode(kArm64CompareAndBranch32), NULL, g.UseRegister(value), 1385 Emit(cont.Encode(kArm64CompareAndBranch32), NULL, g.UseRegister(value),
1383 g.Label(cont.true_block()), g.Label(cont.false_block())); 1386 g.Label(cont.true_block()),
1387 g.Label(cont.false_block()))->MarkAsControl();
1384 } 1388 }
1385 1389
1386 1390
1387 void InstructionSelector::VisitWord32Equal(Node* const node) { 1391 void InstructionSelector::VisitWord32Equal(Node* const node) {
1388 Node* const user = node; 1392 Node* const user = node;
1389 FlagsContinuation cont(kEqual, node); 1393 FlagsContinuation cont(kEqual, node);
1390 Int32BinopMatcher m(user); 1394 Int32BinopMatcher m(user);
1391 if (m.right().Is(0)) { 1395 if (m.right().Is(0)) {
1392 Node* const value = m.left().node(); 1396 Node* const value = m.left().node();
1393 if (CanCover(user, value)) { 1397 if (CanCover(user, value)) {
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1521 MachineOperatorBuilder::kFloat64Ceil | 1525 MachineOperatorBuilder::kFloat64Ceil |
1522 MachineOperatorBuilder::kFloat64RoundTruncate | 1526 MachineOperatorBuilder::kFloat64RoundTruncate |
1523 MachineOperatorBuilder::kFloat64RoundTiesAway | 1527 MachineOperatorBuilder::kFloat64RoundTiesAway |
1524 MachineOperatorBuilder::kWord32ShiftIsSafe | 1528 MachineOperatorBuilder::kWord32ShiftIsSafe |
1525 MachineOperatorBuilder::kInt32DivIsSafe | 1529 MachineOperatorBuilder::kInt32DivIsSafe |
1526 MachineOperatorBuilder::kUint32DivIsSafe; 1530 MachineOperatorBuilder::kUint32DivIsSafe;
1527 } 1531 }
1528 } // namespace compiler 1532 } // namespace compiler
1529 } // namespace internal 1533 } // namespace internal
1530 } // namespace v8 1534 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/arm/instruction-selector-arm.cc ('k') | src/compiler/ia32/instruction-selector-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698