[llvm] [RISCV][GlobalISel] Lower calls to variadic functions (PR #68271)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 4 16:16:52 PDT 2023


topperc wrote:

> In ISelLowering it looks like we do give some care to varargs.
> 
> * If all registers are allocated, then all varargs must be passed on the stack and don't need to save any argregs
> * record the frame index of the first variable argument which is a value necessary to VASTART.
> * if saving an odd number of registers then create an extra stack slot to ensure that the frame pointer is correctly aligned
> * copy the integer register that may have been used for passing varargs to the vararg save area
> 
> Why don't we need this in GISel?

I believe the code you mention is in RISCVTargetLowering::LowerFormalArguments in SelectionDAG. That is used to codegen the beginning of a variadic function. That will need to be done in `RISCVCallLowering::lowerFormalArguments` for gisel.

This patch is for calls to variadic functions. The equivalent is RISCVTargetLowering::LowerCall in SelectionDAG.

https://github.com/llvm/llvm-project/pull/68271


More information about the llvm-commits mailing list