[llvm-commits] [llvm] r94718 - in /llvm/trunk: lib/CodeGen/AsmPrinter/AsmPrinter.cpp test/CodeGen/X86/2008-01-25-EmptyFunction.ll

Chris Lattner sabre at nondot.org
Wed Jan 27 17:06:32 PST 2010


Author: lattner
Date: Wed Jan 27 19:06:32 2010
New Revision: 94718

URL: http://llvm.org/viewvc/llvm-project?rev=94718&view=rev
Log:
emit a 0 byte instead of a noop if a function is empty on darwin.
"0" is nice and target independent.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
    llvm/trunk/test/CodeGen/X86/2008-01-25-EmptyFunction.ll

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=94718&r1=94717&r2=94718&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Wed Jan 27 19:06:32 2010
@@ -376,10 +376,8 @@
   // If the function is empty and the object file uses .subsections_via_symbols,
   // then we need to emit *some* thing to the function body to prevent the
   // labels from collapsing together.
-  if (MAI->hasSubsectionsViaSymbols() && !HasAnyRealCode) {
-    // FIXME: EmitByte(0).
-    O << "\tnop\n";
-  }
+  if (MAI->hasSubsectionsViaSymbols() && !HasAnyRealCode)
+    OutStreamer.EmitIntValue(0, 1, 0/*addrspace*/);
   
   if (MAI->hasDotTypeDotSizeDirective())
     O << "\t.size\t" << *CurrentFnSym << ", .-" << *CurrentFnSym << '\n';

Modified: llvm/trunk/test/CodeGen/X86/2008-01-25-EmptyFunction.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-01-25-EmptyFunction.ll?rev=94718&r1=94717&r2=94718&view=diff

==============================================================================
--- llvm/trunk/test/CodeGen/X86/2008-01-25-EmptyFunction.ll (original)
+++ llvm/trunk/test/CodeGen/X86/2008-01-25-EmptyFunction.ll Wed Jan 27 19:06:32 2010
@@ -1,4 +1,4 @@
-; RUN: llc < %s -march=x86 | grep nop
+; RUN: llc < %s -march=x86 | grep {.byte	0}
 target triple = "i686-apple-darwin8"
 
 





More information about the llvm-commits mailing list