[llvm-commits] [llvm] r137378 - in /llvm/trunk: lib/Target/Mips/MipsFrameLowering.cpp test/CodeGen/Mips/cprestore.ll

Akira Hatanaka ahatanak at gmail.com
Thu Aug 11 15:42:31 PDT 2011


Author: ahatanak
Date: Thu Aug 11 17:42:31 2011
New Revision: 137378

URL: http://llvm.org/viewvc/llvm-project?rev=137378&view=rev
Log:
Enclose directive .cprestore with .set macro and nomacro to silence assembler
warning. 


Added:
    llvm/trunk/test/CodeGen/Mips/cprestore.ll
Modified:
    llvm/trunk/lib/Target/Mips/MipsFrameLowering.cpp

Modified: llvm/trunk/lib/Target/Mips/MipsFrameLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsFrameLowering.cpp?rev=137378&r1=137377&r2=137378&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsFrameLowering.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsFrameLowering.cpp Thu Aug 11 17:42:31 2011
@@ -254,9 +254,15 @@
   }
 
   // Restore GP from the saved stack location
-  if (MipsFI->needGPSaveRestore())
-    BuildMI(MBB, MBBI, dl, TII.get(Mips::CPRESTORE))
-      .addImm(MFI->getObjectOffset(MipsFI->getGPFI()));
+  if (MipsFI->needGPSaveRestore()) {
+    unsigned Offset = MFI->getObjectOffset(MipsFI->getGPFI());
+    BuildMI(MBB, MBBI, dl, TII.get(Mips::CPRESTORE)).addImm(Offset);
+
+    if (Offset >= 0x8000) {
+      BuildMI(MBB, llvm::prior(MBBI), dl, TII.get(Mips::MACRO));
+      BuildMI(MBB, MBBI, dl, TII.get(Mips::NOMACRO));
+    }
+  }
 }
 
 void MipsFrameLowering::emitEpilogue(MachineFunction &MF,

Added: llvm/trunk/test/CodeGen/Mips/cprestore.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/cprestore.ll?rev=137378&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Mips/cprestore.ll (added)
+++ llvm/trunk/test/CodeGen/Mips/cprestore.ll Thu Aug 11 17:42:31 2011
@@ -0,0 +1,16 @@
+; RUN: llc -march=mipsel < %s | FileCheck %s
+
+; CHECK: .set macro
+; CHECK-NEXT: .cprestore
+; CHECK-NEXT: .set nomacro
+
+%struct.S = type { [16384 x i32] }
+
+define void @foo2() nounwind {
+entry:
+  %s = alloca %struct.S, align 4
+  call void @foo1(%struct.S* byval %s)
+  ret void
+}
+
+declare void @foo1(%struct.S* byval)





More information about the llvm-commits mailing list