Commit 6b5578ec authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

Reland "[Liftoff] Rename kConstant to kI32Const"

This is a reland of f22156bf.

Original change's description:
> [Liftoff] Rename kConstant to kI32Const
>
> This makes it more clear that we only store i32 values as constants in
> the cache state.
>
> R=ahaas@chromium.org
>
> Bug: v8:6600
> Change-Id: I3022e963e864c9c533cbb673bd8502481389799b
> Reviewed-on: https://chromium-review.googlesource.com/853870
> Reviewed-by: Andreas Haas <ahaas@chromium.org>
> Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#50437}

Bug: v8:6600
Change-Id: I4c28f379eab525a0c86866c39b2e6b55f7c5ab1a
Reviewed-on: https://chromium-review.googlesource.com/857017
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50446}
parent e1c85e21
......@@ -411,7 +411,7 @@ void LiftoffAssembler::PushCallerFrameSlot(const VarState& src,
UNREACHABLE();
}
break;
case VarState::kConstant:
case VarState::kI32Const:
push(Immediate(src.i32_const()));
break;
}
......
......@@ -127,8 +127,7 @@ class StackTransferRecipe {
case VarState::kRegister:
asm_->Spill(dst_index, src.reg());
break;
case VarState::kConstant:
// TODO(clemensh): Handle other types than i32.
case VarState::kI32Const:
asm_->Spill(dst_index, WasmValue(src.i32_const()));
break;
}
......@@ -136,7 +135,7 @@ class StackTransferRecipe {
case VarState::kRegister:
LoadIntoRegister(dst.reg(), src, src_index);
break;
case VarState::kConstant:
case VarState::kI32Const:
DCHECK_EQ(dst, src);
break;
}
......@@ -153,7 +152,7 @@ class StackTransferRecipe {
DCHECK_EQ(dst.reg_class(), src.reg_class());
if (dst != src.reg()) MoveRegister(dst, src.reg());
break;
case VarState::kConstant:
case VarState::kI32Const:
LoadConstant(dst, WasmValue(src.i32_const()));
break;
}
......@@ -309,7 +308,7 @@ LiftoffRegister LiftoffAssembler::PopToRegister(RegClass rc,
DCHECK_EQ(rc, slot.reg_class());
cache_state_.dec_used(slot.reg());
return slot.reg();
case VarState::kConstant: {
case VarState::kI32Const: {
LiftoffRegister reg = GetUnusedRegister(rc, pinned);
LoadConstant(reg, WasmValue(slot.i32_const()));
return reg;
......@@ -356,7 +355,7 @@ void LiftoffAssembler::Spill(uint32_t index) {
Spill(index, slot.reg());
cache_state_.dec_used(slot.reg());
break;
case VarState::kConstant:
case VarState::kI32Const:
Spill(index, WasmValue(slot.i32_const()));
break;
}
......@@ -490,7 +489,7 @@ std::ostream& operator<<(std::ostream& os, VarState slot) {
return os << "s";
case VarState::kRegister:
return os << slot.reg();
case VarState::kConstant:
case VarState::kI32Const:
return os << "c" << slot.i32_const();
}
UNREACHABLE();
......
......@@ -38,7 +38,7 @@ class LiftoffAssembler : public TurboAssembler {
class VarState {
public:
enum Location : uint8_t { kStack, kRegister, kConstant };
enum Location : uint8_t { kStack, kRegister, kI32Const };
explicit VarState(ValueType type) : loc_(kStack), type_(type) {}
explicit VarState(ValueType type, LiftoffRegister r)
......@@ -46,7 +46,7 @@ class LiftoffAssembler : public TurboAssembler {
DCHECK_EQ(r.reg_class(), reg_class_for(type));
}
explicit VarState(ValueType type, uint32_t i32_const)
: loc_(kConstant), type_(type), i32_const_(i32_const) {
: loc_(kI32Const), type_(type), i32_const_(i32_const) {
DCHECK(type_ == kWasmI32 || type_ == kWasmI64);
}
......@@ -57,7 +57,7 @@ class LiftoffAssembler : public TurboAssembler {
return true;
case kRegister:
return reg_ == other.reg_;
case kConstant:
case kI32Const:
return i32_const_ == other.i32_const_;
}
UNREACHABLE();
......@@ -67,14 +67,14 @@ class LiftoffAssembler : public TurboAssembler {
bool is_gp_reg() const { return loc_ == kRegister && reg_.is_gp(); }
bool is_fp_reg() const { return loc_ == kRegister && reg_.is_fp(); }
bool is_reg() const { return loc_ == kRegister; }
bool is_const() const { return loc_ == kConstant; }
bool is_const() const { return loc_ == kI32Const; }
ValueType type() const { return type_; }
Location loc() const { return loc_; }
uint32_t i32_const() const {
DCHECK_EQ(loc_, kConstant);
DCHECK_EQ(loc_, kI32Const);
return i32_const_;
}
Register gp_reg() const { return reg().gp(); }
......@@ -95,7 +95,7 @@ class LiftoffAssembler : public TurboAssembler {
union {
LiftoffRegister reg_; // used if loc_ == kRegister
uint32_t i32_const_; // used if loc_ == kConstant
uint32_t i32_const_; // used if loc_ == kI32Const
};
};
......
......@@ -19,7 +19,7 @@ namespace internal {
namespace wasm {
constexpr auto kRegister = LiftoffAssembler::VarState::kRegister;
constexpr auto kConstant = LiftoffAssembler::VarState::kConstant;
constexpr auto kI32Const = LiftoffAssembler::VarState::kI32Const;
constexpr auto kStack = LiftoffAssembler::VarState::kStack;
namespace {
......@@ -547,7 +547,7 @@ class LiftoffCompiler {
case kRegister:
__ PushRegister(slot.type(), slot.reg());
break;
case kConstant:
case kI32Const:
__ cache_state()->stack_state.emplace_back(operand.type,
slot.i32_const());
break;
......@@ -592,7 +592,7 @@ class LiftoffCompiler {
target_slot = source_slot;
if (is_tee) state.inc_used(target_slot.reg());
break;
case kConstant:
case kI32Const:
__ DropStackSlot(&target_slot);
target_slot = source_slot;
break;
......
......@@ -397,7 +397,7 @@ void LiftoffAssembler::PushCallerFrameSlot(const VarState& src,
movsd(Operand(rsp, 0), src.reg().fp());
}
break;
case VarState::kConstant:
case VarState::kI32Const:
pushq(Immediate(src.i32_const()));
break;
}
......
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