On Jan 26, 2008, at 12:21 AM, Chris Lattner wrote: > > 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() > Good point!
>> >> + 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. > I initially had that, but I thought that it would be better to do things though the "print machine instruction" function just so I got the syntax correct. But nop is probably safe to emit like that. > Also, I think this is required on x86 and arm as well, as they have > the same problem with -fomit-frame-pointer. > There's a nop for X86, but I don't see one for ARM in the .td file. > Thanks for working on this! > No problem. :-) -bw _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits