[llvm-commits] [llvm] r46449 - /llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp

Bill Wendling isanbard at gmail.com
Mon Jan 28 01:15:04 PST 2008


Author: void
Date: Mon Jan 28 03:15:03 2008
New Revision: 46449

URL: http://llvm.org/viewvc/llvm-project?rev=46449&view=rev
Log:
If the function has no machine instructions, then emit a "nop" so that
the function label isn't associated with something it shouldn't be.

Modified:
    llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp

Modified: llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp?rev=46449&r1=46448&r2=46449&view=diff

==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp Mon Jan 28 03:15:03 2008
@@ -233,6 +233,16 @@
   // Emit pre-function debug information.
   DW.BeginFunction(&MF);
 
+  if (Subtarget->isTargetDarwin()) {
+    // If the function is empty, then we need to emit *something*. Otherwise,
+    // the function's label might be associated with something that it wasn't
+    // meant to be associated with. We emit a noop in this situation.
+    MachineFunction::iterator I = MF.begin();
+
+    if (++I == MF.end() && MF.front().empty())
+      O << "\tnop\n";
+  }
+
   // Print out code for the function.
   for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
        I != E; ++I) {





More information about the llvm-commits mailing list