This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Taking a stab at register-relative data addressing on m68k...


>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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]