This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: How to force instruction in slot1 while emit NOP in slot0 if necessary?
"Bingfeng Mei" <bmei@broadcom.com> writes:
> We are portinng GCC 4.2.1 to a 2-issue VLIW processor. There are some
> special instructions which can only be issued on the second slot (slot
> 1). I tried to specify using following DFA constructs.
>
> ;; Define this instruction can only be issued on slot 1
> (define_insn_reservation "psr_y" 1
> (eq_attr "type" "psr")
> "slot1" )
>
> ;; Define slot1 can only be issued after slot0 is filled
> (presence_set "slot1" "slot0")
>
>
> I hope the compiler can automatically insert NOP on slot0 if it is
> unused so that the second constraint can be fulfilled. However, the
> compiler falls into a deadlock. Without the second constraint , the
> compiler can emit code but I cannot tell from RTL on which slot the
> instruction is issued. What is best way to figure out unused slot and
> insert NOP insn? Or is there more clever way to specify DFA that allows
> compiler automatically emit NOPs? Any suggestion is greatly
> appreciated.
You can't do this in gcc's scheduler DFA. It's one of its major
limitations.
There are a couple of ways to handle this. My personal favorite is to
do it in the TARGET_ASM_FUNCTION_PROLOGUE routine. For an example of
this approach see frv_pack_insns in frv.c.
Ian