[LLVMdev] convert c++ to c: using FAQ

Benjamin Kramer benny.kra at googlemail.com
Fri Dec 2 07:51:29 PST 2011

On 01.12.2011, at 20:14, Waqar Malik wrote:

> Howdy all:
> I'm on OS-X snow leopard, and am using XCode 4.2
> I'm following the FAQ to try converting c++ to c
> llvm-g++ -emit-llvm -c temp.cpp -o temp.bc
> llc -march=c temp.bc -o temp.c
> I'm getting the following error:
> llc: temp.bc: Invalid ALLOCA record
> Anyone knows what I should do to correct it ?

Your llvm-gcc is based on an ancient version of LLVM that's incompatible with LLVM 3.0.
You can use clang instead. Also note that the C backend is probably not what you want, as
it doesn't support enough of LLVM IR to compile a non-trivial C++ program to C.

- Ben

More information about the llvm-dev mailing list