From: Brad Smith Date: Thu, 11 Sep 2014 17:40:51 +0000 (+0000) Subject: Provide an implementation of getNoopForMachoTarget for SPARC. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;ds=sidebyside;h=da9bce2e13dacd18d358b11a1e81b9bfb169a335;p=oota-llvm.git Provide an implementation of getNoopForMachoTarget for SPARC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217611 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/Sparc/SparcInstrInfo.cpp b/lib/Target/Sparc/SparcInstrInfo.cpp index 8b2e6bc5f32..6836d8d6f68 100644 --- a/lib/Target/Sparc/SparcInstrInfo.cpp +++ b/lib/Target/Sparc/SparcInstrInfo.cpp @@ -37,6 +37,11 @@ SparcInstrInfo::SparcInstrInfo(SparcSubtarget &ST) RI(ST), Subtarget(ST) { } +/// getNoopForMachoTarget - Return the noop instruction to use for a noop. +void SparcInstrInfo::getNoopForMachoTarget(MCInst &NopInst) const { + NopInst.setOpcode(SP::NOP); +} + /// isLoadFromStackSlot - If the specified machine instruction is a direct /// load from a stack slot, return the virtual or physical register number of /// the destination along with the FrameIndex of the loaded stack slot. If diff --git a/lib/Target/Sparc/SparcInstrInfo.h b/lib/Target/Sparc/SparcInstrInfo.h index fe93ed7b57c..2c39bbc3000 100644 --- a/lib/Target/Sparc/SparcInstrInfo.h +++ b/lib/Target/Sparc/SparcInstrInfo.h @@ -93,6 +93,8 @@ public: const TargetRegisterInfo *TRI) const override; unsigned getGlobalBaseReg(MachineFunction *MF) const; + + void getNoopForMachoTarget(MCInst &NopInst) const override; }; } diff --git a/test/CodeGen/SPARC/empty-functions.ll b/test/CodeGen/SPARC/empty-functions.ll new file mode 100644 index 00000000000..92522994cc7 --- /dev/null +++ b/test/CodeGen/SPARC/empty-functions.ll @@ -0,0 +1,8 @@ +; RUN: llc < %s -mtriple=sparc-unknown-openbsd -disable-fp-elim | FileCheck -check-prefix=CHECK-FP-LABEL %s + +define void @func() { +entry: + unreachable +} +; CHECK-FP-LABEL: {{_?}}func: +; CHECK-FP-LABEL: nop {{[;!]}} avoids zero-length function