public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: gcc-in-cxx update / multi-targeted gcc
@ 2009-04-29 13:22 Joern Rennecke
  2009-04-29 13:29 ` Joseph S. Myers
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Joern Rennecke @ 2009-04-29 13:22 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc

In order to be able to use namespaces in my endeavour to
support gcc with multiple targets, I've first done a merge
from the gcc-in-cxx branch.

For my initial implementation, I choose as configuration
--target=m32r-elf --with-extra-target-list='sh64-elf arc-elf32' .

I've found some issues with gcc-in-cxx both specific to these
targets, and specific to (parts of) compiler passes that are
only compiled for a subset of all tagets, which include one or
more of the above mentioned three.

You can find these in the branch:
svn//gcc.gnu.org/svn/gcc/branches/multi-target-4_4-branch

So far, I have only made gcc-in-cxx related and a few general
checkins there.

I haven't got to the stage where I could link the multi-targetted
gcc together - it's still missing stuff like target option related
variables.

However, I have already noticed that you are pushing the target vector
in a nonsentical direction: you are using target-specific enums, like
enum reg_class .  We can't have the target vector refer to these enums,
since they are different for each target.
Something which I miss in C++ is a way to declare that a function uses
an integral type to pass an enum value (in arguments or return value),
and then at function definition time only check that the integral type
is sufficently large to hold the enum, and then for type checking purposes
treat the parameter / return value as if it had been declared as this enum.
FWIW, the target vector is more an obstruction than a help to make gcc
multi-targeted.  macros that change the way an rtl optimization pass
work just fine - I then end up with different versions of the rtl
optimization pass in different namespaces, which are accessed by pass
lists which are initialized by code living in the same name space.

My plan (I haven't started implementing this yet) for enum machine_mode
is to have each number denote a mode with the same number of bits and
mode class on all configured targets on which they denote a usable mode.
I'm not sure yet if it will be helpful to diable modes not usable on a
target by making them MODE_RANDOM.

What are your thoughts on using gcc extensions for gcc-in-cxx ?
We can work around the enum issues by liberally sprinkling casts all over
the code, but we are really working against the language there.
We could try to implement en extension to describe integral types used
to pass enums, where the enums only need an unqualified name match.

E.g. we could have:
typedef int enum_reg_class __attribute__ ((enum (reg_class));

and have that be compatible with mips::enum reg_class for a
funtion definition in the mips namespace, with spu::enum reg_class
for a function definition in the spu namespace, and with plain
enum reg_class anywhere.

Another enum problem is enum attr_cpu / enum processor_type in the
sh machine description.  We need a variable  (sh_cpu aka sh_cpu_attr)
with this type to be visible inside the attributes generated by genattrtab.
Choices to solve these kind of problems would be:
- introduce another target header which is guaranteed to be included only
   after enum definitions from generator files are in effect.
- allow the gcc extension of statement expressions to be used in
   target descriptions, so that a macro could provide an extern declaration
   of a variable before using its value.

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2009-05-25 16:40 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-29 13:22 gcc-in-cxx update / multi-targeted gcc Joern Rennecke
2009-04-29 13:29 ` Joseph S. Myers
2009-04-29 13:31   ` Joern Rennecke
2009-04-29 13:44     ` Joseph S. Myers
2009-04-29 13:53       ` Richard Earnshaw
2009-04-29 13:56         ` Joseph S. Myers
2009-04-29 20:18           ` Kaveh R. GHAZI
2009-04-29 15:06 ` Ian Lance Taylor
2009-04-29 17:15   ` Joseph S. Myers
2009-04-29 21:57     ` Joern Rennecke
2009-04-29 21:34   ` Joern Rennecke
     [not found]   ` <20090524121328.5bxlsmbf4cgos440-nzlynne@webmail.spamcop.net>
     [not found]     ` <m3tz3anfh8.fsf@google.com>
2009-05-25  7:54       ` extern const (Was: Re: [gcc-in-cxx]: patches from multi-target-4_4-branch) Joern Rennecke
2009-05-25 11:13         ` Ian Lance Taylor
2009-05-25 12:03           ` Joern Rennecke
2009-05-25 12:42             ` Ian Lance Taylor
2009-05-25 19:53           ` Gabriel Dos Reis
2009-05-25 19:05         ` Gabriel Dos Reis
2009-04-29 22:07 ` gcc-in-cxx update / multi-targeted gcc Esben Mose Hansen

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).