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? I know that this is a broad question and difficult to answer. I'm mostly looking for people's gut reactions to this proposal. My current plan is to "test it out and see if it works," but the testing might not be comprehensive enough to ferret out potential problems. Thanks in advance! -bw
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
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
Hi Chris,> 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.for this I think it has to be static as well as readonly. Ciao, Duncan.