Commit 741166f6 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[Liftoff] Implement {MoveToReturnRegister} platform independent

Now that wasm-linkage.h is split off, we can easily implement
{MoveToReturnRegister} in platform independent code.

R=titzer@chromium.org

Bug: v8:6600
Change-Id: I072a0ee48d58ed29e0df489016f838915c3f2cb2
Reviewed-on: https://chromium-review.googlesource.com/1041690
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: 's avatarBen Titzer <titzer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52939}
parent 5516afaf
......@@ -79,11 +79,6 @@ void LiftoffAssembler::MoveStackValue(uint32_t dst_index, uint32_t src_index,
BAILOUT("MoveStackValue");
}
void LiftoffAssembler::MoveToReturnRegister(LiftoffRegister reg,
ValueType type) {
BAILOUT("MoveToReturnRegister");
}
void LiftoffAssembler::Move(Register dst, Register src, ValueType type) {
BAILOUT("Move Register");
}
......
......@@ -306,15 +306,6 @@ void LiftoffAssembler::MoveStackValue(uint32_t dst_index, uint32_t src_index,
Str(scratch, liftoff::GetStackSlot(dst_index));
}
void LiftoffAssembler::MoveToReturnRegister(LiftoffRegister reg,
ValueType type) {
if (reg.is_gp()) {
Move(x0, reg.gp(), type);
} else {
Move(d0, reg.fp(), type);
}
}
void LiftoffAssembler::Move(Register dst, Register src, ValueType type) {
if (type == kWasmI32) {
Mov(dst.W(), src.W());
......
......@@ -357,16 +357,6 @@ void LiftoffAssembler::MoveStackValue(uint32_t dst_index, uint32_t src_index,
}
}
void LiftoffAssembler::MoveToReturnRegister(LiftoffRegister reg,
ValueType type) {
// TODO(wasm): Extract the destination register from the CallDescriptor.
// TODO(wasm): Add multi-return support.
LiftoffRegister dst = reg.is_pair() ? LiftoffRegister::ForPair(eax, edx)
: reg.is_gp() ? LiftoffRegister(eax)
: LiftoffRegister(xmm1);
if (reg != dst) Move(dst, reg, type);
}
void LiftoffAssembler::Move(Register dst, Register src, ValueType type) {
DCHECK_NE(dst, src);
DCHECK_EQ(kWasmI32, type);
......
......@@ -372,7 +372,6 @@ class LiftoffAssembler : public TurboAssembler {
ValueType);
inline void MoveStackValue(uint32_t dst_index, uint32_t src_index, ValueType);
inline void MoveToReturnRegister(LiftoffRegister src, ValueType);
inline void Move(Register dst, Register src, ValueType);
inline void Move(DoubleRegister dst, DoubleRegister src, ValueType);
......
......@@ -1074,7 +1074,14 @@ class LiftoffCompiler {
if (!values.is_empty()) {
if (values.size() > 1) return unsupported(decoder, "multi-return");
LiftoffRegister reg = __ PopToRegister();
__ MoveToReturnRegister(reg, values[0].type);
LiftoffRegister return_reg =
kNeedI64RegPair && values[0].type == kWasmI64
? LiftoffRegister::ForPair(kGpReturnRegisters[0],
kGpReturnRegisters[1])
: reg_class_for(values[0].type) == kGpReg
? LiftoffRegister(kGpReturnRegisters[0])
: LiftoffRegister(kFpReturnRegisters[0]);
if (reg != return_reg) __ Move(return_reg, reg, values[0].type);
}
__ LeaveFrame(StackFrame::WASM_COMPILED);
__ DropStackSlotsAndRet(
......
......@@ -458,16 +458,6 @@ void LiftoffAssembler::MoveStackValue(uint32_t dst_index, uint32_t src_index,
Spill(dst_index, reg, type);
}
void LiftoffAssembler::MoveToReturnRegister(LiftoffRegister reg,
ValueType type) {
// TODO(wasm): Extract the destination register from the CallDescriptor.
// TODO(wasm): Add multi-return support.
LiftoffRegister dst =
reg.is_pair() ? LiftoffRegister::ForPair(v0, v1)
: reg.is_gp() ? LiftoffRegister(v0) : LiftoffRegister(f2);
if (reg != dst) Move(dst, reg, type);
}
void LiftoffAssembler::Move(Register dst, Register src, ValueType type) {
DCHECK_NE(dst, src);
TurboAssembler::mov(dst, src);
......
......@@ -391,12 +391,6 @@ void LiftoffAssembler::MoveStackValue(uint32_t dst_index, uint32_t src_index,
Spill(dst_index, reg, type);
}
void LiftoffAssembler::MoveToReturnRegister(LiftoffRegister reg,
ValueType type) {
LiftoffRegister dst = reg.is_gp() ? LiftoffRegister(v0) : LiftoffRegister(f2);
if (reg != dst) Move(dst, reg, type);
}
void LiftoffAssembler::Move(Register dst, Register src, ValueType type) {
DCHECK_NE(dst, src);
// TODO(ksreten): Handle different sizes here.
......
......@@ -79,11 +79,6 @@ void LiftoffAssembler::MoveStackValue(uint32_t dst_index, uint32_t src_index,
BAILOUT("MoveStackValue");
}
void LiftoffAssembler::MoveToReturnRegister(LiftoffRegister reg,
ValueType type) {
BAILOUT("MoveToReturnRegister");
}
void LiftoffAssembler::Move(Register dst, Register src, ValueType type) {
BAILOUT("Move Register");
}
......
......@@ -79,11 +79,6 @@ void LiftoffAssembler::MoveStackValue(uint32_t dst_index, uint32_t src_index,
BAILOUT("MoveStackValue");
}
void LiftoffAssembler::MoveToReturnRegister(LiftoffRegister reg,
ValueType type) {
BAILOUT("MoveToReturnRegister");
}
void LiftoffAssembler::Move(Register dst, Register src, ValueType type) {
BAILOUT("Move Register");
}
......
......@@ -302,15 +302,6 @@ void LiftoffAssembler::MoveStackValue(uint32_t dst_index, uint32_t src_index,
}
}
void LiftoffAssembler::MoveToReturnRegister(LiftoffRegister reg,
ValueType type) {
// TODO(wasm): Extract the destination register from the CallDescriptor.
// TODO(wasm): Add multi-return support.
LiftoffRegister dst =
reg.is_gp() ? LiftoffRegister(rax) : LiftoffRegister(xmm1);
if (reg != dst) Move(dst, reg, type);
}
void LiftoffAssembler::Move(Register dst, Register src, ValueType type) {
DCHECK_NE(dst, src);
if (type == kWasmI32) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment