This adds support for lowering more than 4 arguments (although still i32 only).
It uses the handleAssignments / ValueHandler infrastructure extracted from
the AArch64 backend in D27045.
Details
Diff Detail
Event Timeline
lib/Target/ARM/ARMCallLowering.cpp | ||
---|---|---|
52 | This is silently ignoring the signext/zeroext modifiers that are needed to correctly handle small types on AAPCS. It'd probably be better to fallback or assert if they're not being supported yet. | |
lib/Target/ARM/ARMInstructionSelector.cpp | ||
81–83 | Is this selection stuff intentionally in the same patch? Seems like it's an orthogonal issue. |
lib/Target/ARM/ARMCallLowering.cpp | ||
---|---|---|
52 | I would recommend to change the ValueHandler APIs to return boolean so we can indeed fallback while stuff is not supported. |
lib/Target/ARM/ARMCallLowering.cpp | ||
---|---|---|
52 | Right now we're falling back before reaching this point, by returning false from ARMCallLowering::lowerReturn if the type is not strictly 32-bit wide (see line 86). I think assertions would be more appropriate in this case, because it's not too complicated to check all the value types up front before calling this. I'll add some throughout. | |
lib/Target/ARM/ARMInstructionSelector.cpp | ||
81–83 | It's intentional, I wanted to have end-to-end support for more than 4 arguments, and that includes selecting loads from the stack. |
Split out the part that was NFC with regard to D26677 (using ValueHandler for <= 4 args). This patch is now only concerned with lowering more than 4 arguments (i.e. loading from the stack). Hopefully it's easier to review now.
Looks reasonable to me, modulo splitting it up slightly (which isn't even essential).
lib/Target/ARM/ARMInstructionSelector.cpp | ||
---|---|---|
81–83 | Yep, but while arg lowering depends on selection, the reverse isn't true. You could use and test these instructions without touching any CallLowering file. I think the changes are completely sound but the commit messages might be more coherent if you did it in two stages ("select XYZ" and "support more args") . |
This is silently ignoring the signext/zeroext modifiers that are needed to correctly handle small types on AAPCS. It'd probably be better to fallback or assert if they're not being supported yet.