[PATCH] Implement getNoopForMachoTarget for SPARC

Brad Smith brad at comstyle.com
Sat Aug 30 00:24:19 PDT 2014


Implement getNoopForMachoTarget for SPARC.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

-------------- next part --------------
Index: lib/Target/Sparc/SparcInstrInfo.cpp
===================================================================
--- lib/Target/Sparc/SparcInstrInfo.cpp	(revision 216808)
+++ lib/Target/Sparc/SparcInstrInfo.cpp	(working copy)
@@ -37,6 +37,11 @@
     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
Index: lib/Target/Sparc/SparcInstrInfo.h
===================================================================
--- lib/Target/Sparc/SparcInstrInfo.h	(revision 216808)
+++ lib/Target/Sparc/SparcInstrInfo.h	(working copy)
@@ -93,6 +93,8 @@
                             const TargetRegisterInfo *TRI) const override;
 
   unsigned getGlobalBaseReg(MachineFunction *MF) const;
+
+  void getNoopForMachoTarget(MCInst &NopInst) const override;
 };
 
 }
Index: test/CodeGen/SPARC/empty-functions.ll
===================================================================
--- test/CodeGen/SPARC/empty-functions.ll	(revision 0)
+++ test/CodeGen/SPARC/empty-functions.ll	(working copy)
@@ -0,0 +1,8 @@
+; RUN: llc < %s -mtriple=sparc-unknown-openbsd -disable-fp-elim | FileCheck -check-prefix=CHECK-FP %s
+
+define void @func() {
+entry:
+  unreachable
+}
+; CHECK-FP:      {{_?}}func:
+; CHECK-FP: nop {{[;!]}} avoids zero-length function


More information about the llvm-commits mailing list