Commit bf08329c authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[Liftoff] Use better value for "undefined Register"

There is no "no_reg" LiftoffRegister, so we sometimes have to
initialize it to an arbitrary value, because it will be overwritten
later anyway. One solution would be to wrap it in base::Optional, but
that does not really reflect the right semantics, since it's not
optional, but just set at a later point.
So far, we used the register with code 0, but on some platforms (e.g.
mips), register 0 is not a Liftoff cache register. So just use the
first gp cache register instead.

R=ahaas@chromium.org

Bug: chromium:883280
Change-Id: I157384ad5a9ca6a20aa198f3217a7d754dc53e30
Reviewed-on: https://chromium-review.googlesource.com/1221216
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55835}
parent 1a236fb8
......@@ -286,7 +286,7 @@ void LiftoffAssembler::CacheState::InitMerge(const CacheState& source,
auto& dst = stack_state[dst_idx];
auto& src = source.stack_state[src_idx];
// Just initialize to any register; will be overwritten before use.
LiftoffRegister reg(Register::from_code<0>());
LiftoffRegister reg = kGpCacheRegList.GetFirstRegSet();
RegClass rc = src.is_reg() ? src.reg_class() : reg_class_for(src.type());
if (src.is_reg() && is_free(src.reg())) {
reg = src.reg();
......
......@@ -266,14 +266,14 @@ class LiftoffCompiler {
uint32_t ProcessParameter(ValueType type, uint32_t input_idx) {
const int num_lowered_params = 1 + needs_reg_pair(type);
// Initialize to anything, will be set in the loop and used afterwards.
LiftoffRegister reg = LiftoffRegister::from_code(kGpReg, 0);
LiftoffRegister reg = kGpCacheRegList.GetFirstRegSet();
RegClass rc = num_lowered_params == 1 ? reg_class_for(type) : kGpReg;
LiftoffRegList pinned;
for (int pair_idx = 0; pair_idx < num_lowered_params; ++pair_idx) {
compiler::LinkageLocation param_loc =
descriptor_->GetInputLocation(input_idx + pair_idx);
// Initialize to anything, will be set in both arms of the if.
LiftoffRegister in_reg = LiftoffRegister::from_code(kGpReg, 0);
LiftoffRegister in_reg = kGpCacheRegList.GetFirstRegSet();
if (param_loc.IsRegister()) {
DCHECK(!param_loc.IsAnyRegister());
int reg_code = param_loc.AsRegister();
......@@ -357,7 +357,7 @@ class LiftoffCompiler {
}
DCHECK_EQ(input_idx, descriptor_->InputCount());
// Set to a gp register, to mark this uninitialized.
LiftoffRegister zero_double_reg(Register::from_code<0>());
LiftoffRegister zero_double_reg = kGpCacheRegList.GetFirstRegSet();
DCHECK(zero_double_reg.is_gp());
for (uint32_t param_idx = num_params; param_idx < __ num_locals();
++param_idx) {
......
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