Memory address lowering and addressing mode selection.
Copyright (C) 2004-2024 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3, or (at your option) any
later version.
GCC is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>.
Utility functions for manipulation with TARGET_MEM_REFs -- tree expressions
that directly map to addressing modes of the target.
FIXME: We compute address costs using RTL.
TODO -- handling of symbols (according to Richard Hendersons
comments, http://gcc.gnu.org/ml/gcc-patches/2005-04/msg00949.html):
There are at least 5 different kinds of symbols that we can run up against:
(1) binds_local_p, small data area.
(2) binds_local_p, eg local statics
(3) !binds_local_p, eg global variables
(4) thread local, local_exec
(5) thread local, !local_exec
Now, (1) won't appear often in an array context, but it certainly can.
All you have to do is set -GN high enough, or explicitly mark any
random object __attribute__((section (".sdata"))).
All of these affect whether or not a symbol is in fact a valid address.
The only one tested here is (3). And that result may very well
be incorrect for (4) or (5).
An incorrect result here does not cause incorrect results out the
back end, because the expander in expr.cc validizes the address. However
it would be nice to improve the handling here in order to produce more
precise results.
A "template" for memory address, used to determine whether the address is
valid for mode.