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