* PIC code for coldfire v4e
@ 2004-09-15 18:40 C Jaiprakash, Noida
2004-09-15 20:11 ` Andreas Schwab
0 siblings, 1 reply; 3+ messages in thread
From: C Jaiprakash, Noida @ 2004-09-15 18:40 UTC (permalink / raw)
To: gcc; +Cc: C Jaiprakash, Noida
Hi,
I am trying to provide PIC support for coldfire v4e. Curently movsi pattern generates PIC code , basically it generates a RTX like PLUS(a5, symbolic_operand) where a5 is PIC offset table pointer. And at the final assembly o/p @GOT is appended to the symbol if base register is a5. For coldfire v4e this can not be done because only 16 bit offset is allowed. May be something like
lea running@GOT.w, %register
move.l (%a5,%register), %a0
instead of
move.l running@GOT.w(%a5),%a0
will have to be done. But i am facing implementation problems for this. I can not force_reg symbolic operand in "movsi" pattern. I tried to split this later but the problem is print_operand_address relies on base register for adding @GOT while assembly generation, which will not happen if i spilt the "movsi" insn. Any hint where cani do this? Below is "movsi"
pattern for reference.
(define_expand "movsi"
[(set (match_operand:SI 0 "nonimmediate_operand" "")
(match_operand:SI 1 "general_operand" ""))]
""
"
{
if (flag_pic && !TARGET_PCREL && symbolic_operand (operands[1], SImode))
{
/* The source is an address which requires PIC relocation.
Call legitimize_pic_address with the source, mode, and a relocation
register (a new pseudo, or the final destination if reload_in_progress
is set). Then fall through normally */
rtx temp = reload_in_progress ? operands[0] : gen_reg_rtx (Pmode);
operands[1] = legitimize_pic_address (operands[1], SImode, temp);
}
else if (flag_pic && TARGET_PCREL && ! reload_in_progress)
{
/* Don't allow writes to memory except via a register;
the m68k doesn't consider PC-relative addresses to be writable. */
if (symbolic_operand (operands[0], SImode))
operands[0] = force_reg (SImode, XEXP (operands[0], 0));
else if (GET_CODE (operands[0]) == MEM
&& symbolic_operand (XEXP (operands[0], 0), SImode))
operands[0] = gen_rtx (MEM, SImode,
force_reg (SImode, XEXP (operands[0], 0)));
}
}")
cj
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: PIC code for coldfire v4e
2004-09-15 18:40 PIC code for coldfire v4e C Jaiprakash, Noida
@ 2004-09-15 20:11 ` Andreas Schwab
2004-09-16 7:38 ` Peter Barada
0 siblings, 1 reply; 3+ messages in thread
From: Andreas Schwab @ 2004-09-15 20:11 UTC (permalink / raw)
To: C Jaiprakash, Noida; +Cc: gcc
"C Jaiprakash, Noida" <C.Jaiprakash@noida.hcltech.com> writes:
> Hi,
> I am trying to provide PIC support for coldfire v4e. Curently movsi pattern generates PIC code , basically it generates a RTX like PLUS(a5, symbolic_operand) where a5 is PIC offset table pointer. And at the final assembly o/p @GOT is appended to the symbol if base register is a5. For coldfire v4e this can not be done because only 16 bit offset is allowed. May be something like
> lea running@GOT.w, %register
> move.l (%a5,%register), %a0
> instead of
> move.l running@GOT.w(%a5),%a0
^^
This is already a 16 bit offset. For -fpic (as opposed to -fPIC) you
don't have to change anything here. You could just declare -fPIC
unsupported for this coldfire model (like it is done for m680[01]0.)
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, MaxfeldstraÃe 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: PIC code for coldfire v4e
2004-09-15 20:11 ` Andreas Schwab
@ 2004-09-16 7:38 ` Peter Barada
0 siblings, 0 replies; 3+ messages in thread
From: Peter Barada @ 2004-09-16 7:38 UTC (permalink / raw)
To: schwab; +Cc: C.Jaiprakash, gcc
>> Hi,
>> I am trying to provide PIC support for coldfire v4e. Curently movsi pattern generates PIC code , basically it generates a RTX like PLUS(a5, symbolic_operand) where a5 is PIC offset table pointer. And at the final assembly o/p @GOT is appended to the symbol if base register is a5. For coldfire v4e this can not be done because only 16 bit offset is allowed. May be something like
>> lea running@GOT.w, %register
>> move.l (%a5,%register), %a0
>> instead of
>> move.l running@GOT.w(%a5),%a0
> ^^
>
>This is already a 16 bit offset. For -fpic (as opposed to -fPIC) you
>don't have to change anything here. You could just declare -fPIC
>unsupported for this coldfire model (like it is done for m680[01]0.)
See:
http://gcc.gnu.org/ml/gcc/2002-12/msg00343.html
for the start of a thread where I tried to implement this back in
2002. Perhaps it will shortcut some of the issues you are about to
get run over by. Unfortunately I ran out of time before I was able to fully
implement/test it...
Andres, see:
http://gcc.gnu.org/ml/gcc/2002-12/msg00345.html
for my response to your same suggestion :)
--
Peter Barada
peter@the-baradas.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-09-16 5:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-15 18:40 PIC code for coldfire v4e C Jaiprakash, Noida
2004-09-15 20:11 ` Andreas Schwab
2004-09-16 7:38 ` Peter Barada
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).