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

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

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