[llvm-dev] How to implement lowerReturn for poring GlobalISel to RISCV?
Alex Bradbury via llvm-dev
llvm-dev at lists.llvm.org
Tue Dec 26 03:17:29 PST 2017
On 26 December 2017 at 07:50, Leslie Zhai <lesliezhai at llvm.org.cn> wrote:
> Hi Alex,
>
> Sorry to bother you for the holidays!
>
> I am stuck at CC_RISCV[1] you removed RetCC_RISCV32 and CC_RISCV32 from
> RISCVCallingConv.td and implemented a custom calling convention[2] function
> owing to TableGen-based calling convention definitions to lack flexibility
> and require substantial boilerplate when you reach their limitations.
>
> I asked the similar question[3] in the mailing list before, and Diana
> suggested that having a CCAssignFn available would make it easier to use the
> existing infrastructure. Because ValueHandler needs a CCAssignFn varaible
> for handling return not void value in lowerReturn.
>
> Please lead me to give me some direction, thanks a lot!
Hi Leslie. It seems the options are either:
1) Refactoring the existing CC_RISCV32 function to conform to the
CCAssignFn type. This would require stuffing the extra needed
information into a CCState subclass.
2) Pass a dummy AssignFn to the ValueHandler constructor and override
ValueHandler::assignArg.
Option 2) provides a straight-forward route to just getting something
working but isn't really a long-term solution. However, with a working
baseline implementation it's easier to explore and test alternative
approaches. If I were you, I'd probably start with 2) in order to make
immediate progress, but plan to change approach prior to merging
upstream.
Best,
Alex
More information about the llvm-dev
mailing list