diff options
author | Bill Wendling <isanbard@gmail.com> | 2008-01-28 09:15:03 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2008-01-28 09:15:03 +0000 |
commit | 96a1b810ec385a71732872265b814c955546175f (patch) | |
tree | 730008a381ea05dcc4dd9899626affd6622c9b12 /llvm/lib/Target/ARM/ARMAsmPrinter.cpp | |
parent | a8b4a56061f22b0c40fbe9fd08495b156b121e7a (diff) | |
download | bcm5719-llvm-96a1b810ec385a71732872265b814c955546175f.tar.gz bcm5719-llvm-96a1b810ec385a71732872265b814c955546175f.zip |
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.
llvm-svn: 46449
Diffstat (limited to 'llvm/lib/Target/ARM/ARMAsmPrinter.cpp')
-rw-r--r-- | llvm/lib/Target/ARM/ARMAsmPrinter.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Target/ARM/ARMAsmPrinter.cpp b/llvm/lib/Target/ARM/ARMAsmPrinter.cpp index 12039672439..d56f618d1ea 100644 --- a/llvm/lib/Target/ARM/ARMAsmPrinter.cpp +++ b/llvm/lib/Target/ARM/ARMAsmPrinter.cpp @@ -233,6 +233,16 @@ bool ARMAsmPrinter::runOnMachineFunction(MachineFunction &MF) { // 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) { |