[LLVMdev] RFA: TREE_READONLY in LLVM-GCC

Chris Lattner clattner at apple.com
Sun Jan 4 12:47:02 PST 2009


On Jan 4, 2009, at 3:44 AM, Bill Wendling wrote:

> Hi LLVM-GCC hackers!
>
> I have a global variable that I want to mark as "TREE_READONLY" so
> that it will become a "constant" in LLVM IR. This is for the new
> blocks-related stuff, but that's not necessarily important for this
> question. In particular, I want to mark the "block_holder" created in
> "build_block_literal_tmp()" as read-only.
>
> My question to you is: Considering that LLVM-GCC uses only a small
> part of the GCC source base, what affect will marking the
> "block_holder" variable as TREE_READONLY have? Does LLVM-GCC run
> through code that looks at this flag and act differently before it
> generates the LLVM IR?

Hi Bill,

I think this change is fine and should go into the normal apple GCC as  
well.  Setting TREE_READONLY means that it can go into the "constant"  
section of the executable, go in ROM, etc.  This is the same as the  
llvm constant bit on globals.

-Chris



More information about the llvm-dev mailing list