[llvm-commits] [llvm] r46394 - in /llvm/trunk/lib: Target/PowerPC/PPCAsmPrinter.cpp Transforms/Scalar/SimplifyCFG.cpp

Chris Lattner clattner at apple.com
Sat Jan 26 00:21:12 PST 2008


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




More information about the llvm-commits mailing list