This patch implements CallLowering::lowerCall based on M68k calling convention and adds M68kOutgoingValueHandler and CallReturnHandler to handle argument passing and returned value.
Also there is a little problem: GlobalISel reject to combine G_LOAD followed by G_STORE into a move <ea>, <ea> unless there're consecutive in order. That is to say, if there is any instruction between them, GlobalISel will generate weird code like this:
Some of the move <ea>, <ea> definitions are actually missing IIRC. I'm tidying up all the MOVE instructions (to add those missing definitions, for instance) as part of the D115128 series and I think that will solve this problem.
|71 ↗||(On Diff #394840)|
Yes, GISel rejects the original pattern. It says "Dst operand has an unsupported type"
The SelectionDAG isn't affected. The MatcherTable is still the same after this change.
Since now I've discovered some problems in CallLowering and Legalizer, I want to defer the review of RegisterBankInfo & InstructionSelector. Doing that will also make reviewing simpler
Using F.getCallingConv() is using the calling function's calling convention. You want Info.CallConv like above
Don't need the 2>&1.
Also, probably should just use update_mir_test_checks
Value name in declaration list. I'm not sure why even parse this
These tests aren't comprehensive enough. You should add a wider variety of return value and outgoing argument types (particularly some pointers and aggregates). Maybe add some byval / sret too.
You're also testing a few different call instruction types which aren't covered (in particular indirect call and the isPositionIndependent switch).
Address the issue pointed out by @arsenm. Thanks arsenm !
The following additional tests are included in this revision:
- return value with i32 / i16 / i8 and sret
- outgoing argument with i32 / i16 / i8 / pointer / array / struct
- struct passed byval.
- integer passed byval.
- array passed byval.
- indirect call
- call with pic