[PATCH] D32398: Bring back the ability opt out of padding zero-byte functions by not providing a nop instruction.
Daniel Sanders via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 23 07:03:48 PDT 2017
dsanders created this revision.
No test case since I'm not aware of an in-tree target that needs this.
https://reviews.llvm.org/D32398
Files:
lib/CodeGen/AsmPrinter/AsmPrinter.cpp
Index: lib/CodeGen/AsmPrinter/AsmPrinter.cpp
===================================================================
--- lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -1056,8 +1056,13 @@
(TT.isOSWindows() && TT.isOSBinFormatCOFF()))) {
MCInst Noop;
MF->getSubtarget().getInstrInfo()->getNoop(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->AddComment("avoids zero-length function");
+ OutStreamer->EmitInstruction(Noop, getSubtargetInfo());
+ }
}
const Function *F = MF->getFunction();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32398.96306.patch
Type: text/x-patch
Size: 801 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170423/8de932f1/attachment.bin>
More information about the llvm-commits
mailing list