Provide an implementation of getNoopForMachoTarget for SPARC.
authorBrad Smith <brad@comstyle.com>
Thu, 11 Sep 2014 17:40:51 +0000 (17:40 +0000)
committerBrad Smith <brad@comstyle.com>
Thu, 11 Sep 2014 17:40:51 +0000 (17:40 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217611 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Sparc/SparcInstrInfo.cpp
lib/Target/Sparc/SparcInstrInfo.h
test/CodeGen/SPARC/empty-functions.ll [new file with mode: 0644]

index 8b2e6bc5f32fbc177cf84e273e9b50df0bf1f8f8..6836d8d6f6870f22028012ba00fb9bd9d2e910f8 100644 (file)
@@ -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
index fe93ed7b57c76ea553d9ddf63ec4de6715b20838..2c39bbc3000012669d101d94e9d329c8e9ad355d 100644 (file)
@@ -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 (file)
index 0000000..9252299
--- /dev/null
@@ -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