mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-07 02:56:52 +00:00
Handle the situation in 2008-01-25-EmptyFunction.ll
correctly when unwind info is being generated. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49366 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a25e5787bc
commit
f2247cfb38
@ -156,17 +156,8 @@ bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
|||||||
DW.BeginFunction(&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.
|
// Print out code for the function.
|
||||||
|
bool hasAnyRealCode = false;
|
||||||
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
|
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
|
||||||
I != E; ++I) {
|
I != E; ++I) {
|
||||||
// Print a label for the basic block.
|
// 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();
|
for (MachineBasicBlock::const_iterator II = I->begin(), IE = I->end();
|
||||||
II != IE; ++II) {
|
II != IE; ++II) {
|
||||||
// Print the assembly for the instruction.
|
// Print the assembly for the instruction.
|
||||||
|
if (II->getOpcode() != X86::LABEL)
|
||||||
|
hasAnyRealCode = true;
|
||||||
printMachineInstruction(II);
|
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())
|
if (TAI->hasDotTypeDotSizeDirective())
|
||||||
O << "\t.size\t" << CurrentFnName << ", .-" << CurrentFnName << "\n";
|
O << "\t.size\t" << CurrentFnName << ", .-" << CurrentFnName << "\n";
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user