This is the mail archive of the
mailing list for the GCC project.
Re: GCC and memory segments
-----BEGIN PGP SIGNED MESSAGE-----
On Thu, Sep 25, 2003 at 11:30:41PM -0700, Jim Wilson wrote:
> Bernd Jendrissek wrote:
> >I believe DJ Delorie has done some work on realmode x86 code generation.
> This is off the link I gave. To be a little more precise
Ah - thanks. Lost it out of my lynx_bookmarks - now back.
> >So how do I work with segments?
> I would suggest making Pmode be PSImode. This will let you distinguish
Ironically, about half an hour after my mail, I got to the place where
gccint.info says what to do with Pmode.
> pointers from integers. You can then write PSImode patterns that know
> how to load the upper part of an address into a segment register. This
> effectively makes every pointer a far pointer. After you get this
> working, you can worry about optimizing it to avoid redundant segment
> register loads.
> Or you could make pointers HImode, then every pointer is a near pointer.
And a marvelous day it will be if/when even that works.
> Gcc only supports one size of pointer, so you either have to make all
> pointers near pointers or all pointers far pointers. If you need both,
> you are out of luck.
I figured as much. I ended up doing
#define Pmode (TARGET_FAR_POINTERS ? SImode : HImode)
Hmm, I'll look at SImode vs. PSImode. Is that the whole idea of partial
integer modes - integer-like in most ways, but not actually an integer?
IOW ideal for dealing with these weirdo pointers?
Could I make all pointers SImode/PSImode unconditionally, and then have
GO_IF_LEGITIMATE_ADDRESS accept segment-less addresses depending on
attributes? I'd have to expend some effort to *get* the attributes,
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org
-----END PGP SIGNATURE-----