This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Abstracting pointer arithmetic


Michael Meissner <meissner@cygnus.com> writes:
> >   The machine description should define insns for pointer arithmetic.
> >   They should be named "addsip3", "subsip3", "subpsi3", "tstp", and
> >   "cmpp", or something like that.
> While this is arguably a step in the right direction, it still
> assumes that there is only size for pointers, and that all pointers
> are the same size and format.  If we really want GCC to deal with
> the difficult machines, such as machines with word pointers, you
> have to allow for different sizes (which means different modes),
> etc.

True.

> Consider a 'typical' word pointer machine.  If the pointer is a
> pointer to an integer aligned type (and aligning all struct/unions
> to meet the requirement that all struct/union pointers have the same
> size/format), you might want Pmode to translate into PSImode, but if
> the pointer is a pointer to a short or byte, it gets translated into
> PDImode.  You really need a macro that takes the pointer tree type
> and gives the appropriate type.

So something like
        #define Pmode_FROM_TYPE(TYPE) ...
should go into the target description?  What if the tree type isn't
avilable any more when GCC wants to call that macro?  For example,
there are a lot of calls to gen_rtx_FOO (Pmode, ...).  Should there be
        #define Pmode_FROM_RTX(X) ...
or
        #define Pmode_FROM_MODE(MODE) ...
too?

Are there any machines with different pointer formats depending on
the contents of the data pointed to?  Like different pointers for
int * and float *?  Or diferent pointer formats for functions and
variables?

-- 
http://lars.nocrew.org/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]