[cfe-dev] Clang as back-end

Douglas Gregor dgregor at apple.com
Thu Oct 15 10:09:09 PDT 2009


On Oct 15, 2009, at 9:58 AM, Juan Carlos Martinez Santos wrote:
> I am interesting in doing dynamic information flow tracking - DIFT.  
> In the process, I need to add a new attribute for each variable used  
> in the program, and also I need to modify the way how the variables  
> are aggregate (on BBS | heap | stack of an x86 architecture). My  
> concern is if Clang could be the tool that I need.


> From the "get started" guide, I see that (1) clang is the front-end.  
> (2) LLVM is used to optimize the IR, but I didn't see what is the  
> back-end. Is clang also the back-end? or this option is open?

Clang is the front end. It has a "CodeGen" module that lowers to the  
LLVM optimizer and back-end. Clang's abstract syntax trees should be  
generic enough that one could generate IR for a different back-end,  
but to my knowledge nobody has tried that.


> BTW. Where I can more details about "addspace" instruction. I found  
> some piece of information in several documents (LLVM and Clang) but  
> I didn't see any document or section that talk about it. And the  
> last question: is "addrspace" instruction just for global variables?


It's not an instruction, but a qualifier that specifies which address  
space something resides in. It can be applied to globals and the types  
referenced by pointers. The intent is to model the named address  
spaces of the C Embedded TR (http://www.open-std.org/jtc1/sc22/WG14/www/docs/n1169.pdf 
); the specific syntax we've chosen is shown here:

	http://clang.llvm.org/docs/LanguageExtensions.html#x86-specific

	- Doug



More information about the cfe-dev mailing list