Saga of m68k PIC continues

Jan Hubicka jh@suse.cz
Thu Dec 12 12:44:00 GMT 2002


> 
> >
> >> 2) If not, does anyone have an idea how I should get this instruction
> >>    recognized? 
> >
> >You *may* want to wrap the unspec in a CONST.  That would 
> >make the thing be recognized by general_operand.  But I
> >can't tell if that's exactly right, since you've posted
> >no code.
> 
> Using the extremely simple test program:
> 
> extern int foo;
> void z(void)
> {
>   foo = 1;
> }
> 
> Compiled with -fPIC -O2 -S, I get:
> 
> z:
> 	link.w %a6,#0
> 	move.l %a5,-(%sp)
> 	lea (%pc, _GLOBAL_OFFSET_TABLE_@GOTPC), %a5
> 	lea foo,%a0
> 	moveq.l #1,%d0
> 	move.l %d0,(%a0)
> 	move.l (%sp)+,%a5
> 	unlk %a6
> 	rts
> 
> Looks like the -fPIC stuff failed and completely due to something
> betwwen zz.c.03.jump and zz.c.08.cse converting the (const (uspec:SI
> [...] 3)) into (uspec:SI [...] 3).
> 
> >From the debug output, I see the following:
> 
> >From zz.c.00.rtl I see:
> 
> (note 2 0 3 NOTE_INSN_DELETED)
> 
> (note 3 2 4 NOTE_INSN_FUNCTION_BEG)
> 
> (note 4 3 5 NOTE_INSN_DELETED)
> 
> (note 5 4 6 NOTE_INSN_DELETED)
> 
> (note 6 5 9 NOTE_INSN_DELETED)
> 
> (insn 9 6 11 (set (reg:SI 30)
>         (const:SI (unspec:SI[ 
>                     (symbol_ref:SI ("foo"))
>                 ]  3))) -1 (nil)
>     (expr_list:REG_EQUAL (const:SI (unspec:SI[ 
>                     (symbol_ref:SI ("foo"))
>                 ]  3))
>         (nil)))
> 
> (insn 11 9 13 (set (reg/f:SI 29)
>         (mem/u:SI (plus:SI (reg:SI 13 %a5)
>                 (reg:SI 30)) [0 S4 A8])) -1 (nil)
>     (expr_list:REG_EQUAL (symbol_ref:SI ("foo"))
>         (nil)))
> 
> (insn 13 11 14 (set (mem/f:SI (reg/f:SI 29) [2 foo+0 S4 A16])
>         (const_int 1 [0x1])) -1 (nil)
>     (nil))
> 
> (note 14 13 16 NOTE_INSN_FUNCTION_END)
> 
> 
> Which looks the same in zz.c.03.jump.  From zz.c.08.cse I see:
> 
> (note 2 0 3 NOTE_INSN_DELETED)
> 
> (note 3 2 17 NOTE_INSN_FUNCTION_BEG)
> 
> (note 17 3 11 [bb 0] NOTE_INSN_BASIC_BLOCK)
> 
> (insn 11 17 13 (set (reg/f:SI 29)
>         (symbol_ref:SI ("foo"))) 29 {*m68k.md:1011} (nil)
>     (expr_list:REG_EQUAL (symbol_ref:SI ("foo"))
>         (nil)))
> 
> (insn 13 11 14 (set (mem/f:SI (reg/f:SI 29) [2 foo+0 S4 A16])
>         (const_int 1 [0x1])) 29 {*m68k.md:1011} (nil)
>     (nil))
> 
> 
> Note the removal of the (const ... ) in insn 11.
> 
> Any ideas where this is being stripped off?
GCC will happily put in the subreg when your machine description accept
it.  There are hooks defining valid addresses and constants and these
must refuse invalid stuff, like (symbol_ref:SI ("foo") is for PIC.

Honza
> 
> -- 
> Peter Barada                                   Peter.Barada@motorola.com
> Wizard                                         781-852-2768 (direct)
> WaveMark Solutions(wholly owned by Motorola)   781-270-0193 (fax)



More information about the Gcc mailing list