[llvm-dev] About a new porting of GlobalIsel for RISCV
wei wei via llvm-dev
llvm-dev at lists.llvm.org
Wed Jul 24 09:47:07 PDT 2019
I would like to start a new porting of GlobalIsel for RISCV.
An initial patch about GlobalIsel infrastructure for RISCV was ready now:
There is another porting patch https://reviews.llvm.org/D41653 posted
by Leslie Zhai at the end of 2017. I have checked with Leslie about
the status of this patch.He has stopped developing it since some
questions need be resolved. There are some discussions about it:
Till now, I think we have a reasonable solution to continue the work,
the implementation of GlobalIsel from Mips is a good example, which
use target-specific "MipsCCState" and "MipsCallLowering::MipsHandler"
to handle Call/Arguments/Return lowering.
For RISCV, there's no "CCAssignFnForCall" or "CCAssignFnForReturn"
functions defined, just like the solution in Mips, a new
target-specific "ValueHandler" will be created to support
I have made some experiment that trying to implement the "LowerReturn"
function, and it can return correctly. The code snippet may be as
CCState CCInfo(F.getCallingConv(), F.isVarArg(), MF, ArgLocs, F.getContext());
TLI.analyzeOutputArgs(MF, CCInfo, Outs, true, nullptr);
RISCVValueHandler RetHandler(MIRBuilder, MF.getRegInfo(), Ret);
In order to reduce duplicated code as much as possible, and reuse part
of code from "TargetLowering" for GlobalIsel, the access specifiers
for some functions in RISCVTargetLowering need be changed, like
"analyzeOutputArgs". I have made a separate patch for it:
Since Leslie is no longer working on GlobalIsel, I want to continue
his work and make some contributions for RISCV target.
The code base was changed a lot from 2017, so I restart a new
GlobalIsel(RISCV) patch for reviewing, any suggestions or reviewing
comments would be appreciated.
More information about the llvm-dev