From: Akira Hatanaka Date: Thu, 11 Aug 2011 22:42:31 +0000 (+0000) Subject: Enclose directive .cprestore with .set macro and nomacro to silence assembler X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=9029cf20e1158dbca9c95da72a646d467e871525;p=oota-llvm.git Enclose directive .cprestore with .set macro and nomacro to silence assembler warning. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137378 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/Mips/MipsFrameLowering.cpp b/lib/Target/Mips/MipsFrameLowering.cpp index 8b4e23876e8..22d1e47b1a2 100644 --- a/lib/Target/Mips/MipsFrameLowering.cpp +++ b/lib/Target/Mips/MipsFrameLowering.cpp @@ -254,9 +254,15 @@ void MipsFrameLowering::emitPrologue(MachineFunction &MF) const { } // 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, diff --git a/test/CodeGen/Mips/cprestore.ll b/test/CodeGen/Mips/cprestore.ll new file mode 100644 index 00000000000..a275c8b7a55 --- /dev/null +++ b/test/CodeGen/Mips/cprestore.ll @@ -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)