public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: BITS_PER_UNIT larger than 8 -- word addressing
@ 2007-12-05 20:08 Boris Boesler
  2007-12-05 21:32 ` Ian Lance Taylor
  0 siblings, 1 reply; 4+ messages in thread
From: Boris Boesler @ 2007-12-05 20:08 UTC (permalink / raw)
  To: GCC

On 2007-11-27 18:29, Michael Eager wrote:
 > Joseph S. Myers wrote:
 > > On Tue, 27 Nov 2007, Michael Eager wrote:
 > >
 > >> I think that there is a pervasive understanding that SImode is
 > >> single precision integer, 32-bits long.
 > >
 > > Only among contributors not considering non-8-bit bytes.  SImode  
is 4
 > > times QImode, 4*BITS_PER_UNIT bits, and may not exist (or at  
least not be
 > > particularly usable, much like the limitations on TImode on 32-bit
 > > targets) with large BITS_PER_UNIT.
 >
 > I think you just described the majority of contributors.  :-)
 >
 > It's human nature not to recognize one's tacit assumptions or their
 > consequences.

  I assume that GCC internals assume that memory can be byte (8 bits)  
addressed - for historical reasons. Therefore, the sizes of all types  
are multiples of a byte. The same is true for addressing values in  
memory. (Sizes of types and their addresses must be separated more  
precisely. A 32 bit value could be on a 4 bit boundary!) But this is  
changing. Addressable units are on 32 bit boundaries or even on 4 bit  
boundaries today. Well, this is the problem I'm running in right now.

Boris

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

* Re: BITS_PER_UNIT larger than 8 -- word addressing
  2007-12-05 20:08 BITS_PER_UNIT larger than 8 -- word addressing Boris Boesler
@ 2007-12-05 21:32 ` Ian Lance Taylor
  2007-12-07 19:04   ` BITS_PER_UNIT less than 8 (was: Re: BITS_PER_UNIT larger than 8 -- word addressing) Boris Boesler
  0 siblings, 1 reply; 4+ messages in thread
From: Ian Lance Taylor @ 2007-12-05 21:32 UTC (permalink / raw)
  To: Boris Boesler; +Cc: GCC

Boris Boesler <baembel@gmx.de> writes:

>   I assume that GCC internals assume that memory can be byte (8 bits)
> addressed - for historical reasons. 

No.  gcc internals assume that memory can be addressed in units of
size BITS_PER_UNIT.  The default for BITS_PER_UNIT is 8.  I have
written backends for machines for which that is not true.

It is unusual, and there is only one official target with
BITS_PER_UNIT != 8 (c4x), so there is often some minor breakage.

Ian

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

* BITS_PER_UNIT less than 8 (was: Re: BITS_PER_UNIT larger than 8 -- word addressing)
  2007-12-05 21:32 ` Ian Lance Taylor
@ 2007-12-07 19:04   ` Boris Boesler
  2007-12-07 22:53     ` Ian Lance Taylor
  0 siblings, 1 reply; 4+ messages in thread
From: Boris Boesler @ 2007-12-07 19:04 UTC (permalink / raw)
  To: GCC


Am 05.12.2007 um 22:32 schrieb Ian Lance Taylor:

> Boris Boesler <baembel@gmx.de> writes:
>
>>   I assume that GCC internals assume that memory can be byte (8 bits)
>> addressed - for historical reasons.
>
> No.  gcc internals assume that memory can be addressed in units of
> size BITS_PER_UNIT.  The default for BITS_PER_UNIT is 8.  I have
> written backends for machines for which that is not true.
>
> It is unusual, and there is only one official target with
> BITS_PER_UNIT != 8 (c4x), so there is often some minor breakage.

  Ok, so what have I to do to write a back-end where all addresses  
are given in bits? Memory is addressed in bits, not bytes. So I set:

#define BITS_PER_UNIT 1
#define UNITS_PER_WORD 32

(As far as I can see, offsets are divided by BITS_PER_UNIT, so this  
seems to be a precondition for bit addressing.)

  All sizes and and boundary are set to 32. SImode is only four bits  
wide, so I added the integer modes OI and XI:
INT_MODE(OI, 32)
INT_MODE(XI, 64)

  In builtin_define_type_max I added the case "1", which will return  
without doing anything.

  Without these changes the compiler stops with internal error  
mesages. With these changes gcc/cc1 generates a bus error.

So, what can I do to get this running for my architecture?

Thanks in advance,
Boris

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

* Re: BITS_PER_UNIT less than 8 (was: Re: BITS_PER_UNIT larger than 8 -- word addressing)
  2007-12-07 19:04   ` BITS_PER_UNIT less than 8 (was: Re: BITS_PER_UNIT larger than 8 -- word addressing) Boris Boesler
@ 2007-12-07 22:53     ` Ian Lance Taylor
  0 siblings, 0 replies; 4+ messages in thread
From: Ian Lance Taylor @ 2007-12-07 22:53 UTC (permalink / raw)
  To: Boris Boesler; +Cc: GCC

Boris Boesler <baembel@gmx.de> writes:

>   Ok, so what have I to do to write a back-end where all addresses
> are given in bits?

That's kind of an extreme case.  But it sounds like you are following
the right approach.

>   Without these changes the compiler stops with internal error
> mesages. With these changes gcc/cc1 generates a bus error.
> 
> So, what can I do to get this running for my architecture?

Well, you have to look at the generated code, find out where it is
wrong, and fix it.  There is no royal road to success.  It's always
hard to write a new gcc backend.  And since your backend is so
unusual, it's likely to be unusually hard.

Ian

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

end of thread, other threads:[~2007-12-07 22:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-05 20:08 BITS_PER_UNIT larger than 8 -- word addressing Boris Boesler
2007-12-05 21:32 ` Ian Lance Taylor
2007-12-07 19:04   ` BITS_PER_UNIT less than 8 (was: Re: BITS_PER_UNIT larger than 8 -- word addressing) Boris Boesler
2007-12-07 22:53     ` Ian Lance Taylor

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