Attached is a patch which significantly reworks how calls, incoming
arguments, and outgoing return values are lowered. It's a major change,
affecting all targets, so I'm looking for feedback on the approach.
The goal of the patch is to eliminate a bunch of awkward code,
eliminate some unnecessary differences between targets, and to
facilitate future refactoring and feature work.
This patch gets rid of ISD::CALL, ISD::FORMAL_ARGUMENTS, ISD::RET, and
ISD::ISD::ARG_FLAGS, as well as the old LowerArguments and LowerCallTo
hooks. To replace them, it adds three new TargetLowering hooks:
LowerCall, LowerFormalArguments, and LowerReturn. These hooks provide
targets with the same information as the special nodes, except in an
immediately usable form instead of awkwardly encoded as SDNode
operands. The patch also re-works a substantial portion of the
target-independent tail-call code. The patch also includes changes
for all in-tree targets to use the new hooks.
Beyond dejagnu and some manual assembly output inspection,
so far I've only tested this on x86 targets. I'm not in a hurry
with this; I'm just looking for input at this point.
calling-conv-lowering.patch (289 KB)