On Wed, 2020-04-29 at 17:54 -0500, Segher Boessenkool wrote:
> On Wed, Apr 29, 2020 at 08:56:11AM -0600, Jeff Law wrote:
> > On Tue, 2020-04-28 at 20:03 -0500, Segher Boessenkool wrote:
> > > What are the actual rules? Where is this documented?
> > >
> > > Of course it is highly desirable to have CONST around such constant
> > > addresses, but when is it *required*? And what *is* a constant address
> > > (in this context)?
> > I don't know if it's documented, but it's been expected practice for
> > decades.
> >
> > It includes symbolic constants, and the results of simple arithmetic on
> > symbolic
> > constants. It (to the best of my knowledge) does not include logical
> > operations
> > on symbolic constants.
>
> So should it be done for anything that is "i" as constraint? Or only
> for constant addresses? In what sense constant, anyway?
Only symbolic constants. ie, things involving SYMBOL_REF or LABEL_REF which are
constant when the program is run, but the exact value isn't known at compile
time. Simple CONST_INT, CONST_DOUBLE and the like do not need the CONST
wrapping.
Jeff