@@ -485,6 +485,32 @@ class TargetRegisterClass;
485485 DAG.getNode (MipsISD::GPRel, DL, DAG.getVTList (Ty), GPRel));
486486 }
487487
488+ // This method creates the following nodes, which are necessary for
489+ // loading a dllimported symbol:
490+ //
491+ // (lw (add (shl(%high(sym), 16), %low(sym)))
492+ template <class NodeTy >
493+ SDValue getDllimportSymbol (NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG) const {
494+ SDValue Hi = getTargetNode (N, Ty, DAG, MipsII::MO_ABS_HI | MipsII::MO_DLLIMPORT);
495+ SDValue Lo = getTargetNode (N, Ty, DAG, MipsII::MO_ABS_LO | MipsII::MO_DLLIMPORT);
496+ return DAG.getNode (ISD::ADD, DL, Ty,
497+ DAG.getNode (MipsISD::Lo, DL, Ty, Lo),
498+ DAG.getNode (MipsISD::Hi, DL, Ty, Hi));
499+ }
500+
501+ // This method creates the following nodes, which are necessary for
502+ // loading a dllimported global variable:
503+ //
504+ // (lw (lw (add (shl(%high(sym), 16), %low(sym))))
505+ template <class NodeTy >
506+ SDValue getDllimportVariable (NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG,
507+ SDValue Chain,
508+ const MachinePointerInfo &PtrInfo) const {
509+ return DAG.getLoad (Ty, DL, Chain,
510+ getDllimportSymbol (N, DL, Ty, DAG),
511+ PtrInfo);
512+ }
513+
488514 // / This function fills Ops, which is the list of operands that will later
489515 // / be used when a function call node is created. It also generates
490516 // / copyToReg nodes to set up argument registers.
0 commit comments