> If we want to give frontends a way to pass information that address of a > given global object is not taken (apparently useful for Ada and its alias > attribute), then I do not think we are looking for middle-end only > solution.
I don't feel very confortable with doing that in Ada, since everybody seems to be thinking that TRE_PUBLIC/DECL_EXTERNAL objects are implicitly addressable (see for example Steven's reasoning in an earlier message). > If we really do not want to revisit TREE_ADDRESSABLE in frontends, we can do > the following: > 1) change semantics of addressable flag on global variables in a way > Richard did, document it is initialized only after symbol table is built 2) > add code to cgraph construction to set TREE_ADDRESSABLE on every global > variable it sees. > IPA visibility is run before early optimizations. I suppose we can set > it there. I.e. in function_and_variable_visibility whenever we set > externally_visible and we have !in_lto_p > It is bit of hack. > 3) perhaps add some way to avoid 2) on objects we want - apparenlty we now > have DECL_NONALIASED that may be useful for this. Then how about using DECL_NONALIASED instead of TREE_ADDRESSABLE to achieve the initial goal here? That is to say, may_be_aliased tests DECL_NONALIASED for TREE_PUBLIC/DECL_EXTERNAL DECLs and the LTO front-end sets it properly. -- Eric Botcazou