mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-03 17:31:50 +00:00
Simplify getLabelAccessInfo.
It now takes a IsPIC flag instead of computing and returning it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273871 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3334c59094
commit
7a6104fd55
@ -1962,19 +1962,16 @@ bool PPCTargetLowering::getPreIndexedAddressParts(SDNode *N, SDValue &Base,
|
||||
// LowerOperation implementation
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/// GetLabelAccessInfo - Return true if we should reference labels using a
|
||||
/// PICBase, set the HiOpFlags and LoOpFlags to the target MO flags.
|
||||
static bool GetLabelAccessInfo(const TargetMachine &TM,
|
||||
const PPCSubtarget &Subtarget,
|
||||
/// Return true if we should reference labels using a PICBase, set the HiOpFlags
|
||||
/// and LoOpFlags to the target MO flags.
|
||||
static void getLabelAccessInfo(bool IsPIC, const PPCSubtarget &Subtarget,
|
||||
unsigned &HiOpFlags, unsigned &LoOpFlags,
|
||||
const GlobalValue *GV = nullptr) {
|
||||
HiOpFlags = PPCII::MO_HA;
|
||||
LoOpFlags = PPCII::MO_LO;
|
||||
|
||||
// Don't use the pic base if not in PIC relocation model.
|
||||
bool isPIC = TM.getRelocationModel() == Reloc::PIC_;
|
||||
|
||||
if (isPIC) {
|
||||
if (IsPIC) {
|
||||
HiOpFlags |= PPCII::MO_PIC_FLAG;
|
||||
LoOpFlags |= PPCII::MO_PIC_FLAG;
|
||||
}
|
||||
@ -1990,8 +1987,6 @@ static bool GetLabelAccessInfo(const TargetMachine &TM,
|
||||
LoOpFlags |= PPCII::MO_NLP_HIDDEN_FLAG;
|
||||
}
|
||||
}
|
||||
|
||||
return isPIC;
|
||||
}
|
||||
|
||||
static SDValue LowerLabelRef(SDValue HiPart, SDValue LoPart, bool isPIC,
|
||||
@ -2050,10 +2045,10 @@ SDValue PPCTargetLowering::LowerConstantPool(SDValue Op,
|
||||
}
|
||||
|
||||
unsigned MOHiFlag, MOLoFlag;
|
||||
bool isPIC =
|
||||
GetLabelAccessInfo(DAG.getTarget(), Subtarget, MOHiFlag, MOLoFlag);
|
||||
bool IsPIC = isPositionIndependent();
|
||||
getLabelAccessInfo(IsPIC, Subtarget, MOHiFlag, MOLoFlag);
|
||||
|
||||
if (isPIC && Subtarget.isSVR4ABI()) {
|
||||
if (IsPIC && Subtarget.isSVR4ABI()) {
|
||||
SDValue GA = DAG.getTargetConstantPool(C, PtrVT, CP->getAlignment(),
|
||||
PPCII::MO_PIC_FLAG);
|
||||
return getTOCEntry(DAG, SDLoc(CP), false, GA);
|
||||
@ -2063,7 +2058,7 @@ SDValue PPCTargetLowering::LowerConstantPool(SDValue Op,
|
||||
DAG.getTargetConstantPool(C, PtrVT, CP->getAlignment(), 0, MOHiFlag);
|
||||
SDValue CPILo =
|
||||
DAG.getTargetConstantPool(C, PtrVT, CP->getAlignment(), 0, MOLoFlag);
|
||||
return LowerLabelRef(CPIHi, CPILo, isPIC, DAG);
|
||||
return LowerLabelRef(CPIHi, CPILo, IsPIC, DAG);
|
||||
}
|
||||
|
||||
SDValue PPCTargetLowering::LowerJumpTable(SDValue Op, SelectionDAG &DAG) const {
|
||||
@ -2079,10 +2074,10 @@ SDValue PPCTargetLowering::LowerJumpTable(SDValue Op, SelectionDAG &DAG) const {
|
||||
}
|
||||
|
||||
unsigned MOHiFlag, MOLoFlag;
|
||||
bool isPIC =
|
||||
GetLabelAccessInfo(DAG.getTarget(), Subtarget, MOHiFlag, MOLoFlag);
|
||||
bool IsPIC = isPositionIndependent();
|
||||
getLabelAccessInfo(IsPIC, Subtarget, MOHiFlag, MOLoFlag);
|
||||
|
||||
if (isPIC && Subtarget.isSVR4ABI()) {
|
||||
if (IsPIC && Subtarget.isSVR4ABI()) {
|
||||
SDValue GA = DAG.getTargetJumpTable(JT->getIndex(), PtrVT,
|
||||
PPCII::MO_PIC_FLAG);
|
||||
return getTOCEntry(DAG, SDLoc(GA), false, GA);
|
||||
@ -2090,7 +2085,7 @@ SDValue PPCTargetLowering::LowerJumpTable(SDValue Op, SelectionDAG &DAG) const {
|
||||
|
||||
SDValue JTIHi = DAG.getTargetJumpTable(JT->getIndex(), PtrVT, MOHiFlag);
|
||||
SDValue JTILo = DAG.getTargetJumpTable(JT->getIndex(), PtrVT, MOLoFlag);
|
||||
return LowerLabelRef(JTIHi, JTILo, isPIC, DAG);
|
||||
return LowerLabelRef(JTIHi, JTILo, IsPIC, DAG);
|
||||
}
|
||||
|
||||
SDValue PPCTargetLowering::LowerBlockAddress(SDValue Op,
|
||||
@ -2108,11 +2103,11 @@ SDValue PPCTargetLowering::LowerBlockAddress(SDValue Op,
|
||||
}
|
||||
|
||||
unsigned MOHiFlag, MOLoFlag;
|
||||
bool isPIC =
|
||||
GetLabelAccessInfo(DAG.getTarget(), Subtarget, MOHiFlag, MOLoFlag);
|
||||
bool IsPIC = isPositionIndependent();
|
||||
getLabelAccessInfo(IsPIC, Subtarget, MOHiFlag, MOLoFlag);
|
||||
SDValue TgtBAHi = DAG.getTargetBlockAddress(BA, PtrVT, 0, MOHiFlag);
|
||||
SDValue TgtBALo = DAG.getTargetBlockAddress(BA, PtrVT, 0, MOLoFlag);
|
||||
return LowerLabelRef(TgtBAHi, TgtBALo, isPIC, DAG);
|
||||
return LowerLabelRef(TgtBAHi, TgtBALo, IsPIC, DAG);
|
||||
}
|
||||
|
||||
SDValue PPCTargetLowering::LowerGlobalTLSAddress(SDValue Op,
|
||||
@ -2221,10 +2216,10 @@ SDValue PPCTargetLowering::LowerGlobalAddress(SDValue Op,
|
||||
}
|
||||
|
||||
unsigned MOHiFlag, MOLoFlag;
|
||||
bool isPIC =
|
||||
GetLabelAccessInfo(DAG.getTarget(), Subtarget, MOHiFlag, MOLoFlag, GV);
|
||||
bool IsPIC = isPositionIndependent();
|
||||
getLabelAccessInfo(IsPIC, Subtarget, MOHiFlag, MOLoFlag, GV);
|
||||
|
||||
if (isPIC && Subtarget.isSVR4ABI()) {
|
||||
if (IsPIC && Subtarget.isSVR4ABI()) {
|
||||
SDValue GA = DAG.getTargetGlobalAddress(GV, DL, PtrVT,
|
||||
GSDN->getOffset(),
|
||||
PPCII::MO_PIC_FLAG);
|
||||
@ -2236,7 +2231,7 @@ SDValue PPCTargetLowering::LowerGlobalAddress(SDValue Op,
|
||||
SDValue GALo =
|
||||
DAG.getTargetGlobalAddress(GV, DL, PtrVT, GSDN->getOffset(), MOLoFlag);
|
||||
|
||||
SDValue Ptr = LowerLabelRef(GAHi, GALo, isPIC, DAG);
|
||||
SDValue Ptr = LowerLabelRef(GAHi, GALo, IsPIC, DAG);
|
||||
|
||||
// If the global reference is actually to a non-lazy-pointer, we have to do an
|
||||
// extra load to get the address of the global.
|
||||
|
Loading…
Reference in New Issue
Block a user