OLD | NEW |
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/base/bits.h" | 5 #include "src/base/bits.h" |
6 #include "src/compiler/instruction-selector-impl.h" | 6 #include "src/compiler/instruction-selector-impl.h" |
7 #include "src/compiler/node-matchers.h" | 7 #include "src/compiler/node-matchers.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 if (cont->IsSet()) { | 231 if (cont->IsSet()) { |
232 outputs[output_count++] = g.DefineAsRegister(cont->result()); | 232 outputs[output_count++] = g.DefineAsRegister(cont->result()); |
233 } | 233 } |
234 | 234 |
235 DCHECK_NE(0, input_count); | 235 DCHECK_NE(0, input_count); |
236 DCHECK_NE(0, output_count); | 236 DCHECK_NE(0, output_count); |
237 DCHECK_GE(arraysize(inputs), input_count); | 237 DCHECK_GE(arraysize(inputs), input_count); |
238 DCHECK_GE(arraysize(outputs), output_count); | 238 DCHECK_GE(arraysize(outputs), output_count); |
239 DCHECK_NE(kMode_None, AddressingModeField::decode(opcode)); | 239 DCHECK_NE(kMode_None, AddressingModeField::decode(opcode)); |
240 | 240 |
241 Instruction* instr = selector->Emit(cont->Encode(opcode), output_count, | 241 selector->Emit(cont->Encode(opcode), output_count, outputs, input_count, |
242 outputs, input_count, inputs); | 242 inputs); |
243 if (cont->IsBranch()) instr->MarkAsControl(); | |
244 } | 243 } |
245 | 244 |
246 | 245 |
247 void VisitBinop(InstructionSelector* selector, Node* node, | 246 void VisitBinop(InstructionSelector* selector, Node* node, |
248 InstructionCode opcode, InstructionCode reverse_opcode) { | 247 InstructionCode opcode, InstructionCode reverse_opcode) { |
249 FlagsContinuation cont; | 248 FlagsContinuation cont; |
250 VisitBinop(selector, node, opcode, reverse_opcode, &cont); | 249 VisitBinop(selector, node, opcode, reverse_opcode, &cont); |
251 } | 250 } |
252 | 251 |
253 | 252 |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 if (cont->IsSet()) { | 570 if (cont->IsSet()) { |
572 outputs[output_count++] = g.DefineAsRegister(cont->result()); | 571 outputs[output_count++] = g.DefineAsRegister(cont->result()); |
573 } | 572 } |
574 | 573 |
575 DCHECK_NE(0, input_count); | 574 DCHECK_NE(0, input_count); |
576 DCHECK_NE(0, output_count); | 575 DCHECK_NE(0, output_count); |
577 DCHECK_GE(arraysize(inputs), input_count); | 576 DCHECK_GE(arraysize(inputs), input_count); |
578 DCHECK_GE(arraysize(outputs), output_count); | 577 DCHECK_GE(arraysize(outputs), output_count); |
579 DCHECK_NE(kMode_None, AddressingModeField::decode(opcode)); | 578 DCHECK_NE(kMode_None, AddressingModeField::decode(opcode)); |
580 | 579 |
581 Instruction* instr = selector->Emit(cont->Encode(opcode), output_count, | 580 selector->Emit(cont->Encode(opcode), output_count, outputs, input_count, |
582 outputs, input_count, inputs); | 581 inputs); |
583 if (cont->IsBranch()) instr->MarkAsControl(); | |
584 } | 582 } |
585 | 583 |
586 | 584 |
587 template <typename TryMatchShift> | 585 template <typename TryMatchShift> |
588 static inline void VisitShift(InstructionSelector* selector, Node* node, | 586 static inline void VisitShift(InstructionSelector* selector, Node* node, |
589 TryMatchShift try_match_shift) { | 587 TryMatchShift try_match_shift) { |
590 FlagsContinuation cont; | 588 FlagsContinuation cont; |
591 VisitShift(selector, node, try_match_shift, &cont); | 589 VisitShift(selector, node, try_match_shift, &cont); |
592 } | 590 } |
593 | 591 |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1070 | 1068 |
1071 // Shared routine for multiple float compare operations. | 1069 // Shared routine for multiple float compare operations. |
1072 void VisitFloat64Compare(InstructionSelector* selector, Node* node, | 1070 void VisitFloat64Compare(InstructionSelector* selector, Node* node, |
1073 FlagsContinuation* cont) { | 1071 FlagsContinuation* cont) { |
1074 ArmOperandGenerator g(selector); | 1072 ArmOperandGenerator g(selector); |
1075 Float64BinopMatcher m(node); | 1073 Float64BinopMatcher m(node); |
1076 if (cont->IsBranch()) { | 1074 if (cont->IsBranch()) { |
1077 selector->Emit(cont->Encode(kArmVcmpF64), nullptr, | 1075 selector->Emit(cont->Encode(kArmVcmpF64), nullptr, |
1078 g.UseRegister(m.left().node()), | 1076 g.UseRegister(m.left().node()), |
1079 g.UseRegister(m.right().node()), g.Label(cont->true_block()), | 1077 g.UseRegister(m.right().node()), g.Label(cont->true_block()), |
1080 g.Label(cont->false_block()))->MarkAsControl(); | 1078 g.Label(cont->false_block())); |
1081 } else { | 1079 } else { |
1082 DCHECK(cont->IsSet()); | 1080 DCHECK(cont->IsSet()); |
1083 selector->Emit( | 1081 selector->Emit( |
1084 cont->Encode(kArmVcmpF64), g.DefineAsRegister(cont->result()), | 1082 cont->Encode(kArmVcmpF64), g.DefineAsRegister(cont->result()), |
1085 g.UseRegister(m.left().node()), g.UseRegister(m.right().node())); | 1083 g.UseRegister(m.left().node()), g.UseRegister(m.right().node())); |
1086 } | 1084 } |
1087 } | 1085 } |
1088 | 1086 |
1089 | 1087 |
1090 // Shared routine for multiple word compare operations. | 1088 // Shared routine for multiple word compare operations. |
(...skipping 26 matching lines...) Expand all Loading... |
1117 inputs[input_count++] = g.Label(cont->false_block()); | 1115 inputs[input_count++] = g.Label(cont->false_block()); |
1118 } else { | 1116 } else { |
1119 DCHECK(cont->IsSet()); | 1117 DCHECK(cont->IsSet()); |
1120 outputs[output_count++] = g.DefineAsRegister(cont->result()); | 1118 outputs[output_count++] = g.DefineAsRegister(cont->result()); |
1121 } | 1119 } |
1122 | 1120 |
1123 DCHECK_NE(0, input_count); | 1121 DCHECK_NE(0, input_count); |
1124 DCHECK_GE(arraysize(inputs), input_count); | 1122 DCHECK_GE(arraysize(inputs), input_count); |
1125 DCHECK_GE(arraysize(outputs), output_count); | 1123 DCHECK_GE(arraysize(outputs), output_count); |
1126 | 1124 |
1127 Instruction* instr = selector->Emit(cont->Encode(opcode), output_count, | 1125 selector->Emit(cont->Encode(opcode), output_count, outputs, input_count, |
1128 outputs, input_count, inputs); | 1126 inputs); |
1129 if (cont->IsBranch()) instr->MarkAsControl(); | |
1130 } | 1127 } |
1131 | 1128 |
1132 | 1129 |
1133 void VisitWordCompare(InstructionSelector* selector, Node* node, | 1130 void VisitWordCompare(InstructionSelector* selector, Node* node, |
1134 FlagsContinuation* cont) { | 1131 FlagsContinuation* cont) { |
1135 VisitWordCompare(selector, node, kArmCmp, cont); | 1132 VisitWordCompare(selector, node, kArmCmp, cont); |
1136 } | 1133 } |
1137 | 1134 |
1138 | 1135 |
1139 // Shared routine for word comparisons against zero. | 1136 // Shared routine for word comparisons against zero. |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1224 break; | 1221 break; |
1225 } | 1222 } |
1226 | 1223 |
1227 // Continuation could not be combined with a compare, emit compare against 0. | 1224 // Continuation could not be combined with a compare, emit compare against 0. |
1228 ArmOperandGenerator g(selector); | 1225 ArmOperandGenerator g(selector); |
1229 InstructionCode const opcode = | 1226 InstructionCode const opcode = |
1230 cont->Encode(kArmTst) | AddressingModeField::encode(kMode_Operand2_R); | 1227 cont->Encode(kArmTst) | AddressingModeField::encode(kMode_Operand2_R); |
1231 InstructionOperand* const value_operand = g.UseRegister(value); | 1228 InstructionOperand* const value_operand = g.UseRegister(value); |
1232 if (cont->IsBranch()) { | 1229 if (cont->IsBranch()) { |
1233 selector->Emit(opcode, nullptr, value_operand, value_operand, | 1230 selector->Emit(opcode, nullptr, value_operand, value_operand, |
1234 g.Label(cont->true_block()), | 1231 g.Label(cont->true_block()), g.Label(cont->false_block())); |
1235 g.Label(cont->false_block()))->MarkAsControl(); | |
1236 } else { | 1232 } else { |
1237 selector->Emit(opcode, g.DefineAsRegister(cont->result()), value_operand, | 1233 selector->Emit(opcode, g.DefineAsRegister(cont->result()), value_operand, |
1238 value_operand); | 1234 value_operand); |
1239 } | 1235 } |
1240 } | 1236 } |
1241 | 1237 |
1242 } // namespace | 1238 } // namespace |
1243 | 1239 |
1244 | 1240 |
1245 void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch, | 1241 void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch, |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1333 MachineOperatorBuilder::kFloat64Ceil | | 1329 MachineOperatorBuilder::kFloat64Ceil | |
1334 MachineOperatorBuilder::kFloat64RoundTruncate | | 1330 MachineOperatorBuilder::kFloat64RoundTruncate | |
1335 MachineOperatorBuilder::kFloat64RoundTiesAway; | 1331 MachineOperatorBuilder::kFloat64RoundTiesAway; |
1336 } | 1332 } |
1337 return flags; | 1333 return flags; |
1338 } | 1334 } |
1339 | 1335 |
1340 } // namespace compiler | 1336 } // namespace compiler |
1341 } // namespace internal | 1337 } // namespace internal |
1342 } // namespace v8 | 1338 } // namespace v8 |
OLD | NEW |