[PATCH] D51494: Fix unwind information for floating point registers

Jackson Woodruff via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 31 09:32:32 PDT 2018


Jackson updated this revision to Diff 163550.
Jackson added a comment.

Thanks for the feedback.  I have vastly simplified the testcase as suggested and deduplicated and lifted the definitions of {Target,Machine}RegisterInformation and MachineFunction out of the loop.


https://reviews.llvm.org/D51494

Files:
  lib/Target/ARM/ARMAsmPrinter.cpp
  test/CodeGen/ARM/unwind-fp.ll


Index: test/CodeGen/ARM/unwind-fp.ll
===================================================================
--- /dev/null
+++ test/CodeGen/ARM/unwind-fp.ll
@@ -0,0 +1,15 @@
+; RUN: llc < %s -mtriple=armv7a-arm-none-eabi | FileCheck %s
+
+target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
+target triple = "armv7-arm-none-eabi"
+
+define void @foo() minsize {
+entry:
+  ; CHECK: .vsave	{[[SAVE_REG:d[0-9]+]]}
+  ; CHECK-NEXT: .pad #8
+  ; CHECK-NEXT: vpush   {[[PAD_REG:d[0-9]+]], [[SAVE_REG]]}
+  ; CHECK: vpop     {[[PAD_REG]], [[SAVE_REG]]}
+  %a = alloca i32, align 4
+  call void asm sideeffect "", "r,~{d8}"(i32* %a)
+  ret void
+}
Index: lib/Target/ARM/ARMAsmPrinter.cpp
===================================================================
--- lib/Target/ARM/ARMAsmPrinter.cpp
+++ lib/Target/ARM/ARMAsmPrinter.cpp
@@ -1042,10 +1042,12 @@
   MCTargetStreamer &TS = *OutStreamer->getTargetStreamer();
   ARMTargetStreamer &ATS = static_cast<ARMTargetStreamer &>(TS);
   const MachineFunction &MF = *MI->getParent()->getParent();
-  const TargetRegisterInfo *RegInfo = MF.getSubtarget().getRegisterInfo();
+  const TargetRegisterInfo *TargetRegInfo =
+    MF.getSubtarget().getRegisterInfo();
+  const MachineRegisterInfo &MachineRegInfo = MF.getRegInfo();
   const ARMFunctionInfo &AFI = *MF.getInfo<ARMFunctionInfo>();
 
-  unsigned FramePtr = RegInfo->getFrameRegister(MF);
+  unsigned FramePtr = TargetRegInfo->getFrameRegister(MF);
   unsigned Opc = MI->getOpcode();
   unsigned SrcReg, DstReg;
 
@@ -1102,7 +1104,9 @@
         if (MO.isUndef()) {
           assert(RegList.empty() &&
                  "Pad registers must come before restored ones");
-          Pad += 4;
+          unsigned Width =
+            TargetRegInfo->getRegSizeInBits(MO.getReg(), MachineRegInfo) / 8;
+          Pad += Width;
           continue;
         }
         RegList.push_back(MO.getReg());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51494.163550.patch
Type: text/x-patch
Size: 1903 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180831/9644fa4e/attachment.bin>


More information about the llvm-commits mailing list