This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Prevent use of t0(aka x5) as rs1 for jalr instructions.
ClosedPublic

Authored by craig.topper on Jul 13 2021, 12:04 AM.

Details

Summary

Some microarchitectures treat rs1=x1/x5 on jalr as a hint to pop
the return-address stack. We should avoid using x5 on jalr
instructions since we aren't using x5 as an alternate link register.

Diff Detail

Event Timeline

craig.topper created this revision.Jul 13 2021, 12:04 AM
craig.topper requested review of this revision.Jul 13 2021, 12:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 13 2021, 12:04 AM
Herald added a subscriber: MaskRay. · View Herald Transcript
This revision is now accepted and ready to land.Jul 13 2021, 2:10 AM
jrtc27 added inline comments.Jul 13 2021, 6:19 AM
llvm/lib/Target/RISCV/RISCVInstrInfo.td
1006

This is one part of TableGen that I've never quite understood the rules about, but: does the expansion also need to use GPRJALR? (ditto for PseudoCALLIndirect)

craig.topper added inline comments.Jul 13 2021, 9:45 AM
llvm/lib/Target/RISCV/RISCVInstrInfo.td
1006

I'm not sure. I matched what was already being done for PseudoTAILIndirect which used GPRTC for the ins and the isel pattern, but used GPR for the PseudoInstExpansion.

This revision was landed with ongoing or failed builds.Jul 13 2021, 9:53 AM
This revision was automatically updated to reflect the committed changes.