The llvm-opt binary is provided to enable parsing LLVM bitcode binaries
into pliron's LLVM dialect and to emit LLVM bitcode back from the dialect.
Example usage:
-
Compile fib.c into LLVM-IR:
$clang-22 -c -emit-llvm -o /tmp/fib.bc fib.c -
Convert the LLVM bitcode to LLVM dialect in
plironand back to LLVM bitcode (the binaryllvm-opt, produced in your cargo's target directory must be in$PATH):$llvm-opt -S -i /tmp/fib.bc -o /tmp/fib.opt.ll -
Compile the output fibonacci LLVM-IR into a binary:
$clang-22 -o /tmp/fib /tmp/fib.opt.ll -
Run the fibonacci binary to see the first few fibonacci numbers printed.
$/tmp/fibfib(0): 0 fib(1): 0 fib(2): 1 fib(3): 1 fib(4): 2