public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Martin Koegler <mkoegler@auto.tuwien.ac.at>
To: James E Wilson <wilson@specifixinc.com>
Cc: gcc@gcc.gnu.org
Subject: Re: named address spaces (update)
Date: Sun, 03 Jul 2005 14:31:00 -0000	[thread overview]
Message-ID: <20050703143104.GA18820@ahab.auto.tuwien.ac.at> (raw)
In-Reply-To: <42C5F29E.6000004@specifixinc.com>

On Fri, Jul 01, 2005 at 06:49:18PM -0700, James E Wilson wrote:
> Martin Koegler wrote:
> >I continued to work on the support for named address spaces in GCC.
> 
> An possible issue is the effect on gcc memory usage and compile time.  I 
> see you increased the size of MEM rtl which will increase memory usage. 
>  Also, there seem to be a lot of hooks in commonly called functions 
> which may slow down gcc.  Most users won't be happy if gcc gets slower 
> in order to implement an obscure feature that most don't need.  It would 
> be useful to measure the effect on compile time performance, and try to 
> reduce it if it is too much.

Named address spaces will need some bits to store information about them
in the RTL as well as in the tree nodes. I could change the patch, that
it only creates code on target, which support it. But I do not like this
idea, because future enhancements (like support for different sized pointers)
will probably require bigger changes in the core, which will get more difficult,
if only some architectures use it.

If have not done any benchmarks yet, as I am working on improving my m68hc05 GCC
port. I ran the GCC testsuite (only for the C frontend) with my patches on the
i386 frontend and it took about 45 minutes complete on a modern P4 system (I have 
not collected more information, so it says nothing).

> It would be helpful if you used -p when running diff.  That includes 
> function names in the output, which makes the patch easier to read. 
> Also, a ChangeLog entry would help.

The next time, I send an update, I will try to produced a better readable patch.

> I see lots of places where you haven't followed the GNU coding
> conventions.  This will matter if you are serious about getting this
> patch into the FSF tree.  Comments need to start with a capital letter
> and end with a period.  Functions must have a comment before them that
> explains what they do, and what their arguments are.  Spaces before open
> parentheses.  Spaces before and after operators like = and !=.

I have not cared about any formating conventions yet, as it is a preview
patch (and the mentioned errors are no technical problem).

Merging this patch will need a backend, which supports it. I do not intend to
try to include my m68hc05 port in the GCC mainline, as I know no (potential) user 
base for this port (except my BCU SDK).

So this patch will need an other backend, problably avr, over which it will 
find its way in the GCC CVS.

> namespace means something different in C++.  I don't think it is wise to
> reuse it here.  addressspace or addrspace makes more sense.

In my working tree, I switch to addrspace:
ADDRSPACE (EEPROM, HI);

I also added an information about the minimum pointer size to 
start to work on non Pmode pointer.

> In previous threads, Joseph Myers pointed you at a formal proposal to 
> extend the ISO C language with a similar feature.  Have you looked at 
> this?  If we are adding this feature, it would be best if we followed 
> the standard, instead of inventing our own incompatible extensions.

Yes, I took it as base for the semantics (e.g. showed the need for the addrspace
merge functions).

I have not changed the C frontend to support address space attributes, so the specified
syntax is not implemented. Instead I currently use GCC attributes. The attribute handlers 
in my backend only set the address space, without allocation variables into a specific section
or detecting errors (eg. parameters with EERPOM attribute).

> It isn't clear why you want both decl and type attributes.  If we are 
> doing this right, it seems that it should just be a type attribute (type 
> qualifier?), and then for decls you can get the info from their type.

My first implementation used a GCC type attribute to store the address space
of the current value. I had serveral problems:
* DWARF2 errors on arrays (#21106)
* 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.

  If the address space is set, it would be possible, that only the the address space
  is only stored in the top level node and every code, which access a part of the type,
  would duplicate the subtree and store the correct address space in the new top. This would
  require bigger changes, than the current solution.
 
Now, I do not store the address space of variables in the type to
avoid all propagation problems, I had in former implementations.
Only for pointers, I store the address space, the pointer points to, in the type.
I do the propagation while creating the different tree expression now (by storing the
address space of the result in the expression).

Using this approach, it is not possible to create something like typedef int eint __attribute__ (eeprom);,
where eint x; will allocate x in the eeprom. On the other hand, situations, where eint is used in
a structure (in the normal address space), can not happen. The ISO document does not explicitly
state, if such constructs are allowed or not, so I can't say, if the ISO C extension support this.

As I store the address space in the DECL, this can be best changed by a DECL attribute.
For pointer (and references), I need a way to specifiy the address space of the target.
Here a type attribute is the only solution, as they may be used in a structure.

mfg Martin Kögler

  reply	other threads:[~2005-07-03 14:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2005-07-07  2:59     ` James E Wilson
2005-07-08  1:55 Paul Schlie
2005-07-10 14:41 ` Martin Koegler

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=20050703143104.GA18820@ahab.auto.tuwien.ac.at \
    --to=mkoegler@auto.tuwien.ac.at \
    --cc=gcc@gcc.gnu.org \
    --cc=wilson@specifixinc.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).