On Fri, 2005-04-08 at 16:51 -0700, Dale Johannesen wrote: > On Apr 8, 2005, at 4:40 PM, Mark Mitchell wrote: > > > Daniel Berlin wrote: > > > >> Your transform is correct. > >> The FE is not. The variable is not read only. > >> It is write once, then read-only. > > > > Diego, your analysis is exactly correct about what is happenning. > > > > I agree, in principle. The C++ FE should not set TREE_READONLY on > > variables that require dynanmic initialization. Until now, that's not > > been a problem, and it does result in better code. But, it's now > > becoming a problem, and we have others way to get good code coming > > down the pipe. > > > > I do think the C++ FE needs fixing before Diego's change gets merged, > > though. I can make the change, but not instantly. If someone files a > > PR, and assigns to me, I'll get to it at some not-too-distant point. > > It would be good to have a way to mark things as "write once, then > readonly" IMO. > It's very common, and you can do some of the same optimizations on such > things > that you can do on true Readonly objects.
Some of these global properties probably belong in cgraph_var node's instead of shoving them into the tree structure. Especially if they are only going to be checked a few times (I can't imagine an optimization would ask the same variable if it is write-once more than once or twice) >