But we want to get a C source from a D source. It is unpossible now to build a current LDC using LLVM 3.0? Anyway, there is some attemps to ressurect this backend http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-April/071968.html http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-April/071928.html
2014-09-14 3:29 GMT+04:00, Dan Olson via Digitalmars-d <[email protected]>: > "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 >
