From 4be2bccd5caa8ef58288d4d7070dfc590c1be378 Mon Sep 17 00:00:00 2001 From: Jim Lin Date: Wed, 28 Aug 2024 12:59:18 +0800 Subject: [PATCH] Inline getLargeAddr function --- llvm/lib/Target/RISCV/RISCVISelLowering.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp index 539e5bea153915..c1ebb6aefbdfda 100644 --- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp +++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp @@ -7429,16 +7429,6 @@ static SDValue getLargeExternalSymbol(ExternalSymbolSDNode *N, SDLoc DL, EVT Ty, MachinePointerInfo::getConstantPool(DAG.getMachineFunction())); } -template -static SDValue getLargeAddr(NodeTy *N, SDLoc DL, EVT Ty, SelectionDAG &DAG) { - if (GlobalAddressSDNode *G = dyn_cast(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 SDValue RISCVTargetLowering::getAddr(NodeTy *N, SelectionDAG &DAG, bool IsLocal, bool IsExternWeak) const { @@ -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(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); } } }