This is an archive of the discontinued LLVM Phabricator instance.

[mips][mips64r6] Use JALR for returns instead of JR (which is not available on MIPS32r6/MIPS64r6)
ClosedPublic

Authored by dsanders on Jun 24 2014, 3:10 AM.

Details

Summary

RET, and RET_MM have been replaced by a pseudo named PseudoReturn.
In addition a version with a 64-bit GPR named PseudoReturn64 has been
added.

Instruction selection for a return matches RetRA, which is expanded post
register allocation to PseudoReturn/PseudoReturn64. During MipsAsmPrinter,
this PseudoReturn/PseudoReturn64 are emitted as:

  • (JALR64 $zero, $rs) on MIPS64r6
  • (JALR $zero, $rs) on MIPS32r6
  • (JR_MM $rs) on microMIPS
  • (JR $rs) otherwise

On MIPS32r6/MIPS64r6, 'jr $rs' is an alias for 'jalr $zero, $rs'. To aid
development and review (specifically, to ensure all cases of jr are
updated), these aliases are temporarily named 'r6.jr' instead of 'jr'.
A follow up patch will change them back to the correct mnemonic.

Added (JALR $zero, $rs) to MipsNaClELFStreamer's definition of an indirect
jump, and removed it from its definition of a call.
Note: I haven't accounted for MIPS64 in MipsNaClELFStreamer since it's
doesn't appear to account for any MIPS64-specifics.

The return instruction created as part of eh_return expansion is now expanded
using expandRetRA() so we use the right return instruction on MIPS32r6/MIPS64r6
('jalr $zero, $rs').

Also, fixed a misuse of isABI_N64() to detect 64-bit wide registers in
expandEhReturn().

Depends on D4267

Diff Detail

Event Timeline

dsanders updated this revision to Diff 10778.Jun 24 2014, 3:10 AM
dsanders retitled this revision from to [mips][mips64r6] Use JALR for returns instead of JR (which is not available on MIPS32r6/MIPS64r6).
dsanders updated this object.
dsanders edited the test plan for this revision. (Show Details)
dsanders added a subscriber: Unknown Object (MLST).

Added Mark Seaborn since this patch touches MipsNaClELFStreamer.

dsanders accepted this revision.Jul 9 2014, 3:18 AM
dsanders added a reviewer: dsanders.
This revision is now accepted and ready to land.Jul 9 2014, 3:18 AM
dsanders closed this revision.Jul 9 2014, 3:24 AM