This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Taking a stab at register-relative data addressing on m68k...
- From: Peter Barada <peter at the-baradas dot com>
- To: ray at xmission dot com
- Cc: gcc at gcc dot gnu dot org
- Date: Fri, 5 Mar 2004 10:46:33 -0500 (EST)
- Subject: Re: Taking a stab at register-relative data addressing on m68k...
- References: <Pine.LNX.4.58.0403050556430.14046@xmission.xmission.com>
>2. The GOT is not useful or desirable for our simple platform which uses no
>shared libraries. Where current code moves the address of the global
>symbol foo to %d0 as:
>
>move.l foo@GOT.l(%a5),%d0
>
>I would like to substitute:
>
>move.l #foo, %d0
>add.l %a5,%d0
>
>For m68020 / Coldfire, there may be a simpler lea instruction that works.
COldfire has more restricted addressming modes than m68020. You can
load a 32bit value into an address register, but if you wna tto add a
register, then it has to be a sign extended 16 bit value.
If the offset of #foo is less thant +/- 32k, then just:
move.l #foo_offset(%a5),%d0
will work to access the variable @foo. Otherwise you have to:
move.l #foo_offset,%d0
move.l (%a5,%d0),%d1
to access the variable @foo.
--
Peter Barada
peter@the-baradas.com