[PATCH] D74794: [X86][ISelLowering] refactor Varargs handling in X86ISelLowering.cpp

Alexey Lapshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 7 13:35:44 PDT 2020


avl marked an inline comment as done.
avl added inline comments.


================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:3380-3393
+struct VarArgRegsDescr {
+  ArrayRef<MCPhysReg> ArgGPRs; // all GPR registers used for passing varargs
+  ArrayRef<MCPhysReg> ArgXMMs; // all XMM registers used for passing varargs
+  unsigned NumIntRegs = 0;     // number of allocated GPRs
+  unsigned NumXMMRegs = 0;     // number of allocated XMMs
+
+  ArrayRef<MCPhysReg> getAvailableIntRegs() {
----------------
aeubanks wrote:
> avl wrote:
> > aeubanks wrote:
> > > this struct and VarArgsLoweringHelper::getVarArgRegsDescriptor seem unnecessary and are only used in the is64Bit() part, can all the variables be inlined?
> > @aeubanks Thank you, for the comment and Excuse me for a delayed answer. I missed a notification about that comment. This structure is used as a parameter for createVarArgAreaAndStoreRegisters() and later I am going to use it in forwardMustTailParameters(for D69372). If it would be inlined then both of these functions - createVarArgAreaAndStoreRegisters and forwardMustTailParameters will have duplicated code.  So the reason of  VarArgsLoweringHelper::getVarArgRegsDescriptor is to have single register description and avoid code duplication. 
> > 
> > Do you think it is still better to inline  VarArgsLoweringHelper::getVarArgRegsDescriptor ?
> But it looks like `VarArgRegsDescr` is only populated, and therefore only useful when `is64Bit()` is true. And the usage of `RegDescr` in `createVarArgAreaAndStoreRegisters()` seems to support that. Or do you mean you plan on extending `getVarArgRegsDescriptor()` later? Or using `VarArgRegsDescr` in non-64 bit contexts later?
I did not plan to use it in non-64 bit context(Though it could be done later if necessarily for some specific architecture). The idea was to create bits-neutral description(VarArgRegsDescr) once and use it later (in createVarArgAreaAndStoreRegisters and forwardMustTailParameters). 

If that is unnecessary general for that case - then I would inline that descriptor.





Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74794/new/

https://reviews.llvm.org/D74794





More information about the llvm-commits mailing list