[LLVMdev] MemRefs in a Load Instruction

Pranav Bhandarkar pranavb at codeaurora.org
Thu Apr 26 15:23:34 PDT 2012


Hi, 

On the hexagon target, I have written a following combiner pattern.
*********************************************

def: Pat<(i64 (or (i64 (shl (i64 (extloadi32 (i32 (add IntRegs:$src1,
 
s11_2ExtPred:$offset1)))),
                                                            (i32 32))),
                                    (i64 (zextloadi32 ADDRriS11_2:$src2)))),
         (i64 (COMBINE_rr (LDriw_indexed IntRegs:$src1,
s11_2ExtPred:$offset1),
                                               (LDriw ADDRriS11_2:$src2)))>;
******************************

Without getting into too much detail, all that the pattern is doing is
combining the results of two 32 bit loads into a 64 bit value.

The two loads can be packetized together. However, they are not being
packetized together because they seem to be losing their MemRefs (i.e
MI->memoperands_empty()) when lowered via this pattern. This causes the
loads to be volatile and "unpacketizable".

Is there no way to preserve or attach MemRefs to the LDriw instructions
generated by way of a pattern in the InstrInfo.td file ? FWIW, the LDriw
instruction is as show here.
let isPredicable = 1 in

def LDriw : LDInst<(outs IntRegs:$dst),
            (ins MEMri:$addr), "$dst = memw($addr)", 
            [(set IntRegs:$dst, (i32 (load ADDRriS11_2:$addr)))]>;  

TIA,
Pranav

Qualcomm Innovation Center, (QuIC) is a member of the Code Aurora Forum.




More information about the llvm-dev mailing list