On Jan 25, 2008, at 10:51 PM, Bill Wendling wrote: > Author: void > Date: Sat Jan 26 00:51:24 2008 > New Revision: 46394 > > URL: http://llvm.org/viewvc/llvm-project?rev=46394&view=rev > Log: > If there are no machine instructions emitted for a function, then > insert > a "nop" instruction so that we don't have the function's label > associated > with something that it's not supposed to be associated with.
Thanks Bill, this is looking better. Some thoughts: > + // 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()) { > + MachineBasicBlock &MBB = MF.front(); > + > + if (MBB.begin() == MBB.end()) You can use MBB.empty() > > + BuildMI(MBB, MBB.end(), TM.getInstrInfo()->get(PPC::NOP)); > + } Is there any reason to actually make a machineinstr here? It seems like it would be possible to just emit "nop" to the .s file. The JIT doesn't need this. Also, I think this is required on x86 and arm as well, as they have the same problem with -fomit-frame-pointer. Thanks for working on this! -Chris _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits