Converting LLVM bitcode to target machine assembly
In this recipe, you will learn how to convert the LLVM bitcode file to target specific assembly code.
Getting ready
The LLVM static compiler llc
should be in installed from the LLVM toolchain.
How to do it...
Do the following steps:
- The bitcode file created in the previous recipe,
test.bc,
can be used as input tollc
here. Using the following command, we can convert LLVM bitcode to assembly code:$ llc test.bc –o test.s
- The output is generated in the
test.s
file, which is the assembly code. To have a look at that, use the following command lines:$ cat test.s .text .file "test.bc" .globl mult .align 16, 0x90 .type mult,@function mult: # @mult .cfi_startproc # BB#0: Pushq %rbp .Ltmp0: .cfi_def_cfa_offset ...
Get LLVM Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.