Commit 5920777a authored by Andreas Haas's avatar Andreas Haas Committed by Commit Bot

[ia32][turbofan] Pass the slot index for the peek instruction by operand

This is the implementation of crrev.com/c/866721 for ia32.

Drive-by change: Clean up the slot index calculation.

At the moment the slot index is encoded in the opcode. This, however,
sets an upper limit the slot index which is lower than what we want to
have (i.e. < 512). With this change we pass the slot index as an
immediate operand, which does not impose limits on the value it
contains.

R=titzer@chromium.org

Change-Id: I40adf8c6e62de28f8428492db6c5297252c1e2d1
Reviewed-on: https://chromium-review.googlesource.com/864642Reviewed-by: 's avatarBen Titzer <titzer@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50643}
parent 00ac7641
......@@ -1599,7 +1599,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
break;
}
case kIA32Peek: {
int reverse_slot = MiscField::decode(instr->opcode());
int reverse_slot = i.InputInt32(0) + 1;
int offset =
FrameSlotToFPOffset(frame()->GetTotalFrameSlotCount() - reverse_slot);
if (instr->OutputAt(0)->IsFPRegister()) {
......
......@@ -1023,7 +1023,6 @@ void InstructionSelector::EmitPrepareResults(ZoneVector<PushParameter>* results,
int reverse_slot = 0;
for (PushParameter output : *results) {
if (!output.location.IsCallerFrameSlot()) continue;
++reverse_slot;
// Skip any alignment holes in nodes.
if (output.node != nullptr) {
DCHECK(!descriptor->IsCFunctionCall());
......@@ -1032,13 +1031,10 @@ void InstructionSelector::EmitPrepareResults(ZoneVector<PushParameter>* results,
} else if (output.location.GetType() == MachineType::Float64()) {
MarkAsFloat64(output.node);
}
InstructionOperand result = g.DefineAsRegister(output.node);
Emit(kIA32Peek | MiscField::encode(reverse_slot), result);
}
if (output.location.GetType() == MachineType::Float64()) {
// Float64 require an implicit second slot.
++reverse_slot;
Emit(kIA32Peek, g.DefineAsRegister(output.node),
g.UseImmediate(reverse_slot));
}
reverse_slot += output.location.GetSizeInPointers();
}
}
......
......@@ -173,7 +173,7 @@
'test-multiple-return/*': [SKIP],
}],
# TODO(ahaas): Port multiple return values to ARM, MIPS, S390 and PPC
['arch == ia32 or arch == mips or arch == mips64 or arch == mipsel or arch == mips64el or arch == s390 or arch == s390x or arch == ppc or arch == ppc64', {
['arch == mips or arch == mips64 or arch == mipsel or arch == mips64el or arch == s390 or arch == s390x or arch == ppc or arch == ppc64', {
'test-multiple-return/ReturnLastValue*': [SKIP],
}],
##############################################################################
......
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