mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 04:30:12 +00:00
[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
This commit is contained in:
parent
4de1039403
commit
cee1aecc57
@ -1519,7 +1519,7 @@ SDValue MipsTargetLowering::lowerGlobalAddress(SDValue Op,
|
||||
}
|
||||
|
||||
if (GV->hasInternalLinkage() || (GV->hasLocalLinkage() && !isa<Function>(GV)))
|
||||
return getAddrLocal(N, Ty, DAG, HasMips64);
|
||||
return getAddrLocal(N, Ty, DAG, isN32() || IsN64);
|
||||
|
||||
if (LargeGOT)
|
||||
return getAddrGlobalLargeGOT(N, Ty, DAG, MipsII::MO_GOT_HI16,
|
||||
@ -1539,7 +1539,7 @@ SDValue MipsTargetLowering::lowerBlockAddress(SDValue Op,
|
||||
if (getTargetMachine().getRelocationModel() != Reloc::PIC_ && !IsN64)
|
||||
return getAddrNonPIC(N, Ty, DAG);
|
||||
|
||||
return getAddrLocal(N, Ty, DAG, HasMips64);
|
||||
return getAddrLocal(N, Ty, DAG, isN32() || IsN64);
|
||||
}
|
||||
|
||||
SDValue MipsTargetLowering::
|
||||
@ -1632,7 +1632,7 @@ lowerJumpTable(SDValue Op, SelectionDAG &DAG) const
|
||||
if (getTargetMachine().getRelocationModel() != Reloc::PIC_ && !IsN64)
|
||||
return getAddrNonPIC(N, Ty, DAG);
|
||||
|
||||
return getAddrLocal(N, Ty, DAG, HasMips64);
|
||||
return getAddrLocal(N, Ty, DAG, isN32() || IsN64);
|
||||
}
|
||||
|
||||
SDValue MipsTargetLowering::
|
||||
@ -1653,7 +1653,7 @@ lowerConstantPool(SDValue Op, SelectionDAG &DAG) const
|
||||
if (getTargetMachine().getRelocationModel() != Reloc::PIC_ && !IsN64)
|
||||
return getAddrNonPIC(N, Ty, DAG);
|
||||
|
||||
return getAddrLocal(N, Ty, DAG, HasMips64);
|
||||
return getAddrLocal(N, Ty, DAG, isN32() || IsN64);
|
||||
}
|
||||
|
||||
SDValue MipsTargetLowering::lowerVASTART(SDValue Op, SelectionDAG &DAG) const {
|
||||
@ -2510,7 +2510,7 @@ MipsTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
|
||||
InternalLinkage = Val->hasInternalLinkage();
|
||||
|
||||
if (InternalLinkage)
|
||||
Callee = getAddrLocal(G, Ty, DAG, HasMips64);
|
||||
Callee = getAddrLocal(G, Ty, DAG, isN32() || IsN64);
|
||||
else if (LargeGOT)
|
||||
Callee = getAddrGlobalLargeGOT(G, Ty, DAG, MipsII::MO_CALL_HI16,
|
||||
MipsII::MO_CALL_LO16, Chain,
|
||||
|
@ -258,17 +258,17 @@ namespace llvm {
|
||||
// computing a local symbol's address:
|
||||
//
|
||||
// (add (load (wrapper $gp, %got(sym)), %lo(sym))
|
||||
template<class NodeTy>
|
||||
template <class NodeTy>
|
||||
SDValue getAddrLocal(NodeTy *N, EVT Ty, SelectionDAG &DAG,
|
||||
bool HasMips64) const {
|
||||
bool IsN32OrN64) const {
|
||||
SDLoc DL(N);
|
||||
unsigned GOTFlag = HasMips64 ? MipsII::MO_GOT_PAGE : MipsII::MO_GOT;
|
||||
unsigned GOTFlag = IsN32OrN64 ? MipsII::MO_GOT_PAGE : MipsII::MO_GOT;
|
||||
SDValue GOT = DAG.getNode(MipsISD::Wrapper, DL, Ty, getGlobalReg(DAG, Ty),
|
||||
getTargetNode(N, Ty, DAG, GOTFlag));
|
||||
SDValue Load = DAG.getLoad(Ty, DL, DAG.getEntryNode(), GOT,
|
||||
MachinePointerInfo::getGOT(), false, false,
|
||||
false, 0);
|
||||
unsigned LoFlag = HasMips64 ? MipsII::MO_GOT_OFST : MipsII::MO_ABS_LO;
|
||||
unsigned LoFlag = IsN32OrN64 ? MipsII::MO_GOT_OFST : MipsII::MO_ABS_LO;
|
||||
SDValue Lo = DAG.getNode(MipsISD::Lo, DL, Ty,
|
||||
getTargetNode(N, Ty, DAG, LoFlag));
|
||||
return DAG.getNode(ISD::ADD, DL, Ty, Load, Lo);
|
||||
@ -434,6 +434,8 @@ namespace llvm {
|
||||
|
||||
bool HasMips64, IsN64, IsO32;
|
||||
|
||||
bool isN32() const { return Subtarget->isABI_N32(); }
|
||||
|
||||
private:
|
||||
// Create a TargetGlobalAddress node.
|
||||
SDValue getTargetNode(GlobalAddressSDNode *N, EVT Ty, SelectionDAG &DAG,
|
||||
|
Loading…
Reference in New Issue
Block a user