[LLVMdev] prevent an SDValue from lower into an immediate field in load

Xiaochu Liu xiaochu1122 at gmail.com
Wed Jul 22 11:05:35 PDT 2015


Hi there,

I am doing relocation in my backend by calling my function getAddrNonPic:

SDValue getAddrNonPIC(NodeTy *N, SDLoc DL, EVT Ty, SelectionDAG &DAG)const{
  SValue Hi=getTarget(N,Ty,DAG, MyBackend::Hi16);
  SValue Lo=getTarget(N,Ty,DAG, MyBackend::Lo16);
  return DAG.getNode(ISD::ADD, DL, Ty,
    DAG.getNode(MyBackend::Hi16, DL, Ty, Hi),
    DAG.getNode(MyBackend::Lo16, DL, Ty, Ho));
}

But sometimes a load instruction is lowered into:

(r2=lo16(symbol))
lw r1, r2(Hi16(symbol))

But what I want is:
(r2=lo16(symbol))
(r3=hi16(symbol))
add r2, r2,r3
lw r1, r2(0)

Can you please show me some hints?

Thanks,
Xiaochu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150722/cafeaaf8/attachment.html>


More information about the llvm-dev mailing list