How do I dump numerical representation of textual LLVM IR?

For my input file I think that llvm-as is encoding an instruction incorrectly.Is there any way to dump the numerical representation of input textual LLVM IR on terminal?
“-f” option to llvm-as did not help.

Perhaps you can run llvm-mc on the instruction in question and provide it the --show-encoding option.

Or conversely, you can specify the encoding you desire and run llvm-mc with --disassemble on it.


llvm-mc will help me for target specific things.
My question is at IR level and .ll to .bc translation.

To rephrase, how do I verify if llvm-as translates an input LLVM IR correctly to .bc representation?
I’d like to see exact bytes generated by llvm-as.

Oh, I see.

Does llvm-dis correctly reverse what llvm-as did?

Also, does it not help to do something like:
llvm-as -o - -f <IR_file.ll> | xxd

i.e. get the value of each byte in the output file… of course, this assumes you know what you’re looking for in the .bc file (which I don’t).