public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Steve Ellcey <sje@cup.hp.com>
To: jason@redhat.com
Cc: gcc@gcc.gnu.org
Subject: Re: g++ pointer tracking question
Date: Wed, 15 May 2002 16:37:00 -0000	[thread overview]
Message-ID: <200205152303.QAA16701@hpsje.cup.hp.com> (raw)

> Passing an offset is right.  REG_POINTER should not be true, but I wouldn't
> expect it to break anything.  The problem is that the C++ frontend uses
> POINTER_TYPE to describe pointer-to-member types; this is conceptually
> wrong, but nobody has gotten around to fixing it yet.
> 
> I think your bug lies elsewhere.

No, I think this is it.  While this works OK in 64 bit mode and may not
cause problems for other platforms, in 32 bit mode (HP-UX IA64) we
really need to know if something is a pointer or not for one of our
(platform specific) optimizations.

Details for the curious:

IA64 extends 32 pointers to 64 bits using an instruction known as
"addp4", which can take two arguments, a 32 bit pointer and an offset
(constant integer or another register), and it gives you a result by
adding the two together and then copying bits 30 and 31 of the pointer
argument to bits 61 and 62.  The bits copied are only from the register
that is supposed to contain a pointer, not the register that contains an
offset.

If you do it in two steps; add the two numbers, then addp4 the result it
doesn't matter which value is an address and which is an offset.  You
just add them together and then do an addp4 with a constant offset of 0.
If you want to combine the two steps into a single instruction it
matters very much that the register you think has a pointer in it really
does.

So my problem is I have two 32 bit numbers, both show up as pointers and
I just happen to luck out and pick the wrong one when I try to use one
as the pointer register in my addp4 instruction.

Maybe I can modify ia64.md to say that the addp4_plus_[12] instructions
that combine an add and an addp4 into one instruction cannot be used if
both arguments show up as pointers.  I don't think I am up to fixing the
C++ front-end.

Steve Ellcey
sje@cup.hp.com

             reply	other threads:[~2002-05-15 23:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-15 16:37 Steve Ellcey [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-05-20 12:58 Steve Ellcey
2002-05-20 13:12 ` Jason Merrill
2002-05-20 11:23 Steve Ellcey
2002-05-16 14:43 Steve Ellcey
2002-05-18  8:38 ` Jason Merrill
2002-05-15 17:05 John David Anglin
2002-05-15 15:19 Steve Ellcey
2002-05-15 16:03 ` Jason Merrill
2002-05-16 13:28 ` law

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200205152303.QAA16701@hpsje.cup.hp.com \
    --to=sje@cup.hp.com \
    --cc=gcc@gcc.gnu.org \
    --cc=jason@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).