[llvm] [RFC][RISCV] Support the large code model. (PR #70308)

Jessica Clarke via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 12 03:50:58 PDT 2024


================
@@ -6431,6 +6432,52 @@ static SDValue getTargetNode(JumpTableSDNode *N, const SDLoc &DL, EVT Ty,
   return DAG.getTargetJumpTable(N->getIndex(), Ty, Flags);
 }
 
+static SDValue getLargeGlobalAddress(GlobalAddressSDNode *N, SDLoc DL, EVT Ty,
+                                     SelectionDAG &DAG) {
+  RISCVConstantPoolConstant *CPV =
+      RISCVConstantPoolConstant::Create(N->getGlobal());
+  SDValue CPAddr = DAG.getTargetConstantPool(CPV, Ty, Align(8));
+  SDValue LC = DAG.getNode(RISCVISD::LLA, DL, Ty, CPAddr);
+  return DAG.getLoad(
+      Ty, DL, DAG.getEntryNode(), LC,
+      MachinePointerInfo::getConstantPool(DAG.getMachineFunction()));
+}
+
+static SDValue getLargeBlockAddress(BlockAddressSDNode *N, SDLoc DL, EVT Ty,
----------------
jrtc27 wrote:

I don't think you need this... block addresses are within a function, and things are going to explode very quickly elsewhere if you have single functions > 2 GiB.

https://github.com/llvm/llvm-project/pull/70308


More information about the llvm-commits mailing list