Saga of m68k PIC continues
Andreas Schwab
schwab@suse.de
Thu Dec 12 05:11:00 GMT 2002
Richard Henderson <rth@redhat.com> writes:
|> On Wed, Dec 11, 2002 at 07:11:05PM -0500, Peter Barada wrote:
|> > + case 7:
|> > + fputs ("@GOTOFF", file);
|> > + break;
|>
|> Note that m68k doesn't have @GOTOFF. The equivalent there
|> is pc-relative addressing modes.
|>
|> Ideally, m68k pic code generation would use @GOTPC, a-la
|>
|> extern int foo;
|> foo = 1;
|>
|> movel (%pc, foo@GOTPC), %a0
|> moveql #1, (%a0)
|>
|> static int bar, baz;
|> bar = baz;
|>
|> lea (%pc, bar), %a0
|> movel (%pc, baz), (%a0)
|>
|> I can't really think of any reason that 68020+ would
|> actually need a pic register.
For -fPIC there is probably no difference, but full 32-bit pc-relative is
still less efficient than register+16 bit offset, so with -fpic the use of
the pic register is usually faster. Note also that pc-relative addresses
cannot be used as destination operand.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
More information about the Gcc
mailing list