<div><font color="#222222" face="arial, sans-serif"><span style="white-space:nowrap">The Online LLVM demo page had an option to generate LLVM C++ API code as backend from a source code. However, that demo page is now disabled. I was wondering how we can do it ourselves using the available LLVM tools.</span></font></div>
<div><font color="#222222" face="arial, sans-serif"><span style="white-space:nowrap"><br></span></font></div><div><font color="#222222" face="arial, sans-serif"><span style="white-space:nowrap">I tried the following</span></font></div>
<div><font color="#222222" face="arial, sans-serif"><span style="white-space:nowrap"><br></span></font></div><div><font color="#222222" face="arial, sans-serif"><span style="white-space:nowrap">clang++ -c -emit-llvm input.cpp -o input.ll</span></font></div>
<div><font color="#222222" face="arial, sans-serif"><span style="white-space:nowrap">llc -march=cpp -o input.ll.cpp input.ll</span></font></div><div><font color="#222222" face="arial, sans-serif"><span style="white-space:nowrap"><br>
</span></font></div><div><font color="#222222" face="arial, sans-serif"><span style="white-space:nowrap">which gives the following error</span></font></div><div><font color="#222222" face="arial, sans-serif"><span style="white-space:nowrap"><br>
</span></font></div><div><font color="#222222" face="arial, sans-serif"><span style="white-space:nowrap">llc: error: invalid target 'cpp'.</span></font></div>