This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [lto] PATCH: Add support for referencing types from function bodies


Andrew Pinski wrote:
On Mon, 2006-09-04 at 10:51 -0700, Mark Mitchell wrote:
I think Fortran and Objective-C should change, and that they may need to change in order to work with LTO. I think that, as in C/C++, a VAR_DECL with TREE_READONLY should be used instead, and that CONST_DECLs should never be addressable.

Why? The reason why it was done was to save space and make sure they
are really put in the constant section. I don't see a reason why they
should be using VAR_DECLs.

VAR_DECLs should be used for data objects that potentially take up space in the object file. Whatever you might hope to accomplish with a CONST_DECL can equally well be accomplished with a VAR_DECL with a bit that says it is a constant.


All of the issues you raise point to failures to optimize appropriately, not to something about the choice of representation. In other words, if the optimizers figure out that, given, "const int i = f();" the value of "f" is always "3", then "i" ought to be treated just like a CONST_DECL for 3.

Fundamentally, all a CONST_DECL gives you is a name for a constant. But, there's no advantage to having names when optimizing; you might as well just use the constant. If there's really a need for ADDR_EXPR (CONST_DECL), it would be simpler just to allow ADDR_EXPR (INTEGER_CST).

--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]