[llvm-commits] [llvm] r114679 - in /llvm/trunk/lib/Target/ARM: ARMAsmPrinter.cpp ARMInstrInfo.td ARMInstrThumb.td

Chris Lattner clattner at apple.com
Thu Sep 23 11:25:37 PDT 2010


On Sep 23, 2010, at 11:05 AM, Jim Grosbach wrote:
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=114679&view=rev
> Log:
> Clean up the 'trap' instruction printing a bit. Non-Darwin assemblers don't
> (yet) recognize the 'trap' mnemonic, so we use .short/.long to emit the
> opcode directly. On Darwin, however, we do want the mnemonic for more
> readable assembly code and better disassembly.

Nice!

> +++ llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp Thu Sep 23 13:05:37 2010
> @@ -1210,6 +1210,16 @@
>     OS << '\t';
>     printRegisterList(MI, 5, OS);
>   } else
> +  // TRAP and tTRAP need special handling for non-Darwin. The GNU binutils
> +  // don't (yet) support the 'trap' mnemonic. (Use decimal, not hex, to
> +  // be consistent with the MC instruction printer.)
> +  // FIXME: This really should be in AsmPrinter/ARMInstPrinter.cpp, not here.
> +  //        Need a way to ask "isTargetDarwin()" there, first, though.
> +  if (MI->getOpcode() == ARM::TRAP && !Subtarget->isTargetDarwin()) {
> +    OS << "\t.long\t2147348462\t\t" << MAI->getCommentString() << "trap";
> +  } else if (MI->getOpcode() == ARM::tTRAP && !Subtarget->isTargetDarwin()) {
> +    OS << "\t.short\t57086\t\t\t" << MAI->getCommentString() << " trap";

I'm fine with this staying in ARMAsmPrinter.cpp (in mcinst lowering), it's the right place to go.  This specific hunk will disappear when the old instprinter gets vaporized.

-Chris






More information about the llvm-commits mailing list