Hi,

I am doing a port in GCC 4.5.1.
The target supports storing immediate values into memory location
represented by a symbolic address. So in the move pattern i have given
constraints to represent this.

(define_insn "movqi_op"
  [(set (match_operand:QI 0 "nonimmediate_operand" "=!Q,!Q,d,d,d,d,d,d,d,Q,R,S")
        (match_operand:QI 1 "general_operand"       "I,J,i,W,J,d,Q,R,S,d,d,d"))]
  ""
  "@
  st.s32\t%0, %1;
  st.u32\t%0, %1;
  set\t%0, %1;
  set.u32\t%0, %1;
  set.u32\t%0, %1;
  move\t%0, %1;
  ld%u0\t%0, %1;
  ld%u0\t%0, %1;
  ld%u0\t%0, %1;
  st%u0\t%0, %1;
  st%u0\t%0, %1;
  st%u0\t%0, %1;"
 )

where
Q represents symbolic address,
R represents all address formed using SP
S represents all address formed using address registers
I, J,W,i represents various const_ints
d represents general registers.


Whenever reload get a pattern to store const_int to a memory that is
scheduled for reloading, the reload pass will match it with Q
constraints. So to avoid those i added the constrain modifier '!' to
'Q'. But even then there is one particular case that causes trouble.
This happens when reload pass gets a pattern where the destination is
an illegal address and source is a pesudo register (no register
allocated) for which reg_equiv_constant[regno] != 0.

Before IRA pass:

(insn 27 25 33 4 pr23848-3.c:12 (set (mem/s/j:QI (reg/f:PQI 69) [0 S1 A32])
        (reg:QI 93)) 7 {movqi_op} (expr_list:REG_DEAD (reg/f:PQI 69)
        (expr_list:REG_EQUAL (const_int 49 [0x31])
            (nil))))

Just before reloading phase:

(insn 27 25 33 4 pr23848-3.c:12 (set (mem/s/j:QI (reg/f:PQI 12 as0
[69]) [0 S1 A32])
        (reg:QI 93)) 7 {movqi_op} (expr_list:REG_DEAD (reg/f:PQI 12 as0 [69])
        (expr_list:REG_EQUAL (const_int 0 [0x0])
            (nil))))

Since reg93 is not allocated with any register, its replaced with
reg_equiv_constant[regno], and this combination wins the (Q, I)
constraint pair and in that process 'losers' (variable in loop over
alternatives) becomes 0 and hence breaks out and returns. Due to this
compiler crashes with "insn does not satisfy its constraints:"  error.
Any pointers in fixing this?

Regards,
Shafi

P.S. When can we merge constraints? What are the criteria to decide
which all constraints to merge

Reply via email to