Executing LLVM bitcode
In this recipe, you will execute the LLVM bitcode that was generated in previous recipes.
Getting ready
To execute the LLVM bitcode, you need the lli
tool.
How to do it...
We saw in the previous recipe how to create a single bitstream file after linking the two .bc
files with one referencing the other to define func
. By invoking the lli
command in the following way, we can execute the output.bc
file generated. It will display the output on the standard output:
| $ lli output.bc number is 10
The output.bc
file is the input to lli
, which will execute the bitcode file and display the output, if any, on the standard output. Here the output is generated as number is 10
, which is a result of the execution of the output.bc
file formed ...
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.