Thanks for the patch Leslie. My main concern with this approach is it will fail to work when VarArg support is added (D40805). Conforming to the vararg ABI requires 1) knowing which arguments are fixed vs non-fixed (I currently just have an extra parameter for this in CC_RISCV, Mips handles this with MipsCCState), 2) knowing the original type of an argument. Both issues could be addressed by introducing a RISCVCCState (where I'd probably keep a Datalayout and a SubtargetInfo reference), but looking at GlobalISel that wouldn't actually help without further changes - CallLowering::handleAssignments creates a CCState directly, meaning you'd need to make further changes to support a custom CCState (as used in Hexagon, SystemZ, Mips and other backends).
I think some more GlobalISel design work needs to be done here really. It looks like splitting a smaller assignArgs function out of handleAssignments and making it virtual would help, but still wouldn't provide complete drop-in compatibility with custom CCState subclasses.
Thanks for your review!
My main concern with this approach is it will fail to work when VarArg support is added (D40805).
I will apply the patch of D40805 and read carefully about it.
meaning you'd need to make further changes to support a custom CCState (as used in Hexagon, SystemZ, Mips and other backends)
I will learn from other Targets to support a custom RISCVCCState.
I think some more GlobalISel design work needs to be done here really.
My sincere thanks will goto the developers who taught me a lot :) Thanks for your leading!
Hi LLVM developers,
Thanks for your code view, I can rebase my patch based on D40805 .
- Consider about IsFixed and OrigTy, but assert as firstly:
assert(IsFixed && "IsFixed support not yet implemented"); assert(OrigTy && "OrigTy support not yet implemented");
The implementation of RISCVCCState will be in the next patch, please give me some suggestion about custom RISCVCCState inherited from CCState, I think, at least, it needs to cover IsFixed and OrigTy.
- Remove parameter DL for CC_RISCV, because it is able to use State.getMachineFunction().getDataLayout() through parameter State.
Please review my patch again, thanks a lot!
Hi Leslie. Obviously we need to resolve the CCState issue before merging this, as it would regress codegen in its current state. Good observation that we can get the DataLayout via CCState. Given that, why not get rid of the various wrapper functions and just determine XLen and XLenVT from the DataLayout?
Thanks for your leading!
why not get rid of the various wrapper functions and just determine XLen and XLenVT from the DataLayout?
Obviously we need to resolve the CCState issue before merging this.
Sorry for my Chinese English :) is there some patch related to custom <Target>CCState, or someone began to implement RISCVCCState? if not, I will try to implement it.