Provide an implementation of getNoopForMachoTarget for PPC, otherwise
authorJoerg Sonnenberger <joerg@bec.de>
Fri, 8 Aug 2014 19:13:23 +0000 (19:13 +0000)
committerJoerg Sonnenberger <joerg@bec.de>
Fri, 8 Aug 2014 19:13:23 +0000 (19:13 +0000)
empty functions will assert in the MC object writer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215238 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/PowerPC/PPCInstrInfo.cpp
lib/Target/PowerPC/PPCInstrInfo.h
test/CodeGen/PowerPC/empty-functions.ll

index 1f4b3dd7e16ca8fb7d045ee9ee90e0b26dad8df0..61adc4b30e0a67600e0ce6bae5781204b84b8f16 100644 (file)
@@ -331,6 +331,11 @@ void PPCInstrInfo::insertNoop(MachineBasicBlock &MBB,
   BuildMI(MBB, MI, DL, get(Opcode));
 }
 
+/// getNoopForMachoTarget - Return the noop instruction to use for a noop.
+void PPCInstrInfo::getNoopForMachoTarget(MCInst &NopInst) const {
+  NopInst.setOpcode(PPC::NOP);
+}
+
 // Branch analysis.
 // Note: If the condition register is set to CTR or CTR8 then this is a
 // BDNZ (imm == 1) or BDZ (imm == 0) branch.
index 83f14c6cf214702061fec887fde54d53eb226127..db1cfcdf2c3f4af4e75a582a14242801b50c20d8 100644 (file)
@@ -228,6 +228,8 @@ public:
   /// instruction may be.  This returns the maximum number of bytes.
   ///
   unsigned GetInstSizeInBytes(const MachineInstr *MI) const;
+
+  void getNoopForMachoTarget(MCInst &NopInst) const override;
 };
 
 }
index 3a2907d5d7b9dbe1f3e72aa206f60ab4ce8beefe..bed16cfe82ad8b2fc5cea2d5537b96b02ba9cb5e 100644 (file)
@@ -1,5 +1,6 @@
 ; RUN: llc < %s -mtriple=powerpc-apple-darwin | FileCheck -check-prefix=CHECK-NO-FP %s
 ; RUN: llc < %s -mtriple=powerpc-apple-darwin -disable-fp-elim | FileCheck -check-prefix=CHECK-FP %s
+; RUN: llc < %s -mtriple=powerpc-netbsd -disable-fp-elim | FileCheck -check-prefix=CHECK-FP %s
 
 define void @func() {
 entry:
@@ -8,5 +9,5 @@ entry:
 ; CHECK-NO-FP:     _func:
 ; CHECK-NO-FP:     nop
 
-; CHECK-FP:      _func:
-; CHECK-FP:      nop
+; CHECK-FP:      {{_?}}func:
+; CHECK-FP: nop {{[;#]}} avoids zero-length function