This is an archive of the discontinued LLVM Phabricator instance.

[GlobalISel] Refactory CallLowering handleAssignments for custom <Target>CCState
AbandonedPublic

Authored by xiangzhai on Jan 5 2018, 9:36 AM.

Details

Summary

Hi LLVM developers,

Motivation:

As Alex suggested , I refactory handleAssignments in the CallLowering, so it is able to override handleAssignments in your <Target>CallLowering to initial your <Target>CCState, for example:

RISCVCCState CCInfo(F.getCallingConv(), F.isVarArg(), MF, ArgLocs,                  
            F.getContext() ...); // Add more custom variables to meet your Target's requirement

And it also need to override assignArg in your <Target>CallLowering, cast CCState to custom <Target>CCState, then do some target-specific treatment.

Please review my patch, and give me some suggestion, thanks for your teaching!

Regards,
Leslie Zhai

Diff Detail

Repository
rL LLVM

Event Timeline

xiangzhai created this revision.Jan 5 2018, 9:36 AM
aemerson added a subscriber: aemerson.
aemerson added inline comments.
include/llvm/CodeGen/GlobalISel/CallLowering.h
189

Why move the implementation to the header?

xiangzhai added inline comments.Jan 5 2018, 5:26 PM
include/llvm/CodeGen/GlobalISel/CallLowering.h
105–106

Pass a dummy AssignFn to the ValueHandler constructor and override

ValueHandler::assignArg

As Alex suggested, I pass a nullptr AssignFn for making immediate progress firstly in D41653, but we will change approach prior in D41700.

Please give me some suggestion about this change, thanks for your teaching!

189

Hi Amara,

Thanks for your review!

I just want to keep coding style, so I move the implementation of a Interface, defined as virtual function, to the header file. I also put the implementation of Graph Coloring all in header files https://github.com/xiangzhai/llvm/tree/riscv/include/llvm/CodeGen/GCol

I will revert the implementation back to source file, if not LGTU :)

Regards,
Leslie Zhai

xiangzhai updated this revision to Diff 129277.Jan 10 2018, 7:09 AM

Hi LLVM developers,

As Amara suggested, I revert handleAssignments, only add virtual to be a interface, so it is able to override handleAssignments in your <Target>CallLowering to initial your <Target>CCState.

Please review my patch again, thanks a lot!

Regards,
Leslie Zhai

xiangzhai edited the summary of this revision. (Show Details)Jan 16 2018, 9:44 PM
xiangzhai added a reviewer: javed.absar.
xiangzhai abandoned this revision.Sep 27 2018, 10:46 PM