This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [named-addr-spaces-branch][Patch,committed] Fix C++ bug; Add common pointer target hook
- From: Michael Meissner <meissner at linux dot vnet dot ibm dot com>
- To: Richard Guenther <richard dot guenther at gmail dot com>
- Cc: Michael Meissner <meissner at linux dot vnet dot ibm dot com>, gcc-patches at gcc dot gnu dot org
- Date: Sun, 30 Nov 2008 20:34:56 -0500
- Subject: Re: [named-addr-spaces-branch][Patch,committed] Fix C++ bug; Add common pointer target hook
- References: <20081130215556.GA23521@hungry-tiger.westford.ibm.com> <84fc9c000811301402h367a3447wdcad25c14acd5670@mail.gmail.com>
On Sun, Nov 30, 2008 at 11:02:25PM +0100, Richard Guenther wrote:
> I can see a pattern here. Either this needs a function or, more likely, this
> is broken - why does TYPE_PRECISION not work here?
Yep, I've thought about moving it into a function. The original code spread
over 5 functions is:
if (POINTER_TYPE_P (type)
|| TREE_CODE (type) == OFFSET_TYPE)
prec = POINTER_SIZE;
else
prec = TYPE_PRECISION (type);
Or
if (POINTER_TYPE_P (TREE_TYPE (expr)))
prec = POINTER_SIZE
else
prec = TYPE_PRECISION (TREE_TYPE (expr))
I've just been duplicating the original logic, just adding the test for
named address pointers (and of course modifying it as the code changes).
It does look like precision is correct for pointers (i.e. when -mea64, it is
64 for __ea pointers, and 32 otherwise). Given that all ports seem to use
HImode, SImode, or DImode for pointers, it isn't surprising. After my builds
finish, I'll try using TYPE_PRECISION directly.
--
Michael Meissner, IBM
4 Technology Place Drive, MS 2203A, Westford, MA, 01886, USA
meissner@linux.vnet.ibm.com