-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
LLVM Cookbook
By :
In this recipe, you will convert LLVM bitcode back to LLVM IR. Well, this is actually possible using the LLVM disassembler tool called llvm-dis.
To do this, you need the llvm-dis tool installed.
To see how the bitcode file is getting converted to IR, use the test.bc file generated in the recipe Converting IR to LLVM Bitcode. The test.bc file is provided as the input to the llvm-dis tool. Now proceed with the following steps:
$ llvm-dis test.bc –o test.ll
| $ cat test.ll ; ModuleID = 'test.bc' define i32 @mult(i32 %a, i32 %b) #0 { %1 = mul nsw i32 %a, %b ret i32 %1 }
The output test.ll file is the same as the one we created in the recipe Converting IR to LLVM Bitcode.
The llvm-dis command is the LLVM disassembler. It takes an LLVM bitcode file and converts it into LLVM assembly language.
Here, the input file is test.bc, which is transformed to test.ll by llvm-dis.
If the filename is omitted, llvm-dis reads its input from standard input.
Change the font size
Change margin width
Change background colour