summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2008-04-08 00:37:56 +0000
committerDale Johannesen <dalej@apple.com>2008-04-08 00:37:56 +0000
commitfe767621ca73ab6aeb65e3830b423a7bdadd4ee6 (patch)
treead3cae685646e86497b71cb22fe05929c9bb987c
parent399c0e63af44f69d929b510597d170169c3d9a62 (diff)
downloadbcm5719-llvm-fe767621ca73ab6aeb65e3830b423a7bdadd4ee6.tar.gz
bcm5719-llvm-fe767621ca73ab6aeb65e3830b423a7bdadd4ee6.zip
Handle the situation in 2008-01-25-EmptyFunction.ll
correctly when unwind info is being generated. llvm-svn: 49366
-rw-r--r--llvm/lib/Target/X86/X86ATTAsmPrinter.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/llvm/lib/Target/X86/X86ATTAsmPrinter.cpp b/llvm/lib/Target/X86/X86ATTAsmPrinter.cpp
index 151bf119cab..78240b36333 100644
--- a/llvm/lib/Target/X86/X86ATTAsmPrinter.cpp
+++ b/llvm/lib/Target/X86/X86ATTAsmPrinter.cpp
@@ -156,17 +156,8 @@ bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
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.
+ bool hasAnyRealCode = false;
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
I != E; ++I) {
// Print a label for the basic block.
@@ -177,10 +168,20 @@ bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
for (MachineBasicBlock::const_iterator II = I->begin(), IE = I->end();
II != IE; ++II) {
// Print the assembly for the instruction.
+ if (II->getOpcode() != X86::LABEL)
+ hasAnyRealCode = true;
printMachineInstruction(II);
}
}
+ if (Subtarget->isTargetDarwin() && !hasAnyRealCode) {
+ // 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.
+ // We are assuming inline asms are code.
+ O << "\tnop\n";
+ }
+
if (TAI->hasDotTypeDotSizeDirective())
O << "\t.size\t" << CurrentFnName << ", .-" << CurrentFnName << "\n";
OpenPOWER on IntegriCloud