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...@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
On X86 it's X86TargetLowering::LowerGlobalOrExternal.
The initial DAG shouldn't have a *Target*GlobalAddress. That's an
already-selected machine node and so it won't be further processed by
instruction selection. So you probably need to find whatever code you
have that's turning the original GlobalAddress into a
TargetGlobalAddress and modify that to actually insert the correct
instructions too.
Cheers.
Tim