public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Martin Koegler <mkoegler@auto.tuwien.ac.at>
To: Paul Schlie <schlie@comcast.net>
Cc: gcc@gcc.gnu.org
Subject: Re: named address spaces (update)
Date: Sun, 10 Jul 2005 14:41:00 -0000	[thread overview]
Message-ID: <20050710144139.GB5569@ahab.auto.tuwien.ac.at> (raw)
In-Reply-To: <BEF352E0.AC1E%schlie@comcast.net>

On Thu, Jul 07, 2005 at 09:45:04PM -0400, Paul Schlie wrote:
> James E Wilson writes:
> >> On Sun, 2005-07-03 at 07:31, Martin Koegler wrote:
> >> * need to rewrite recursivly each element of type (which my contain
> >> structures, unions, ...) if a address space is set
> >>   In http://gcc.gnu.org/ml/gcc/2005-04/msg01438.html, this was rated as
> >> bad idea.
> >
> > It is possible I was wrong.  Conceptually, this doesn't seem much
> > different than existing type qualifiers const/volatile, for which case
> > we must already have a solution.  Maybe similar treatment will work for
> > named address spaces?

Address spaces are similar to the const/volatile type qualifier. Const
and volatile flags are present in each tree expression (not only in the type).
For expressions and decls I store them in a similar way.

Only for types, I do not store the address space of the value, as this is the
more complicated way. For each structure, it must be made sure that, that all elements
are declared in the same address space. Also the propgation of the address space
from structures to their elements (and subelements) must be done in some way.

Implementing a correct propagation (including the correct handling of the variant
handling), will need more time, than I currently have.

> > Otherwise, these answers all seem very reasonable.
> 
> Is there any reasonable solution to the problem which presents itself when
> attempting to pass address space qualified pointers as arguments to, or
> being returned from, a function; as it seems that unless there's a mechanism
> by which "C" can either select overloaded functions as a function of it's
> qualified argument and/or return value types, or automatically generate
> variants of a given function as may be required based upon it's arguments
> memory space designation; it's not clear how named address spaces can be
> truly useful if references to them can't be effectively utilized by
> functions? (but hopefully I'm misunderstanding something)
> 
> For example (for the sake of argument):
> 
> ROM const int = 5;  // which may require a specific load inst to access.
> RAM1 const int = 6; // which may require a different load inst to access.
> RAM2 int;           // which may require yet a different load/store inst.
> 
> RAM2 int* foo(RAM2 int* x, ROM const int* y)
> {
>   *x = *y;   // loads from ROM const int* y.
>    return x;
> }
> 
> RAM2 int* foo(RAM2 int* x, RAM1 const int* y)
> {
>   *x = *y;    // loads from RAM1 cons int* y.
>    return x;
> }
> 
> Which represents only 2 of several possible permutations of
> ROM RAM1 RAM2 address space argument combinations, which seems both
> painful and error prone to have to replicate, and presumes that the
> compiler is capable of resolving their selection at compile time, as
> may be necessary for the correct code generation of unique address
> space argument reference access?

According to my understanding, in C, a parameter can only have one
address space and may not have any overloader variants. So you will 
need different function names to deal with the different address spaces.

In some situations, not all permutations are neccessary, as one address
space may be part of another, in which case it is possible to create the
functions only for the bigger address space.

Overloading (and automatic generation of permutations) will require the
C++ frontend.

mfg Martin Kögler

  reply	other threads:[~2005-07-10 14:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-08  1:55 Paul Schlie
2005-07-10 14:41 ` Martin Koegler [this message]
  -- strict thread matches above, loose matches on Subject: below --
2005-06-29  8:48 Martin Koegler
2005-06-29 12:18 ` DJ Delorie
2005-06-29 15:38   ` E. Weddington
2005-06-29 13:15 ` Daniel Jacobowitz
2005-06-29 15:37 ` E. Weddington
2005-07-02  1:49 ` James E Wilson
2005-07-03 14:31   ` Martin Koegler
2005-07-07  2:59     ` James E Wilson

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=20050710144139.GB5569@ahab.auto.tuwien.ac.at \
    --to=mkoegler@auto.tuwien.ac.at \
    --cc=gcc@gcc.gnu.org \
    --cc=schlie@comcast.net \
    /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).