llvm.org GIT mirror llvm / cee1aec
[mips] The decision to use MO_GOT_PAGE and MO_GOT_OFST depends on the ABI being N32 or N64 not the arch being MIPS64 Summary: No functional change (in supported use cases) Reviewers: matheusalmeida Reviewed By: matheusalmeida Differential Revision: http://llvm-reviews.chandlerc.com/D3177 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204805 91177308-0d34-0410-b5e6-96231b3b80d8 Daniel Sanders 6 years ago
2 changed file(s) with 11 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
15181518 }
15191519
15201520 if (GV->hasInternalLinkage() || (GV->hasLocalLinkage() && !isa(GV)))
1521 return getAddrLocal(N, Ty, DAG, HasMips64);
1521 return getAddrLocal(N, Ty, DAG, isN32() || IsN64);
15221522
15231523 if (LargeGOT)
15241524 return getAddrGlobalLargeGOT(N, Ty, DAG, MipsII::MO_GOT_HI16,
15381538 if (getTargetMachine().getRelocationModel() != Reloc::PIC_ && !IsN64)
15391539 return getAddrNonPIC(N, Ty, DAG);
15401540
1541 return getAddrLocal(N, Ty, DAG, HasMips64);
1541 return getAddrLocal(N, Ty, DAG, isN32() || IsN64);
15421542 }
15431543
15441544 SDValue MipsTargetLowering::
16311631 if (getTargetMachine().getRelocationModel() != Reloc::PIC_ && !IsN64)
16321632 return getAddrNonPIC(N, Ty, DAG);
16331633
1634 return getAddrLocal(N, Ty, DAG, HasMips64);
1634 return getAddrLocal(N, Ty, DAG, isN32() || IsN64);
16351635 }
16361636
16371637 SDValue MipsTargetLowering::
16521652 if (getTargetMachine().getRelocationModel() != Reloc::PIC_ && !IsN64)
16531653 return getAddrNonPIC(N, Ty, DAG);
16541654
1655 return getAddrLocal(N, Ty, DAG, HasMips64);
1655 return getAddrLocal(N, Ty, DAG, isN32() || IsN64);
16561656 }
16571657
16581658 SDValue MipsTargetLowering::lowerVASTART(SDValue Op, SelectionDAG &DAG) const {
25092509 InternalLinkage = Val->hasInternalLinkage();
25102510
25112511 if (InternalLinkage)
2512 Callee = getAddrLocal(G, Ty, DAG, HasMips64);
2512 Callee = getAddrLocal(G, Ty, DAG, isN32() || IsN64);
25132513 else if (LargeGOT)
25142514 Callee = getAddrGlobalLargeGOT(G, Ty, DAG, MipsII::MO_CALL_HI16,
25152515 MipsII::MO_CALL_LO16, Chain,
257257 // computing a local symbol's address:
258258 //
259259 // (add (load (wrapper $gp, %got(sym)), %lo(sym))
260 template
260 template
261261 SDValue getAddrLocal(NodeTy *N, EVT Ty, SelectionDAG &DAG,
262 bool HasMips64) const {
262 bool IsN32OrN64) const {
263263 SDLoc DL(N);
264 unsigned GOTFlag = HasMips64 ? MipsII::MO_GOT_PAGE : MipsII::MO_GOT;
264 unsigned GOTFlag = IsN32OrN64 ? MipsII::MO_GOT_PAGE : MipsII::MO_GOT;
265265 SDValue GOT = DAG.getNode(MipsISD::Wrapper, DL, Ty, getGlobalReg(DAG, Ty),
266266 getTargetNode(N, Ty, DAG, GOTFlag));
267267 SDValue Load = DAG.getLoad(Ty, DL, DAG.getEntryNode(), GOT,
268268 MachinePointerInfo::getGOT(), false, false,
269269 false, 0);
270 unsigned LoFlag = HasMips64 ? MipsII::MO_GOT_OFST : MipsII::MO_ABS_LO;
270 unsigned LoFlag = IsN32OrN64 ? MipsII::MO_GOT_OFST : MipsII::MO_ABS_LO;
271271 SDValue Lo = DAG.getNode(MipsISD::Lo, DL, Ty,
272272 getTargetNode(N, Ty, DAG, LoFlag));
273273 return DAG.getNode(ISD::ADD, DL, Ty, Load, Lo);
432432 const MipsSubtarget *Subtarget;
433433
434434 bool HasMips64, IsN64, IsO32;
435
436 bool isN32() const { return Subtarget->isABI_N32(); }
435437
436438 private:
437439 // Create a TargetGlobalAddress node.