[llvm] r217611 - Provide an implementation of getNoopForMachoTarget for SPARC.

Brad Smith brad at comstyle.com
Thu Sep 11 10:40:51 PDT 2014


Author: brad
Date: Thu Sep 11 12:40:51 2014
New Revision: 217611

URL: http://llvm.org/viewvc/llvm-project?rev=217611&view=rev
Log:
Provide an implementation of getNoopForMachoTarget for SPARC.

Added:
    llvm/trunk/test/CodeGen/SPARC/empty-functions.ll
Modified:
    llvm/trunk/lib/Target/Sparc/SparcInstrInfo.cpp
    llvm/trunk/lib/Target/Sparc/SparcInstrInfo.h

Modified: llvm/trunk/lib/Target/Sparc/SparcInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcInstrInfo.cpp?rev=217611&r1=217610&r2=217611&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Sparc/SparcInstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/Sparc/SparcInstrInfo.cpp Thu Sep 11 12:40:51 2014
@@ -37,6 +37,11 @@ SparcInstrInfo::SparcInstrInfo(SparcSubt
     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

Modified: llvm/trunk/lib/Target/Sparc/SparcInstrInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcInstrInfo.h?rev=217611&r1=217610&r2=217611&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Sparc/SparcInstrInfo.h (original)
+++ llvm/trunk/lib/Target/Sparc/SparcInstrInfo.h Thu Sep 11 12:40:51 2014
@@ -93,6 +93,8 @@ public:
                             const TargetRegisterInfo *TRI) const override;
 
   unsigned getGlobalBaseReg(MachineFunction *MF) const;
+
+  void getNoopForMachoTarget(MCInst &NopInst) const override;
 };
 
 }

Added: llvm/trunk/test/CodeGen/SPARC/empty-functions.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/SPARC/empty-functions.ll?rev=217611&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/SPARC/empty-functions.ll (added)
+++ llvm/trunk/test/CodeGen/SPARC/empty-functions.ll Thu Sep 11 12:40:51 2014
@@ -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





More information about the llvm-commits mailing list