[llvm-commits] [PATCH] Refactor llvm-mc to improve -disassemble

Evan Cheng evan.cheng at apple.com
Thu Apr 12 22:33:34 PDT 2012


Benjamin and Owen, can you guys review the patch?

Thanks,

Evan

On Apr 4, 2012, at 11:38 AM, Richard Barton <richard.barton at arm.com> wrote:

> Hello Reviewers
> 
> The attached patch is a refactoring of llvm-mc.
> 
> The initial motivation was to allow --show-inst and --show-encoding to work for
> -disassemble in the same way as for -assemble. The solution was to use an
> MCAsmStreamer to produce the output for -disassemble, rather than use the
> InstPrinter directly. 
> 
> As part of this change I have moved all the duplicated creation of MC Objects
> into the main function.
> 
> There was one problem with this refactoring. -assemble setup the InstPrinter so
> that the assembly syntax variant was altered by the command line argument
> --output-asm-syntax. -disassemble ignored this argument altogether and always
> used MCAsmInfo::getAssemblerDialect to set this. 
> 
> I propose that -disassemble change to use the command line option like the
> -assemble. This causes one X86 disassembly test to fail as it relied on the old
> behaviour. The second patch changes the test to specify the correct assembly
> syntax in the new way. 
> 
> The alternative would be to switch the default assembly syntax behaviour based
> on whether disassemble or assemble is chosen. I don't think this is very nice,
> but I'm happy to change the patch if people want.
> 
> I have split the patch down:
> 
> Patch 01: Refactoring - move all the MC Object creation into main
> Patch 02: Test Change to make X86 disassemble test pass
> Patch 03: Have -disassemble use an AsmStreamer instead of an InstPrinter
> 
> Please review.
> 
> Regards,
> 
> Richard Barton
> <01_llvm_mc_refactor.patch>
> <02_llvm_mc_test_change.patch>
> <03_llvm_mc_show_inst_encoding.patch>
> <llvm_mc_all.patch>
> _______________________________________________
> 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