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 | 200e90c74bff0b533c87e2d781815fa61af7b4d6 (patch) | |
tree | 595e6b786abc35df37c9994c0e24c05e9a4dc198 | |
parent | 0818ea8317854db0626fc891a9b2c068e2acefa4 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46449 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/ARM/ARMAsmPrinter.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Target/ARM/ARMAsmPrinter.cpp b/lib/Target/ARM/ARMAsmPrinter.cpp index 1203967243..d56f618d1e 100644 --- a/lib/Target/ARM/ARMAsmPrinter.cpp +++ b/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) { |