[llvm-commits] [llvm] r95637 - /llvm/trunk/lib/MC/MCAsmStreamer.cpp

Daniel Dunbar daniel at zuster.org
Tue Feb 9 08:41:59 PST 2010


Hi Chris,

On Mon, Feb 8, 2010 at 4:54 PM, Chris Lattner <sabre at nondot.org> wrote:
> Author: lattner
> Date: Mon Feb  8 18:54:51 2010
> New Revision: 95637
>
> URL: http://llvm.org/viewvc/llvm-project?rev=95637&view=rev
> Log:
> make -show-inst be formatted a bit nicer.  Before:
>
>        movl    $3735928559, a          ## inst: <MCInst 1273 <MCOperand Reg:0> <MCOperand Imm:1> <MCOperand Reg:0> <MCOperand Expr:(a)> <MCOperand Reg:0> <MCOperand Expr:(3735928559)>>
>
> after:
>
>        movl    $3735928559, a          ## <MCInst #1273
>                                        ##   <MCOperand Reg:0>
>                                        ##   <MCOperand Imm:1>
>                                        ##   <MCOperand Reg:0>
>                                        ##   <MCOperand Expr:(a)>
>                                        ##   <MCOperand Reg:0>
>                                        ##   <MCOperand Expr:(3735928559)>>

Thanks! One comment though:

>
>
>
> Modified:
>    llvm/trunk/lib/MC/MCAsmStreamer.cpp
>
> Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=95637&r1=95636&r2=95637&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original)
> +++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Mon Feb  8 18:54:51 2010
> @@ -532,14 +532,6 @@
>  void MCAsmStreamer::EmitInstruction(const MCInst &Inst) {
>   assert(CurSection && "Cannot emit contents before setting section!");
>
> -  // Show the MCInst if enabled.
> -  if (ShowInst) {
> -    raw_ostream &OS = GetCommentOS();
> -    OS << "inst: ";
> -    Inst.print(OS, &MAI);
> -    OS << "\n";
> -  }
> -
>   // Show the encoding in a comment if we have a code emitter.
>   if (Emitter) {
>     SmallString<256> Code;
> @@ -557,6 +549,18 @@
>     OS << "]\n";
>   }
>
> +  // Show the MCInst if enabled.
> +  if (ShowInst) {
> +    raw_ostream &OS = GetCommentOS();
> +    OS << "<MCInst #" << Inst.getOpcode();
> +
> +    for (unsigned i = 0, e = Inst.getNumOperands(); i != e; ++i) {
> +      OS << "\n  ";
> +      Inst.getOperand(i).print(OS, &MAI);
> +    }
> +    OS << ">\n";
> +  }
> +

This was intentionally before encoding. --show-inst is most likely
only useful when debugging matcher and encoder issues, in which case
its good to have it come first in case something bad happens (encoder
crashes).

 - Daniel

>   // If we have an AsmPrinter, use that to print, otherwise dump the MCInst.
>   if (InstPrinter)
>     InstPrinter->printInst(&Inst);
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>




More information about the llvm-commits mailing list