Commit 5ec339c4 authored by mtrofin's avatar mtrofin Committed by Commit bot

check if we can split (linear scan)

Revert "[wasm] Quickfix for register allocation problem on ia32."

This reverts commit 2ca31b63.

BUG=

Review URL: https://codereview.chromium.org/1824303002

Cr-Commit-Position: refs/heads/master@{#35559}
parent 095aef6d
......@@ -2947,9 +2947,13 @@ void LinearScanAllocator::AllocateBlockedReg(LiveRange* current) {
LifetimePosition pos = use_pos[reg];
if (pos < register_use->pos()) {
// All registers are blocked before the first use that requires a register.
// Spill starting part of live range up to that use.
SpillBetween(current, current->Start(), register_use->pos());
if (LifetimePosition::ExistsGapPositionBetween(current->Start(),
register_use->pos())) {
SpillBetween(current, current->Start(), register_use->pos());
} else {
SetLiveRangeAssignedRegister(current, reg);
SplitAndSpillIntersecting(current);
}
return;
}
......@@ -2994,6 +2998,8 @@ void LinearScanAllocator::SplitAndSpillIntersecting(LiveRange* current) {
// live-ranges: ranges are allocated in order of their start positions,
// ranges are retired from active/inactive when the start of the
// current live-range is larger than their end.
DCHECK(LifetimePosition::ExistsGapPositionBetween(current->Start(),
next_pos->pos()));
SpillBetweenUntil(range, spill_pos, current->Start(), next_pos->pos());
}
ActiveToHandled(range);
......
......@@ -46,6 +46,14 @@ class LifetimePosition final {
return LifetimePosition(index * kStep + kHalfStep);
}
static bool ExistsGapPositionBetween(LifetimePosition pos1,
LifetimePosition pos2) {
if (pos1 > pos2) std::swap(pos1, pos2);
LifetimePosition next(pos1.value_ + 1);
if (next.IsGapPosition()) return next < pos2;
return next.NextFullStart() < pos2;
}
// Returns a numeric representation of this lifetime position.
int value() const { return value_; }
......
......@@ -58,7 +58,7 @@ LinkageLocation stackloc(int i) {
// ===========================================================================
// == ia32 ===================================================================
// ===========================================================================
#define GP_PARAM_REGISTERS eax, edx, ecx, ebx
#define GP_PARAM_REGISTERS eax, edx, ecx, ebx, esi
#define GP_RETURN_REGISTERS eax, edx
#define FP_PARAM_REGISTERS xmm1, xmm2, xmm3, xmm4, xmm5, xmm6
#define FP_RETURN_REGISTERS xmm1, xmm2
......
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