register unions

Barnacle Wes wes at obie.UUCP
Fri Feb 26 16:52:29 AEST 1988


In article <41964 at sun.uucp>, guy at gorodish.Sun.COM (Guy Harris) writes:
> > The official AT&T version of the K&R portable C compiler only
> > supports register allocation of int's.  All other types are
> > silently assigned to core.
> 
> I presume you mean "integral types", not "int"s.  The version of PCC2 that
> comes with S5R3.1 on 3B2s, for instance, quite cheerfully puts "short"s,
> "char"s, and "long"s into registers as well.

A lot of this type of problem is caused by the underlying machine
architecture.  On the M68000, you usually have 5 or 6 address
registers available, so most 68K C compilers let you put pointers in
registers as well as integral types.  The one I use the most (MWC for
Atari ST) does not allow floats of any flavor to be put in registers.

On Intel chips, a pointer in a register isn't really defined; there
are no real general-purpose registers, and there aren't any registers
big enough to hold a full address.  I guess you could probably put an
address is ES:DI or something like that, but I don't know of any
compilers that do.  MicroPort's pcc surely doesn't!

----
	"Segments are for worms!"	-- Landon Dyer

-- 
    /\              -  "Against Stupidity,  -    {backbones}!
   /\/\  .    /\    -  The Gods Themselves  -  utah-cs!utah-gr!
  /    \/ \/\/  \   -   Contend in Vain."   -  uplherc!sp7040!
 / U i n T e c h \  -       Schiller        -     obie!wes



More information about the Comp.lang.c mailing list