There are number of options actually. The 2 that you'll probably be interested in are -march=c
and -march=cpp
, which are options to llc.
Run:
llc -march=c -o code.c code.ll
This will convert the LLVM bitcode in code.ll
back to C and put it in code.c
.
Also:
llc -march=cpp -o code.cpp code.ll
This is different than the C output engine. It actually will write out C++ code that can be run to reconstruct the IR. I use this personal to embed LLVM IR in a program without having to deal with parsing bitcode files or anything.
-march=cpp
has more options you can see with llc --help
, such as -cppgen=
which controls how much of the IR the output C++ reconstructs.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…