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

Jason Liu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 21 08:48:46 PDT 2021


jasonliu added inline comments.


================
Comment at: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1935-1936
+
+  // Since the new C++ runtime will be restoring vector registers on unwind, we
+  // need to emit a dumy eh info when there are VRs saved.
+  if (!TargetLoweringObjectFileXCOFF::ShouldEmitEHBlock(MF) &&
----------------
clang-format the suggested comment.

I would also suggest to put a comment in AIXException::endFunction to indicate there is another place that would emit this eh info table structure. In case someone needs to update this structure, they would know they need to update in both places.


================
Comment at: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:2112
+      TargetLoweringObjectFileXCOFF::ShouldEmitEHBlock(MF) ||
+      (getNumberOfVRSaved() > 0);
+
----------------
nit


================
Comment at: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:2223
     uint16_t VRData = 0;
-    // Calculate the number of VRs be saved.
-    // Vector registers 20 through 31 are marked as reserved and cannot be used
-    // in the default ABI.
-    const PPCSubtarget &Subtarget = MF->getSubtarget<PPCSubtarget>();
-    if (Subtarget.isAIXABI() && Subtarget.hasAltivec() &&
-        TM.getAIXExtendedAltivecABI()) {
-      for (unsigned Reg = PPC::V20; Reg <= PPC::V31; ++Reg)
-        if (MRI.isPhysRegModified(Reg)) {
-          // Number of VRs saved.
-          VRData |=
-              ((PPC::V31 - Reg + 1) << TracebackTable::NumberOfVRSavedShift) &
-              TracebackTable::NumberOfVRSavedMask;
-          // This bit is supposed to set only when the special register
-          // VRSAVE is saved on stack.
-          // However, IBM XL compiler sets the bit when any vector registers
-          // are saved on the stack. We will follow XL's behavior on AIX
-          // so that we don't get surprise behavior change for C code.
-          VRData |= TracebackTable::IsVRSavedOnStackMask;
-          break;
-        }
+    uint16_t NumOfVRSaved = getNumberOfVRSaved();
+    if (NumOfVRSaved) {
----------------
This variable could move to above line 2112, so that you only need to call it once in `emitTracebackTable()`.


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