[PATCH] D103651: [AIX] generate eh_info when vector registers are saved according to the traceback table.

Sean Fertile via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 9 14:08:17 PDT 2021


sfertile added inline comments.


================
Comment at: llvm/include/llvm/CodeGen/AsmPrinter.h:755
                               Align InAlign = Align(1));
+  virtual uint16_t getNumberOfVRSaved() const {
+    llvm_unreachable("The function is for aix OS only.");
----------------
DiggerLin wrote:
> jasonliu wrote:
> > I don't feel like this function belong in AsmPrinter.
> > This function feels more like a PPCFunctionInfo class function. 
> > Admittedly, doing that means in `AIXException.cpp`, you would need to do an include like this: `#include ../../Target/PowerPC/PPCMachineFunctionInfo.h", which I don't see very often in the llvm source.
> > Not sure if this is an acceptable practice. @hubert.reinterpretcast  any ideas?
> > 
> > The other way of doing this without that weird include in `AIXException.cpp` would be to move the content in `AIXException.cpp` to `PPCAIXAsmPrinter` instead. That way, you will definitely have access to everything you need in the PPCAIXAsmPrinter context.
> > 
> > Other than that, I am not sure if there is a better way on how to encasuplate what's needed for knowing if the vector register is save. i.e. The fundamental issue here is the knowledge of the PPC vector register is in `lib/Target/PowerPC` directory, so whenever you need to know that knowledge from another directory (and in case, `lib/CodeGen/AsmPrinter/AIXException.cpp`), it's hard to pass the information in. 
>  if we include the #include ../../Target/PowerPC/PPCMachineFunctionInfo.h in the AIXException.cpp , we have to implement the function getNumberOfVRSaved in file PPCMachineFunctionInfo.h , (not in the PPCMachineFunctionInfo.cpp) , otherwise it is link error when generate libLLVMAsmPrinter.a.  implement a large function in PPCMachineFunctionInfo.h is not a good idea.
Why make it a member function at all, instead incorporate looping over to see if any of the CSR VRs are used in 'ShouldEmitEHBlock', and loop over and count the number of CSR VRs inline (or as a static helper with a MachineFunction argument) in PPCAIXAsmPrinter.cpp. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103651



More information about the llvm-commits mailing list