public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Steven Bosscher <stevenb.gcc@gmail.com>
To: Joern Rennecke <amylaar@spamcop.net>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: RFA: Fix other/44566
Date: Sat, 26 Jun 2010 13:21:00 -0000	[thread overview]
Message-ID: <AANLkTil04egpfdeo_MmUvZn8DInHs4b-HAq3_wufM-UU@mail.gmail.com> (raw)
In-Reply-To: <20100626061802.45a3nzzz4088o840-nzlynne@webmail.spamcop.net>

On Sat, Jun 26, 2010 at 12:18 PM, Joern Rennecke <amylaar@spamcop.net> wrote:
> I have also confirmed that an i686-pc-linux-gnu X ppc-elf+spu-elf compiler
> can be built using configure options:
>  --target=ppc-elf --with-extra-target-list=spu-elf
> and building the makefile target 'all-gcc', and that the resulting cc1
> can compile a simple function for both architectures:
>
> [amylaar@laria gcc]$ cat foo.c
> int foo ()
> {
>  return 42;
> }
> [amylaar@laria gcc]$ ./cc1 -quiet -O2 foo.c
> [amylaar@laria gcc]$ cat foo.s
>        .file   "foo.c"
>        .section        ".text"
>        .align 2
>        .globl foo
>        .type   foo, @function
> foo:
>        li 3,42
>        blr
>        .size   foo, .-foo
>        .ident  "GCC: (GNU) 4.6.0 20100625 (experimental)"
> [amylaar@laria gcc]$ cat foop.c
> int foo () __attribute__ ((target_arch ("spu-elf")));
>
> int foo ()
> {
>  return 42;
> }
> [amylaar@laria gcc]$ ./cc1 -quiet -O2 foop.c
> [amylaar@laria gcc]$ cat foop.s
>        .file   "foop.c"
>        .arch   "spu-elf"
> .text
>        .align  2
>        .align  3
>        .global foo
>        .type   foo, @function
> foo:
>        il      $3,42
>        bi      $lr
>        .size   foo, .-foo
>        .ident  "GCC: (GNU) 4.6.0 20100625 (experimental)"

Also in a single file? i.e.

int foo_default_arch (void);
int foo_default_arch (void)
{
 return 42;
}

int foo_spu (void) __attribute__ ((target_arch ("spu-elf")));
int foo_spu (void)
{
 return 42;
}


> gcc/gcc:
>        * multi-target.h, README-multi-target, any-lang.c: New files.
>        * addresses.h: Include "multi-target.h" and add START_TARGET_SPECIFIC
>        and END_TARGET_SPECIFC markers.
                              ^ typo

Even though I really like the idea of supporting multi-target, this
approach looks a bit fragile to me. That is in part just a lack of
documentation, but I also think that this design just breaks easily.


Re. documentation: I didn't find any place where it is described what
should be wrapped in START_TARGET_SPECIFIC / END_TARGET_SPECIFIC. This
is important because if people don't know what to mark then new
target-specific things end up not put in the target-specific name
space. It is not obvious to me what is to be marked.

For example:
* why are create_mem_ref, addr_for_mem_ref, and maybe_fold_tmr wrapped
in START/END_TARGET_SPECIFIC in tree-flow.h, but tree_create_mem_ref
and get_address_description not?
* why is the whole df-problems.c file and a few other files target
specific? (Looks to me like these markers should be put fine-grained,
not on whole files)


Re. design breaks easily: There is no obvious way to check that all
functions that should be wrapped, are in fact wrapped. I suppose you
didn't find out what to wrap by trial and error. Do you have some
checking scripts that just list all functions that should be marked?

ISTM  it would be more robust to have a per-function-prototype marker
to signal that a function should be wrapped, and split off those
functions to separate files or a separate section in a file, instead
of wrapping the code in START/END_TARGET_SPECIFIC.

Otherwise, this patch is just waiting to be broken by ye random next
large patch (mem-ref2 merge, say) because nothing will catch missing
START/END_TARGET_SPECIFIC, reviewing is hard (you can't tell in a
patch whether a chunk is inside START/END_TARGET_SPECIFIC), and that's
all assuming people know what should be wrapped in the first place
(documentation).

Ciao!
Steven

  parent reply	other threads:[~2010-06-26 11:06 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-26 12:54 Joern Rennecke
2010-06-26 13:08 ` Joseph S. Myers
2010-06-26 14:56   ` amylaar
2010-06-26 15:51     ` Joseph S. Myers
2010-06-26 13:21 ` Steven Bosscher [this message]
2010-06-26 16:02   ` Joern Rennecke
2010-06-26 19:45 ` Joseph S. Myers
2010-06-26 22:19   ` Joern Rennecke
2010-06-26 22:29     ` Joern Rennecke
2010-06-26 22:37     ` Joseph S. Myers
2010-06-27  0:03       ` Joern Rennecke
2010-06-27  0:09         ` Richard Guenther
2010-06-27  0:23         ` Joseph S. Myers
2010-06-27  7:29           ` Joern Rennecke
2010-06-27 18:18   ` Mark Mitchell
2010-06-27 18:21     ` Steven Bosscher
2010-06-27 19:14       ` Mark Mitchell
2010-06-27 19:37         ` Joern Rennecke
2010-06-27 19:39           ` Steven Bosscher
2010-06-27 19:42           ` Mark Mitchell
2010-06-27 19:51           ` Joseph S. Myers
2010-06-27 20:17             ` Joern Rennecke
2010-06-27 20:41               ` Joseph S. Myers
2010-06-27 21:49                 ` Joern Rennecke
2010-06-27 22:31                   ` Joseph S. Myers
2010-06-28  0:48                     ` Joern Rennecke
2010-06-28  2:29                       ` Mark Mitchell
2010-06-28  3:34                         ` Joern Rennecke
2010-06-28  6:28                           ` Mark Mitchell
2010-06-28  7:06                           ` Jan Hubicka
2010-06-28 11:14                             ` Joseph S. Myers
2010-06-28 11:19                               ` Jan Hubicka
2010-06-28 11:26                                 ` Jan Hubicka
2010-07-01  9:11                             ` Andi Kleen
2010-07-01 10:03                               ` Jan Hubicka
2010-07-01 10:43                                 ` Joern Rennecke

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=AANLkTil04egpfdeo_MmUvZn8DInHs4b-HAq3_wufM-UU@mail.gmail.com \
    --to=stevenb.gcc@gmail.com \
    --cc=amylaar@spamcop.net \
    --cc=gcc-patches@gcc.gnu.org \
    /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).