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: Add a shared constant pool


Mark Mitchell <mark@codesourcery.com> writes:
> Richard Sandiford wrote:
>> First of all, some targets really do need per-function pools, so we
>> can't just share constants unconditionally; we need to use some form
>> of target hook instead.  I did wonder about adding a new target hook
>> specifically to control sharing, but I think the question "can I share
>> this constant?"  will usually be equivalent to "can I put this constant
>> into an object block?".  (Note that answering yes to "can I put this
>> constant into an object block?" does not imply that we'll use anchors
>> to access it.  That decision is made by use_anchors_for_symbol_p.
>
> Walk me through the logic here a bit.  For example, on ARM, we use
> per-function constant pools so that we can use PC-relative addressing to
> find constants.  Now, I know that on ARM we don't currently have any of
> the new object block hooks wired up, but, suppose we did.  Then, your
> thinking is that we would define use_blocks_for_constant_p to always
> return false on this target because we really want to put things in
> per-function pools?

Right.

> What about things like:
>
>   static const int i = 3;
>   static const int *ip = &i;
>
> Here, wouldn't we possibly want to put 3 (or, equivalently, "i") into a
> block?  Or, does all this apply only to constants that are not variable
> initializers?

The hook only applies to _rtx_ constant pools, i.e. those forced into
memory by force_const_mem.  It doesn't have any say on what we do
with VAR_DECLs or tree constants.

Richard


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