This is an archive of the discontinued LLVM Phabricator instance.

[mips] Do not place users of $ra in the delay slot of call instructions.
ClosedPublic

Authored by vkalintiris on May 11 2015, 9:34 AM.

Details

Summary

When we are trying to fill the delay slot of a call instruction, we must avoid
filler instructions that use the $ra register. This fixes the test
MultiSource/Applications/JM/lencod when we enable the forward delay slot filler.

Diff Detail

Repository
rL LLVM

Event Timeline

vkalintiris retitled this revision from to [mips] Do not place users of $ra in the delay slot of call instructions..
vkalintiris updated this object.
vkalintiris edited the test plan for this revision. (Show Details)
vkalintiris added a reviewer: dsanders.
vkalintiris added a subscriber: Unknown Object (MLST).
dsanders accepted this revision.May 12 2015, 7:50 AM
dsanders edited edge metadata.

LGTM with a couple minor changes.

lib/Target/Mips/MipsDelaySlotFiller.cpp
319–322 ↗(On Diff #25480)

Can you use this?:

if (MI.definesRegister(Mips::RA))
  Defs.set(Mips::RA);
if (MI.definesRegister(Mips::RA_64))
  Defs.set(Mips::RA_64);

so we don't add defs that weren't in the original instruction.

Could you also elaborate on the comment to explain the quirk that makes this necessary. The delay slot is very slightly inside the function. It's sufficiently inside that RA/RA_64 have already been updated and must be preserved, but not so far inside that we can't preserve values in the other callee-saved registers.

This revision is now accepted and ready to land.May 12 2015, 7:50 AM
This revision was automatically updated to reflect the committed changes.