[cfe-dev] LLVM IR Question

David Chisnall theraven at sucs.org
Fri Jun 11 11:18:11 PDT 2010


To add to what Chris said:

LLVM IR now supports arbitrary metadata, so it is possible for you to modify Clang's CodeGen library to annotate particular bits of LLVM IR with information from the AST that isn't part of the debug info, if you want to.  

In some cases, this information might be useful for other IR consumers.  For example, we annotate GNU runtime ObjC message sends with various things that are used for optimisations later (e.g. whether it's a class message, the assumed class of the receiver).  There are no general hooks for inserting this information, so you'll have to use a patched version of the codegen lib, or alternatively work directly with either the AST or IR.

David

On 11 Jun 2010, at 18:18, Kyle Girard wrote:

> I've just stumbled upon clang and have been reading the documentation
> and such and I have a couple of questions that I'm hoping someone can
> answer and save me some time.  
> 
> I am playing around with converting C/C++ files into a format that is
> very similar to the LLVM IR output however I still need some information
> that I believe is only found in the AST.  Can clang give me the ability
> to iterate through the LLVM IR statements and still reference original
> source lines in the AST?  
> 
> If that is possible how exactly do I access this information?  I've
> looked at the clang-interpreter example and it would be similar to what
> I thought of doing just the my interpreter would output my type of file.
> 
> Do I have to create my own CodeGenAction or something else?  I've only
> just started to look at the code.
> 
> Thanks,
> 
> Kyle
> 
> 
> 
> 
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev


-- Sent from my PDP-11





More information about the cfe-dev mailing list