I am still having some trouble finding my way in the C++ files. Could you give me a clearer direction? Filip On 13 Sep 2010, at 18:39, Charles Davis wrote:> On 9/13/10 10:32 AM, F van der Meeren wrote: >> Hello, >> >> I am trying to emit C code from the module I just created. And this from LLVM-C. >> If someone could give me a pointer on how to do this in llvm (with C++) I might be able to figure it out how to do it in LLVM-C or write my own LLVM-C wrapper for it. > Easy. LLVM has a backend for this. Just make like you're emitting code > as usual, except, when you tell LLVM which backend to use, you tell it > to use the "C Backend". > > Chip
On Sep 13, 2010, at 10:40 AM, F van der Meeren wrote:> I am still having some trouble finding my way in the C++ files. > Could you give me a clearer direction?If you have llvm IR then you can use 'llc' to generate c code. Try $ llc <input_llvm_ir> -march=c -o /tmp/output.c This C backend is implemented in llvm/lib/Target/CBackend - Devang
thanks Mvg, Filip van der Meeren filip at code2develop.com http://sourceforge.net/projects/xlinterpreter *** Send from my IPhone *** On 13-sep.-2010, at 20:02, Devang Patel <dpatel at apple.com> wrote:> > On Sep 13, 2010, at 10:40 AM, F van der Meeren wrote: > >> I am still having some trouble finding my way in the C++ files. >> Could you give me a clearer direction? > > If you have llvm IR then you can use 'llc' to generate c code. Try > $ llc <input_llvm_ir> -march=c -o /tmp/output.c > > This C backend is implemented in llvm/lib/Target/CBackend > > - > Devang >
Is it possible that you can only reach the C Target through the TargetRegistry iterator ? Is there an "easier" way to obtain one? Filip On 13 Sep 2010, at 20:02, Devang Patel wrote:> > On Sep 13, 2010, at 10:40 AM, F van der Meeren wrote: > >> I am still having some trouble finding my way in the C++ files. >> Could you give me a clearer direction? > > If you have llvm IR then you can use 'llc' to generate c code. Try > $ llc <input_llvm_ir> -march=c -o /tmp/output.c > > This C backend is implemented in llvm/lib/Target/CBackend > > - > Devang >