diff options
Diffstat (limited to 'src/compiler/ppc/instruction-selector-ppc.cc')
-rw-r--r-- | src/compiler/ppc/instruction-selector-ppc.cc | 64 |
1 files changed, 51 insertions, 13 deletions
diff --git a/src/compiler/ppc/instruction-selector-ppc.cc b/src/compiler/ppc/instruction-selector-ppc.cc index 768b188a..c2770b3c 100644 --- a/src/compiler/ppc/instruction-selector-ppc.cc +++ b/src/compiler/ppc/instruction-selector-ppc.cc @@ -154,7 +154,10 @@ void VisitBinop(InstructionSelector* selector, Node* node, opcode = cont->Encode(opcode); if (cont->IsDeoptimize()) { selector->EmitDeoptimize(opcode, output_count, outputs, input_count, inputs, - cont->reason(), cont->frame_state()); + cont->kind(), cont->reason(), cont->frame_state()); + } else if (cont->IsTrap()) { + inputs[input_count++] = g.UseImmediate(cont->trap_id()); + selector->Emit(opcode, output_count, outputs, input_count, inputs); } else { selector->Emit(opcode, output_count, outputs, input_count, inputs); } @@ -213,6 +216,9 @@ void InstructionSelector::VisitLoad(Node* node) { case MachineRepresentation::kWord64: // Fall through. #endif case MachineRepresentation::kSimd128: // Fall through. + case MachineRepresentation::kSimd1x4: // Fall through. + case MachineRepresentation::kSimd1x8: // Fall through. + case MachineRepresentation::kSimd1x16: // Fall through. case MachineRepresentation::kNone: UNREACHABLE(); return; @@ -322,6 +328,9 @@ void InstructionSelector::VisitStore(Node* node) { case MachineRepresentation::kWord64: // Fall through. #endif case MachineRepresentation::kSimd128: // Fall through. + case MachineRepresentation::kSimd1x4: // Fall through. + case MachineRepresentation::kSimd1x8: // Fall through. + case MachineRepresentation::kSimd1x16: // Fall through. case MachineRepresentation::kNone: UNREACHABLE(); return; @@ -339,6 +348,11 @@ void InstructionSelector::VisitStore(Node* node) { } } +void InstructionSelector::VisitProtectedStore(Node* node) { + // TODO(eholk) + UNIMPLEMENTED(); +} + // Architecture supports unaligned access, therefore VisitLoad is used instead void InstructionSelector::VisitUnalignedLoad(Node* node) { UNREACHABLE(); } @@ -381,6 +395,9 @@ void InstructionSelector::VisitCheckedLoad(Node* node) { case MachineRepresentation::kWord64: // Fall through. #endif case MachineRepresentation::kSimd128: // Fall through. + case MachineRepresentation::kSimd1x4: // Fall through. + case MachineRepresentation::kSimd1x8: // Fall through. + case MachineRepresentation::kSimd1x16: // Fall through. case MachineRepresentation::kNone: UNREACHABLE(); return; @@ -429,6 +446,9 @@ void InstructionSelector::VisitCheckedStore(Node* node) { case MachineRepresentation::kWord64: // Fall through. #endif case MachineRepresentation::kSimd128: // Fall through. + case MachineRepresentation::kSimd1x4: // Fall through. + case MachineRepresentation::kSimd1x8: // Fall through. + case MachineRepresentation::kSimd1x16: // Fall through. case MachineRepresentation::kNone: UNREACHABLE(); return; @@ -836,7 +856,7 @@ void VisitPairBinop(InstructionSelector* selector, InstructionCode opcode, } void InstructionSelector::VisitInt32PairAdd(Node* node) { - VisitPairBinop(this, kPPC_AddPair, kPPC_Add, node); + VisitPairBinop(this, kPPC_AddPair, kPPC_Add32, node); } void InstructionSelector::VisitInt32PairSub(Node* node) { @@ -1013,13 +1033,13 @@ void InstructionSelector::VisitWord64ReverseBytes(Node* node) { UNREACHABLE(); } void InstructionSelector::VisitWord32ReverseBytes(Node* node) { UNREACHABLE(); } void InstructionSelector::VisitInt32Add(Node* node) { - VisitBinop<Int32BinopMatcher>(this, node, kPPC_Add, kInt16Imm); + VisitBinop<Int32BinopMatcher>(this, node, kPPC_Add32, kInt16Imm); } #if V8_TARGET_ARCH_PPC64 void InstructionSelector::VisitInt64Add(Node* node) { - VisitBinop<Int64BinopMatcher>(this, node, kPPC_Add, kInt16Imm); + VisitBinop<Int64BinopMatcher>(this, node, kPPC_Add64, kInt16Imm); } #endif @@ -1481,11 +1501,11 @@ void InstructionSelector::VisitInt32SubWithOverflow(Node* node) { void InstructionSelector::VisitInt64AddWithOverflow(Node* node) { if (Node* ovf = NodeProperties::FindProjection(node, 1)) { FlagsContinuation cont = FlagsContinuation::ForSet(kOverflow, ovf); - return VisitBinop<Int64BinopMatcher>(this, node, kPPC_Add, kInt16Imm, + return VisitBinop<Int64BinopMatcher>(this, node, kPPC_Add64, kInt16Imm, &cont); } FlagsContinuation cont; - VisitBinop<Int64BinopMatcher>(this, node, kPPC_Add, kInt16Imm, &cont); + VisitBinop<Int64BinopMatcher>(this, node, kPPC_Add64, kInt16Imm, &cont); } @@ -1528,11 +1548,14 @@ void VisitCompare(InstructionSelector* selector, InstructionCode opcode, selector->Emit(opcode, g.NoOutput(), left, right, g.Label(cont->true_block()), g.Label(cont->false_block())); } else if (cont->IsDeoptimize()) { - selector->EmitDeoptimize(opcode, g.NoOutput(), left, right, cont->reason(), - cont->frame_state()); - } else { - DCHECK(cont->IsSet()); + selector->EmitDeoptimize(opcode, g.NoOutput(), left, right, cont->kind(), + cont->reason(), cont->frame_state()); + } else if (cont->IsSet()) { selector->Emit(opcode, g.DefineAsRegister(cont->result()), left, right); + } else { + DCHECK(cont->IsTrap()); + selector->Emit(opcode, g.NoOutput(), left, right, + g.UseImmediate(cont->trap_id())); } } @@ -1693,7 +1716,7 @@ void VisitWordCompareZero(InstructionSelector* selector, Node* user, #if V8_TARGET_ARCH_PPC64 case IrOpcode::kInt64AddWithOverflow: cont->OverwriteAndNegateIfEqual(kOverflow); - return VisitBinop<Int64BinopMatcher>(selector, node, kPPC_Add, + return VisitBinop<Int64BinopMatcher>(selector, node, kPPC_Add64, kInt16Imm, cont); case IrOpcode::kInt64SubWithOverflow: cont->OverwriteAndNegateIfEqual(kOverflow); @@ -1771,14 +1794,29 @@ void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch, } void InstructionSelector::VisitDeoptimizeIf(Node* node) { + DeoptimizeParameters p = DeoptimizeParametersOf(node->op()); FlagsContinuation cont = FlagsContinuation::ForDeoptimize( - kNotEqual, DeoptimizeReasonOf(node->op()), node->InputAt(1)); + kNotEqual, p.kind(), p.reason(), node->InputAt(1)); VisitWord32CompareZero(this, node, node->InputAt(0), &cont); } void InstructionSelector::VisitDeoptimizeUnless(Node* node) { + DeoptimizeParameters p = DeoptimizeParametersOf(node->op()); FlagsContinuation cont = FlagsContinuation::ForDeoptimize( - kEqual, DeoptimizeReasonOf(node->op()), node->InputAt(1)); + kEqual, p.kind(), p.reason(), node->InputAt(1)); + VisitWord32CompareZero(this, node, node->InputAt(0), &cont); +} + +void InstructionSelector::VisitTrapIf(Node* node, Runtime::FunctionId func_id) { + FlagsContinuation cont = + FlagsContinuation::ForTrap(kNotEqual, func_id, node->InputAt(1)); + VisitWord32CompareZero(this, node, node->InputAt(0), &cont); +} + +void InstructionSelector::VisitTrapUnless(Node* node, + Runtime::FunctionId func_id) { + FlagsContinuation cont = + FlagsContinuation::ForTrap(kEqual, func_id, node->InputAt(1)); VisitWord32CompareZero(this, node, node->InputAt(0), &cont); } |