Skip to content

Commit

Permalink
Inline getLargeAddr function
Browse files Browse the repository at this point in the history
  • Loading branch information
tclin914 committed Sep 3, 2024
1 parent 6216bc5 commit 4be2bcc
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions llvm/lib/Target/RISCV/RISCVISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7429,16 +7429,6 @@ static SDValue getLargeExternalSymbol(ExternalSymbolSDNode *N, SDLoc DL, EVT Ty,
MachinePointerInfo::getConstantPool(DAG.getMachineFunction()));
}

template <class NodeTy>
static SDValue getLargeAddr(NodeTy *N, SDLoc DL, EVT Ty, SelectionDAG &DAG) {
if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(N))
return getLargeGlobalAddress(G, DL, Ty, DAG);

// Using pc-relative mode for other node type.
SDValue Addr = getTargetNode(N, DL, Ty, DAG, 0);
return DAG.getNode(RISCVISD::LLA, DL, Ty, Addr);
}

template <class NodeTy>
SDValue RISCVTargetLowering::getAddr(NodeTy *N, SelectionDAG &DAG,
bool IsLocal, bool IsExternWeak) const {
Expand Down Expand Up @@ -7508,7 +7498,12 @@ SDValue RISCVTargetLowering::getAddr(NodeTy *N, SelectionDAG &DAG,
return DAG.getNode(RISCVISD::LLA, DL, Ty, Addr);
}
case CodeModel::Large: {
return getLargeAddr(N, DL, Ty, DAG);
if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(N))
return getLargeGlobalAddress(G, DL, Ty, DAG);

// Using pc-relative mode for other node type.
SDValue Addr = getTargetNode(N, DL, Ty, DAG, 0);
return DAG.getNode(RISCVISD::LLA, DL, Ty, Addr);
}
}
}
Expand Down

0 comments on commit 4be2bcc

Please sign in to comment.