This is the mail archive of the
mailing list for the GCC project.
Re: Abstracting pointer arithmetic
- To: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- Subject: Re: Abstracting pointer arithmetic
- From: Lars Brinkhoff <lars dot spam at nocrew dot org>
- Date: 29 Jan 2001 13:48:57 +0100
- Cc: gcc at gcc dot gnu dot org
- Organization: nocrew
- References: <10101291228.AA22244@vlsi1.ultra.nyu.edu>
firstname.lastname@example.org (Richard Kenner) writes:
> I *strongly* disagree with this.
Ok. Thanks for pointing out that it was a bad idea.
> Please say *precisely*what problem you are trying to solve first.
> Once we know that, it will be possible to suggest things that will
> work, but it would seem to me that such an abstraction should be at
> the tree level.
I'm writing a back end for a word-adressed machine. For this machine,
pointer arithmetic doesn't quite work like integer arithmetic.
Pointers to sub-word objects have a word address in the low bits, and
a byte selector in the top bits, and are incremented using a special
instruction. Subtracting or comparing these pointers takes several
instructions. Pointers to words are incremented by adding 1*<number
of words>, not 4*<number of words>, but otherwise behave as integers.
Others have pointed to bit-addressed machines, where pointers are
incremented by 8*<number of bytes>.
It seems to be that the back end would have to handle or provide
information about a few pointer operations.