Add back a fallback case for targets that do not or cannot implement getNoopForMachoTarget().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217899 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Owen Anderson 2014-09-16 20:28:00 +00:00
parent fdedee296f
commit 374e06bbce

View File

@ -802,7 +802,11 @@ void AsmPrinter::EmitFunctionBody() {
MCInst Noop;
TM.getSubtargetImpl()->getInstrInfo()->getNoopForMachoTarget(Noop);
OutStreamer.AddComment("avoids zero-length function");
OutStreamer.EmitInstruction(Noop, getSubtargetInfo());
// Targets can opt-out of emitting the noop here by leaving the opcode
// unspecified.
if (Noop.getOpcode())
OutStreamer.EmitInstruction(Noop, getSubtargetInfo());
}
const Function *F = MF->getFunction();