return VisitSwitch(input, sw);
}
case BasicBlock::kReturn: {
- // If the result itself is a return, return its input.
- Node* value = (input != nullptr && input->opcode() == IrOpcode::kReturn)
- ? input->InputAt(0)
- : input;
- return VisitReturn(value);
+ DCHECK_EQ(IrOpcode::kReturn, input->opcode());
+ return VisitReturn(input->InputAt(0));
}
case BasicBlock::kDeoptimize: {
// If the result itself is a return, return its input.
void InstructionSelector::VisitReturn(Node* value) {
+ DCHECK_NOT_NULL(value);
OperandGenerator g(this);
- if (value != NULL) {
- Emit(kArchRet, g.NoOutput(),
- g.UseLocation(value, linkage()->GetReturnLocation(),
- linkage()->GetReturnType()));
- } else {
- Emit(kArchRet, g.NoOutput());
- }
+ Emit(kArchRet, g.NoOutput(),
+ g.UseLocation(value, linkage()->GetReturnLocation(),
+ linkage()->GetReturnType()));
}
void RawMachineAssembler::Return(Node* value) {
- schedule()->AddReturn(CurrentBlock(), value);
+ Node* ret = NewNode(common()->Return(), value);
+ schedule()->AddReturn(CurrentBlock(), ret);
current_block_ = NULL;
}
Node* node = graph()->NewNode(op, input_count, inputs, incomplete);
BasicBlock* block = op->opcode() == IrOpcode::kParameter ? schedule()->start()
: CurrentBlock();
- schedule()->AddNode(block, node);
+ if (op->opcode() != IrOpcode::kReturn) {
+ schedule()->AddNode(block, node);
+ }
return node;
}