[llvm] [RFC][RISCV] Support the large code model. (PR #70308)
Shao-Ce SUN via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 12 02:45:00 PDT 2024
================
@@ -17489,22 +17539,34 @@ SDValue RISCVTargetLowering::LowerCall(CallLoweringInfo &CLI,
// If the callee is a GlobalAddress/ExternalSymbol node, turn it into a
// TargetGlobalAddress/TargetExternalSymbol node so that legalize won't
// split it and then direct call can be matched by PseudoCALL.
- if (GlobalAddressSDNode *S = dyn_cast<GlobalAddressSDNode>(Callee)) {
- const GlobalValue *GV = S->getGlobal();
+ if (getTargetMachine().getCodeModel() == CodeModel::Large) {
+ if (GlobalAddressSDNode *S = dyn_cast<GlobalAddressSDNode>(Callee)) {
+ Callee =
+ getLargeGlobalAddress(S, DL, getPointerTy(DAG.getDataLayout()), DAG);
----------------
sunshaoce wrote:
`getPointerTy(DAG.getDataLayout())` can be replaced by `PtrVT`
https://github.com/llvm/llvm-project/pull/70308
More information about the llvm-commits
mailing list