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

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

Issue 1031803004: [turbofan] Remove Instruction::IsControl() and Instruction::MarkAsControl() (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « src/compiler/mips64/instruction-selector-mips64.cc ('k') | src/compiler/register-allocator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "src/compiler/node-properties.h" 7 #include "src/compiler/node-properties.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 outputs[output_count++] = g.DefineAsRegister(node); 125 outputs[output_count++] = g.DefineAsRegister(node);
126 if (cont->IsSet()) { 126 if (cont->IsSet()) {
127 outputs[output_count++] = g.DefineAsRegister(cont->result()); 127 outputs[output_count++] = g.DefineAsRegister(cont->result());
128 } 128 }
129 129
130 DCHECK_NE(0u, input_count); 130 DCHECK_NE(0u, input_count);
131 DCHECK_NE(0u, output_count); 131 DCHECK_NE(0u, output_count);
132 DCHECK_GE(arraysize(inputs), input_count); 132 DCHECK_GE(arraysize(inputs), input_count);
133 DCHECK_GE(arraysize(outputs), output_count); 133 DCHECK_GE(arraysize(outputs), output_count);
134 134
135 Instruction* instr = selector->Emit(cont->Encode(opcode), output_count, 135 selector->Emit(cont->Encode(opcode), output_count, outputs, input_count,
136 outputs, input_count, inputs); 136 inputs);
137 if (cont->IsBranch()) instr->MarkAsControl();
138 } 137 }
139 138
140 139
141 // Shared routine for multiple binary operations. 140 // Shared routine for multiple binary operations.
142 template <typename Matcher> 141 template <typename Matcher>
143 static void VisitBinop(InstructionSelector* selector, Node* node, 142 static void VisitBinop(InstructionSelector* selector, Node* node,
144 ArchOpcode opcode, ImmediateMode operand_mode) { 143 ArchOpcode opcode, ImmediateMode operand_mode) {
145 FlagsContinuation cont; 144 FlagsContinuation cont;
146 VisitBinop<Matcher>(selector, node, opcode, operand_mode, &cont); 145 VisitBinop<Matcher>(selector, node, opcode, operand_mode, &cont);
147 } 146 }
(...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 1038
1040 1039
1041 // Shared routine for multiple compare operations. 1040 // Shared routine for multiple compare operations.
1042 static void VisitCompare(InstructionSelector* selector, InstructionCode opcode, 1041 static void VisitCompare(InstructionSelector* selector, InstructionCode opcode,
1043 InstructionOperand left, InstructionOperand right, 1042 InstructionOperand left, InstructionOperand right,
1044 FlagsContinuation* cont) { 1043 FlagsContinuation* cont) {
1045 PPCOperandGenerator g(selector); 1044 PPCOperandGenerator g(selector);
1046 opcode = cont->Encode(opcode); 1045 opcode = cont->Encode(opcode);
1047 if (cont->IsBranch()) { 1046 if (cont->IsBranch()) {
1048 selector->Emit(opcode, g.NoOutput(), left, right, 1047 selector->Emit(opcode, g.NoOutput(), left, right,
1049 g.Label(cont->true_block()), 1048 g.Label(cont->true_block()), g.Label(cont->false_block()));
1050 g.Label(cont->false_block()))->MarkAsControl();
1051 } else { 1049 } else {
1052 DCHECK(cont->IsSet()); 1050 DCHECK(cont->IsSet());
1053 selector->Emit(opcode, g.DefineAsRegister(cont->result()), left, right); 1051 selector->Emit(opcode, g.DefineAsRegister(cont->result()), left, right);
1054 } 1052 }
1055 } 1053 }
1056 1054
1057 1055
1058 // Shared routine for multiple word compare operations. 1056 // Shared routine for multiple word compare operations.
1059 static void VisitWordCompare(InstructionSelector* selector, Node* node, 1057 static void VisitWordCompare(InstructionSelector* selector, Node* node,
1060 InstructionCode opcode, FlagsContinuation* cont, 1058 InstructionCode opcode, FlagsContinuation* cont,
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
1284 auto* inputs = zone()->NewArray<InstructionOperand>(input_count); 1282 auto* inputs = zone()->NewArray<InstructionOperand>(input_count);
1285 inputs[0] = index_operand; 1283 inputs[0] = index_operand;
1286 std::fill(&inputs[1], &inputs[input_count], default_operand); 1284 std::fill(&inputs[1], &inputs[input_count], default_operand);
1287 for (size_t index = 0; index < case_count; ++index) { 1285 for (size_t index = 0; index < case_count; ++index) {
1288 size_t value = case_values[index] - min_value; 1286 size_t value = case_values[index] - min_value;
1289 BasicBlock* branch = case_branches[index]; 1287 BasicBlock* branch = case_branches[index];
1290 DCHECK_LE(0u, value); 1288 DCHECK_LE(0u, value);
1291 DCHECK_LT(value + 2, input_count); 1289 DCHECK_LT(value + 2, input_count);
1292 inputs[value + 2] = g.Label(branch); 1290 inputs[value + 2] = g.Label(branch);
1293 } 1291 }
1294 Emit(kArchTableSwitch, 0, nullptr, input_count, inputs, 0, nullptr) 1292 Emit(kArchTableSwitch, 0, nullptr, input_count, inputs, 0, nullptr);
1295 ->MarkAsControl();
1296 return; 1293 return;
1297 } 1294 }
1298 1295
1299 // Generate a sequence of conditional jumps. 1296 // Generate a sequence of conditional jumps.
1300 size_t input_count = 2 + case_count * 2; 1297 size_t input_count = 2 + case_count * 2;
1301 auto* inputs = zone()->NewArray<InstructionOperand>(input_count); 1298 auto* inputs = zone()->NewArray<InstructionOperand>(input_count);
1302 inputs[0] = value_operand; 1299 inputs[0] = value_operand;
1303 inputs[1] = default_operand; 1300 inputs[1] = default_operand;
1304 for (size_t index = 0; index < case_count; ++index) { 1301 for (size_t index = 0; index < case_count; ++index) {
1305 int32_t value = case_values[index]; 1302 int32_t value = case_values[index];
1306 BasicBlock* branch = case_branches[index]; 1303 BasicBlock* branch = case_branches[index];
1307 inputs[index * 2 + 2 + 0] = g.TempImmediate(value); 1304 inputs[index * 2 + 2 + 0] = g.TempImmediate(value);
1308 inputs[index * 2 + 2 + 1] = g.Label(branch); 1305 inputs[index * 2 + 2 + 1] = g.Label(branch);
1309 } 1306 }
1310 Emit(kArchLookupSwitch, 0, nullptr, input_count, inputs, 0, nullptr) 1307 Emit(kArchLookupSwitch, 0, nullptr, input_count, inputs, 0, nullptr);
1311 ->MarkAsControl();
1312 } 1308 }
1313 1309
1314 1310
1315 void InstructionSelector::VisitWord32Equal(Node* const node) { 1311 void InstructionSelector::VisitWord32Equal(Node* const node) {
1316 FlagsContinuation cont(kEqual, node); 1312 FlagsContinuation cont(kEqual, node);
1317 Int32BinopMatcher m(node); 1313 Int32BinopMatcher m(node);
1318 if (m.right().Is(0)) { 1314 if (m.right().Is(0)) {
1319 return VisitWord32CompareZero(this, m.node(), m.left().node(), &cont); 1315 return VisitWord32CompareZero(this, m.node(), m.left().node(), &cont);
1320 } 1316 }
1321 VisitWord32Compare(this, node, &cont); 1317 VisitWord32Compare(this, node, &cont);
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
1505 MachineOperatorBuilder::kFloat64Min | 1501 MachineOperatorBuilder::kFloat64Min |
1506 MachineOperatorBuilder::kFloat64RoundDown | 1502 MachineOperatorBuilder::kFloat64RoundDown |
1507 MachineOperatorBuilder::kFloat64RoundTruncate | 1503 MachineOperatorBuilder::kFloat64RoundTruncate |
1508 MachineOperatorBuilder::kFloat64RoundTiesAway; 1504 MachineOperatorBuilder::kFloat64RoundTiesAway;
1509 // We omit kWord32ShiftIsSafe as s[rl]w use 0x3f as a mask rather than 0x1f. 1505 // We omit kWord32ShiftIsSafe as s[rl]w use 0x3f as a mask rather than 0x1f.
1510 } 1506 }
1511 1507
1512 } // namespace compiler 1508 } // namespace compiler
1513 } // namespace internal 1509 } // namespace internal
1514 } // namespace v8 1510 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/mips64/instruction-selector-mips64.cc ('k') | src/compiler/register-allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698