[llvm-dev] Understanding TargetLowering::LowerCall

jeniffer lesley via llvm-dev llvm-dev at lists.llvm.org
Mon Mar 22 04:48:07 PDT 2021


Hi Tim,
I had similar problem a couple of weeks ago but I somehow circumvented it.
However, I dont understand much from the description. Can you please
provide some example of backend which does this? probably what functions in
X86 backend handle this lowering? If I look at the code I will be able to
understand more clearly.

On Mon, Mar 22, 2021, 3:27 PM Tim Northover via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> On Mon, 22 Mar 2021 at 07:36, Zhang via llvm-dev
> <llvm-dev at lists.llvm.org> wrote:
> > For CallSites that contains a GlobalValue as one of the arguments, where
> exactly does the lowering from GlobalAddress to iPTR took place?.
>
> It's generally no different for a callsite than any other GlobalValue
> user. The generic SelectionDAGBuilder code will create a GlobalAddress
> SDNode with iPTR type because the type of a GlobalValue is actually a
> pointer to the type of the underlying object.
>
> The call lowering code will get this iPTR node, and may well decide to
> pass it to the callee in a register.
>
> As for the GlobalAddress node, that goes through normal lowering to a
> target-specific instruction sequence to materialize the address of the
> global object. Often this is via custom C++ in LegalizeDAG (i.e.
> `setOperationAction(ISD::GlobalValue, MVT::i64, Custom)`).
>
> Cheers.
>
> Tim.
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210322/7ce5ae8b/attachment.html>


More information about the llvm-dev mailing list