Parsing llvm IR

Hello

I am writing a converter from llvm IR to some other language. I need all the information in the IR and debug meta-data because I need original line numbers and variable names in code. Is there some API sort of thing to access this data without parsing the llvm output?

Thanks

Abhishek Kumar

Yes. LLVM contains libraries for reading LLVM bitcode into memory and examining the results. The easiest method, in my opinion, is to write an LLVM pass to do the conversion. Look at the “How to Write an LLVM Pass” document on the LLVM web page (, I think). You should also read the LLVM Programmer’s Manual and the LLVM Language Reference Manual so that you understand what constructs are in an LLVM Module. Regards, John Criswell