[llvm-dev] Parsing llvm IR

John Criswell via llvm-dev llvm-dev at lists.llvm.org
Mon Jun 27 07:54:37 PDT 2016


On 6/27/16 6:00 AM, Abhishek Kumar via llvm-dev wrote:
> 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?

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 (https://llvm.org/docs, 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

>
> Thanks
> Abhishek Kumar
>
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


-- 
John Criswell
Assistant Professor
Department of Computer Science, University of Rochester
http://www.cs.rochester.edu/u/criswell

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160627/0667f861/attachment.html>


More information about the llvm-dev mailing list