This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GCC and memory segments
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
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
> http://www.delorie.com/djgpp/16bit
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,
though, no?
bernd
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE/dAEl/FmLrNfLpjMRAqLOAJ0bPSEoGo5MNfQSu5Fgqm8tC+BHiQCglONE
pBRfW3Umz8EmWcpI3e+3Fac=
=pPyf
-----END PGP SIGNATURE-----