This is an archive of the discontinued LLVM Phabricator instance.

[mips] Correct tail call pattern for MIPSR6
ClosedPublic

Authored by sdardis on Aug 9 2016, 2:28 AM.

Details

Summary

r277708 enabled tails calls for MIPS but used the 'jr' instruction when the
jump target was held in a register. For MIPSR6, 'jalr $zero, $reg' should
have been used. Additionally, add missing patterns for external and global
symbols for tail calls.

Diff Detail

Event Timeline

sdardis updated this revision to Diff 67303.Aug 9 2016, 2:28 AM
sdardis retitled this revision from to [mips] Correct tail call pattern for MIPSR6.
sdardis updated this object.
sdardis added reviewers: dsanders, vkalintiris.
sdardis set the repository for this revision to rL LLVM.
sdardis added a subscriber: llvm-commits.
dsanders added inline comments.Aug 11 2016, 5:51 AM
lib/Target/Mips/MipsInstrInfo.td
1377–1378

You can avoid the duplication by dropping this line and picking between the two substitutions in MipsAsmPrinter::EmitInstruction() in the same way as PseudoReturn/PseudoIndirectBranch/etc. do.

sdardis updated this revision to Diff 68030.Aug 15 2016, 6:07 AM
sdardis removed rL LLVM as the repository for this revision.

Refactored tailcall register implementation. Now it's a pseudo instruction. Simplified normal tail call definition into a 2 parameter class.

dsanders accepted this revision.Aug 18 2016, 5:30 AM
dsanders edited edge metadata.

LGTM

This revision is now accepted and ready to land.Aug 18 2016, 5:30 AM

Thanks, committed as rL279064.

sdardis closed this revision.Aug 18 2016, 6:37 AM
test/CodeGen/Mips/tailcall/tailcall-wrong-isa.ll