[LLVMdev] to lower "write to argument pointer"
Tom Stellard
tom at stellard.net
Tue Jul 29 07:09:09 PDT 2014
On Tue, Jul 29, 2014 at 12:25:55AM -0400, kewuzhang wrote:
> Drear there:
>
> The problem I have is to lower an intrinsic function like this
> ”
> float @llvm.write.arg(flaot %src, float* %dst)
> “
> I am lowering it with INTRINSIC_W_CHAIN, so the return value and the value to write to dst are generated with some operations using src:
>
> "
> // it is the frame index node corresponding to input pointer
> SDvalue frindex = Op.getoperand(3);
> …
> SDValue returnValue = DAG.getNode(myNode1, DL, VT….);
>
> SDValue dstValue = DAG.getNode(myNode2, DL, VT….);
>
> // to save the value to dst pointer, I think I need some call like
> SDValue dstOut = DAG.getStore(chain, DL, dstValue, FrameIndex, MachinePointerInfo(), false, false, 0);
>
> “
> I have two questions here:
> (1) should I return some merges values( returnValue, DstValue) ? or only return returnValue is right? ( the dag dumped out looks better if I return the merged values)
Since INTRINSIC_W_CHAIN has two values, whatever you lower it to should
have two: The result and the chain. You canuse MERGE_VALUES for that.
> (2) How the FrameIndex should be computed? I use DAG.getFrameIndex((dyn_cast<FrameIndexSDnode>( frindex.getNode()))->getIndex(), i32), not confident it is correct, any good examples to understand to this?
>
Is the FrameIndex one of the inputs to the intrinsic, or are you trying
to create a new FrameIndex?
-Tom
> Best
>
> Kevin
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
More information about the llvm-dev
mailing list