Page MenuHomePhabricator

[RISCV][GlobalISel] Add lowerReturn for calling conv
AcceptedPublic

Authored by lewis-revill on Jan 14 2022, 7:26 AM.

Details

Summary

Add minimal support to lower return, and introduce an OutgoingValueHandler and an OutgoingValueAssigner for returns.

Supports return values with integer, pointer and aggregate types.

(Update of D69808 - avoiding commandeering that revision)

Diff Detail

Event Timeline

lewis-revill created this revision.Jan 14 2022, 7:26 AM
lewis-revill requested review of this revision.Jan 14 2022, 7:26 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 14 2022, 7:26 AM
arsenm added inline comments.Jan 17 2022, 4:17 PM
llvm/lib/CodeGen/TargetRegisterInfo.cpp
237–239 ↗(On Diff #399993)

This needs its own patch and justification

llvm/lib/Target/RISCV/RISCVCallLowering.cpp
112–116

This looks like you're copying the broken form of splitToValueTypes from x86. I think trying to handle all of the argument marshalling in simple looking callbacks like this is unworkable. If you call the generic splitToValueTypes in CallLowering, it should try to handle everything for you

148–175

This is reinventing generic infrastructure

177

Ditto, this is a less complete copy of the generic infrastructure

219

Ditto

lewis-revill edited the summary of this revision. (Show Details)

Don't reinvent existing generic functions; instead introduce an OutgoingValueAssigner to allow us to call determineAndHandleAssignments.

arsenm accepted this revision.Jan 26 2022, 4:28 PM
This revision is now accepted and ready to land.Jan 26 2022, 4:28 PM
lewis-revill retitled this revision from [WIP][RISCV][GlobalISel] Add lowerReturn for calling conv to [RISCV][GlobalISel] Add lowerReturn for calling conv.Feb 9 2022, 3:14 AM
arsenm added a comment.Feb 9 2022, 8:26 AM

LGTM

llvm/test/CodeGen/RISCV/GlobalISel/irtranslator/ret.ll
144

Probably should have some vectors