This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: define_memory_constraint and REG_OK_STRICT

2009/9/30 Richard Henderson <>:
> On 09/29/2009 07:32 AM, Mohamed Shafi wrote:
>> My question is my definition of strict correct?
>> or should it be reload_in_progress || reload_completed?
> I'm tempted to say it should be the later, but I'm not sure it really makes
> any difference since reload does not query the operand predicates; it only
> queries the operand constraints.

    This is a memory_constraint. The memory constraint allows an
address based on the definition of the bool variable strict
> And even that said, neither the ARM or IA64 ports do anything with strict at
> all, which suggests that you may not have to either. ?It's possible that
> this works because after reload we verify an instruction with both
> predicates and constraints.
> Is this question in response to a particular problem, or just trying to
> avoid possible problems?

Both i guess

My pattern for DI

(define_insn "*mov<mode>_internal"
 [(set (match_operand:DI_DF 0 "nonimmediate_operand"
       (match_operand:DI_DF 1 "general_operand"
        " i,i,t,t,d,d,d,Se0,e,Ss0,b,Ss1,c,Sr0,b,Se0,b,Sb1,b,Sb2,b,Sd2,e,Sd3"))]

post_inc and post_dec is allowed only by the constraint 'Se0'.
Reload pass was not choosing this alternative for the following pattern:

(insn 103 102 53 4 ch_addr.c:11 (set (mem:DF (post_inc:SI (reg:SI 90 [
__ivtmp_22 ])) [0 S8 A64])
        (subreg:DF (reg:DI 116 [+4 ]) 0)) 40 {*movdf_internal}
(expr_list:REG_DEAD (reg:DI 116 [+4 ])
        (expr_list:REG_INC (reg:SI 90 [ __ivtmp_22 ])

because in the mem_constraint function i have

target_mem_constraint (const char *str, rtx op)
 char c0 = str[0];
 char c1 = str[1];
 rtx op0 = XEXP (op, 0);
 bool strict =  (reload_completed || reload_in_progress);

 if (!MEM_P (op))
   return 0;

 switch (c0)
   case 'r':
     return (!STACK_REG_RTX_P (op0)
             && BASE_REG_RTX_P (op0, strict));

   case 'e':
     if (GET_CODE (op0) == POST_INC
         || GET_CODE (op0) == POST_DEC)
        return (!STACK_REG_RTX_P (XEXP (op0, 0))
                    && BASE_REG_RTX_P (XEXP (op0, 0), strict));

So the alternative was getting rejected due to my definition of strict
and thus results in an ICE later. But since there were only few in the
testsuite , i will have to guess that reload was fixing other cases
similar to this and thus maybe generating unoptimized code. So what
should be the definition ?

 bool strict =  (reload_completed || reload_in_progress);


 bool strict =  reload_completed ? true : false;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]