[llvm-dev] Print the Binary Form of an Instruction

Sky Flyer via llvm-dev llvm-dev at lists.llvm.org
Mon Sep 7 04:34:34 PDT 2015


Hello all,
Hello Simon,

Thank you very much for your tutorial "Howto: Implementing LLVM Integrated
Assembler". It was indeed very helpful for me.
I am having a little bit difficulties with the AsmParser which I would like
to postpone for the moment.
I have the LLVM IR for a simple add that I want to see its emitted binary.
Do you think it's possible/doable to give this internal representation to
the CodeEmitter and see the binary representation instead of going through
writing the assembly code, then parsing it, and then run it with the
show-encoding option?
Thanks a lot.

Cheers,
ES


On Mon, Aug 17, 2015 at 1:17 PM, Simon Cook via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> Hi,
>
> If you have an AsmParser implemented, you could put an instruction into
> a file and then run it through llvm-mc with the -show-encoding option.
> For example:
>
>   llvm-mc -triple=foo -show-encoding test.s
>
> Hope this helps.
> Thanks,
> Simon
>
> On 17/08/15 09:33, Sky Flyer via llvm-dev wrote:
> > Hi all,
> >
> > I have defined an instruction in the InstFormat.td and InstrInfo.td
> > files. I also wrote a CodeEmitter class for that, and now I have a .inc
> > file after compilation that seems like it might be correct, BUT, I would
> > like to see what will be generated when the assembly code is converted
> > to the binary machine code!
> > Is there any command in TableGen or a test class to do so?
> >
> > Cheers,
> > ES
> >
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org         http://llvm.cs.uiuc.edu
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150907/a620cf45/attachment.html>


More information about the llvm-dev mailing list