// be associated with. We emit a noop in this situation.
MachineFunction::iterator I = MF.begin();
- if (++I == MF.end()) {
- MachineBasicBlock &MBB = MF.front();
-
- if (MBB.begin() == MBB.end())
- BuildMI(MBB, MBB.end(), TM.getInstrInfo()->get(PPC::NOP));
- }
+ 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();
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) {
printBasicBlockLabel(I, true);
O << '\n';
}
- for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
- II != E; ++II) {
+ for (MachineBasicBlock::const_iterator II = I->begin(), IE = I->end();
+ II != IE; ++II) {
// Print the assembly for the instruction.
O << "\t";
printMachineInstruction(II);