"Kai Nacke" <[email protected]> writes: > On Friday, 12 September 2014 at 10:06:10 UTC, Sergey Korshunoff via > Digitalmars-d wrote: >> >> LDC and LLVM allow to comvert a D source code to C source (and may >> be >> to C++). What wrong with this solution? > > There's nothing wrong with this solution. I think about this as a way > to bootstrap LDC without requiring another D compiler. > > Regards, > Kai
This seemed like a fun solution but I found out the LLVM C backend was removed with LLVM 3.1. There is also a cpp backend, but is different. Cpp target generates C++ code using LLVM API that will rebuild LLVM IR. I tried it on a simple D program to be sure and result is just IR. $ ldc2 -output-ll hello.d $ llc -march=cpp hello.ll -o output.cpp and output.cpp has to be linked with some llvm libraries. Also, output.cpp needed some hand edits to get it to work despite the "// Generated by llvm2cpp - DO NOT MODIFY!" warning at the top. when run output.cpp just prints IR (essentially same as hello.ll). http://stackoverflow.com/questions/11597664/llvm-cpp-backend-does-it-replace-c-backend
