LLVM demo page

I used the LLVM demo page http://llvm.org/demo/ to generate C++ code for generating LLVM IR code. But that page is now disabled. Is there any tool or other site which does what I’m trying to do, that is I give “C/C++ code” as input and I get the “C++ code for generating the equivalent LLVM IR” as output.

Blind Faith <person.of.book@gmail.com> writes:

I used the LLVM demo page http://llvm.org/demo/ to generate C++ code for
generating LLVM IR code. But that page is now disabled. Is there any tool
or other site which does what I'm trying to do, that is I give "C/C++ code"
as input and I get the "C++ code for generating the equivalent LLVM IR" as
output.

You can use clang++ and llc for that:

$ clang++ -c -emit-llvm foo.cpp -o foo.ll
$ llc -march=cpp -o foo.ll.cpp foo.ll

(Note: the CppBackend is not enabled by default when you build with
CMake on Windows.)

Blind Faith <person.of.book@gmail.com> writes:

You can use clang++ and llc for that:

$ clang++ -c -emit-llvm foo.cpp -o foo.ll
$ llc -march=cpp -o foo.ll.cpp foo.ll

(Note: the CppBackend is not enabled by default when you build with
CMake on Windows.)

It says "llc: error: invalid target 'cpp'"

See the note. Please provide information about the LLVM version you are
using and the exact commands you executed for building LLVM and Clang.
The output of `llc --version' will help too.

Just to be curious. Is there any plan to bring the demo page back?

Regards,
chenwj

Blind Faith <person.of.book@gmail.com> writes:

I used the LLVM demo page http://llvm.org/demo/ to generate C++ code for
generating LLVM IR code. But that page is now disabled. Is there any tool
or other site which does what I'm trying to do, that is I give "C/C++ code"
as input and I get the "C++ code for generating the equivalent LLVM IR" as
output.

You can use clang++ and llc for that:

$ clang++ -c -emit-llvm foo.cpp -o foo.ll
$ llc -march=cpp -o foo.ll.cpp foo.ll

(Note: the CppBackend is not enabled by default when you build with
CMake on Windows.)

Just to be curious. Is there any plan to bring the demo page back?

Not in the near future. It has serious security concerns.

-Tanya

Will this one help?
http://ellcc.org/demo/index.cgi

Cheers,
Nico

Nice! But I think you should talk to Tanya *privately* about the security
issue to see what you can do. :slight_smile:

Regards,
chenwj