[LLVMdev] RFA: TREE_READONLY in LLVM-GCC

Bill Wendling isanbard at gmail.com
Sun Jan 4 14:44:17 PST 2009


On Jan 4, 2009, at 12:47 PM, Chris Lattner wrote:

> 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.

I think Fariborz is resistant to this idea, but I can run it past him  
again.

> 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.
>
Okay. I'll make the patch. Thanks!

-bw




More information about the llvm-dev mailing list