mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[SelectionDAG] Use Align/MaybeAlign for ConstantPoolSDNode.
This patch stores the alignment for ConstantPoolSDNode as an Align and updates the getConstantPool interface to take a MaybeAlign. Removing getAlignment() will be done as a follow up. Differential Revision: https://reviews.llvm.org/D79436
This commit is contained in:
parent
2638bb464c
commit
6cffa34898
@ -662,18 +662,19 @@ public:
|
||||
SDValue getTargetJumpTable(int JTI, EVT VT, unsigned TargetFlags = 0) {
|
||||
return getJumpTable(JTI, VT, true, TargetFlags);
|
||||
}
|
||||
SDValue getConstantPool(const Constant *C, EVT VT, unsigned Align = 0,
|
||||
SDValue getConstantPool(const Constant *C, EVT VT, MaybeAlign Align = None,
|
||||
int Offs = 0, bool isT = false,
|
||||
unsigned TargetFlags = 0);
|
||||
SDValue getTargetConstantPool(const Constant *C, EVT VT, unsigned Align = 0,
|
||||
int Offset = 0, unsigned TargetFlags = 0) {
|
||||
SDValue getTargetConstantPool(const Constant *C, EVT VT,
|
||||
MaybeAlign Align = None, int Offset = 0,
|
||||
unsigned TargetFlags = 0) {
|
||||
return getConstantPool(C, VT, Align, Offset, true, TargetFlags);
|
||||
}
|
||||
SDValue getConstantPool(MachineConstantPoolValue *C, EVT VT,
|
||||
unsigned Align = 0, int Offs = 0, bool isT=false,
|
||||
unsigned TargetFlags = 0);
|
||||
MaybeAlign Align = None, int Offs = 0,
|
||||
bool isT = false, unsigned TargetFlags = 0);
|
||||
SDValue getTargetConstantPool(MachineConstantPoolValue *C, EVT VT,
|
||||
unsigned Align = 0, int Offset = 0,
|
||||
MaybeAlign Align = None, int Offset = 0,
|
||||
unsigned TargetFlags = 0) {
|
||||
return getConstantPool(C, VT, Align, Offset, true, TargetFlags);
|
||||
}
|
||||
|
@ -1811,23 +1811,23 @@ class ConstantPoolSDNode : public SDNode {
|
||||
MachineConstantPoolValue *MachineCPVal;
|
||||
} Val;
|
||||
int Offset; // It's a MachineConstantPoolValue if top bit is set.
|
||||
unsigned Alignment; // Minimum alignment requirement of CP (not log2 value).
|
||||
Align Alignment; // Minimum alignment requirement of CP.
|
||||
unsigned TargetFlags;
|
||||
|
||||
ConstantPoolSDNode(bool isTarget, const Constant *c, EVT VT, int o,
|
||||
unsigned Align, unsigned TF)
|
||||
: SDNode(isTarget ? ISD::TargetConstantPool : ISD::ConstantPool, 0,
|
||||
DebugLoc(), getSDVTList(VT)), Offset(o), Alignment(Align),
|
||||
TargetFlags(TF) {
|
||||
Align Alignment, unsigned TF)
|
||||
: SDNode(isTarget ? ISD::TargetConstantPool : ISD::ConstantPool, 0,
|
||||
DebugLoc(), getSDVTList(VT)),
|
||||
Offset(o), Alignment(Alignment), TargetFlags(TF) {
|
||||
assert(Offset >= 0 && "Offset is too large");
|
||||
Val.ConstVal = c;
|
||||
}
|
||||
|
||||
ConstantPoolSDNode(bool isTarget, MachineConstantPoolValue *v,
|
||||
EVT VT, int o, unsigned Align, unsigned TF)
|
||||
: SDNode(isTarget ? ISD::TargetConstantPool : ISD::ConstantPool, 0,
|
||||
DebugLoc(), getSDVTList(VT)), Offset(o), Alignment(Align),
|
||||
TargetFlags(TF) {
|
||||
ConstantPoolSDNode(bool isTarget, MachineConstantPoolValue *v, EVT VT, int o,
|
||||
Align Alignment, unsigned TF)
|
||||
: SDNode(isTarget ? ISD::TargetConstantPool : ISD::ConstantPool, 0,
|
||||
DebugLoc(), getSDVTList(VT)),
|
||||
Offset(o), Alignment(Alignment), TargetFlags(TF) {
|
||||
assert(Offset >= 0 && "Offset is too large");
|
||||
Val.MachineCPVal = v;
|
||||
Offset |= 1 << (sizeof(unsigned)*CHAR_BIT-1);
|
||||
@ -1854,7 +1854,9 @@ public:
|
||||
|
||||
// Return the alignment of this constant pool object, which is either 0 (for
|
||||
// default alignment) or the desired value.
|
||||
unsigned getAlignment() const { return Alignment; }
|
||||
Align getAlign() const { return Alignment; }
|
||||
// TODO: Remove once transition to getAlign is over.
|
||||
unsigned getAlignment() const { return Alignment.value(); }
|
||||
unsigned getTargetFlags() const { return TargetFlags; }
|
||||
|
||||
Type *getType() const;
|
||||
|
@ -20919,8 +20919,8 @@ SDValue DAGCombiner::convertSelectOfFPConstantsToLoadOffset(
|
||||
// Create a ConstantArray of the two constants.
|
||||
Constant *CA = ConstantArray::get(ArrayType::get(FPTy, 2), Elts);
|
||||
SDValue CPIdx = DAG.getConstantPool(CA, TLI.getPointerTy(DAG.getDataLayout()),
|
||||
TD.getPrefTypeAlignment(FPTy));
|
||||
unsigned Alignment = cast<ConstantPoolSDNode>(CPIdx)->getAlignment();
|
||||
TD.getPrefTypeAlign(FPTy));
|
||||
Align Alignment = cast<ConstantPoolSDNode>(CPIdx)->getAlign();
|
||||
|
||||
// Get offsets to the 0 and 1 elements of the array, so we can select between
|
||||
// them.
|
||||
|
@ -543,7 +543,7 @@ static void AddNodeIDCustom(FoldingSetNodeID &ID, const SDNode *N) {
|
||||
case ISD::ConstantPool:
|
||||
case ISD::TargetConstantPool: {
|
||||
const ConstantPoolSDNode *CP = cast<ConstantPoolSDNode>(N);
|
||||
ID.AddInteger(CP->getAlignment());
|
||||
ID.AddInteger(CP->getAlign().value());
|
||||
ID.AddInteger(CP->getOffset());
|
||||
if (CP->isMachineConstantPoolEntry())
|
||||
CP->getMachineCPVal()->addSelectionDAGCSEId(ID);
|
||||
@ -1471,19 +1471,18 @@ SDValue SelectionDAG::getJumpTable(int JTI, EVT VT, bool isTarget,
|
||||
}
|
||||
|
||||
SDValue SelectionDAG::getConstantPool(const Constant *C, EVT VT,
|
||||
unsigned Alignment, int Offset,
|
||||
bool isTarget,
|
||||
unsigned TargetFlags) {
|
||||
MaybeAlign Alignment, int Offset,
|
||||
bool isTarget, unsigned TargetFlags) {
|
||||
assert((TargetFlags == 0 || isTarget) &&
|
||||
"Cannot set target flags on target-independent globals");
|
||||
if (Alignment == 0)
|
||||
if (!Alignment)
|
||||
Alignment = shouldOptForSize()
|
||||
? getDataLayout().getABITypeAlignment(C->getType())
|
||||
: getDataLayout().getPrefTypeAlignment(C->getType());
|
||||
? getDataLayout().getABITypeAlign(C->getType())
|
||||
: getDataLayout().getPrefTypeAlign(C->getType());
|
||||
unsigned Opc = isTarget ? ISD::TargetConstantPool : ISD::ConstantPool;
|
||||
FoldingSetNodeID ID;
|
||||
AddNodeIDNode(ID, Opc, getVTList(VT), None);
|
||||
ID.AddInteger(Alignment);
|
||||
ID.AddInteger(Alignment->value());
|
||||
ID.AddInteger(Offset);
|
||||
ID.AddPointer(C);
|
||||
ID.AddInteger(TargetFlags);
|
||||
@ -1491,25 +1490,26 @@ SDValue SelectionDAG::getConstantPool(const Constant *C, EVT VT,
|
||||
if (SDNode *E = FindNodeOrInsertPos(ID, IP))
|
||||
return SDValue(E, 0);
|
||||
|
||||
auto *N = newSDNode<ConstantPoolSDNode>(isTarget, C, VT, Offset, Alignment,
|
||||
auto *N = newSDNode<ConstantPoolSDNode>(isTarget, C, VT, Offset, *Alignment,
|
||||
TargetFlags);
|
||||
CSEMap.InsertNode(N, IP);
|
||||
InsertNode(N);
|
||||
return SDValue(N, 0);
|
||||
SDValue V = SDValue(N, 0);
|
||||
NewSDValueDbgMsg(V, "Creating new constant pool: ", this);
|
||||
return V;
|
||||
}
|
||||
|
||||
SDValue SelectionDAG::getConstantPool(MachineConstantPoolValue *C, EVT VT,
|
||||
unsigned Alignment, int Offset,
|
||||
bool isTarget,
|
||||
unsigned TargetFlags) {
|
||||
MaybeAlign Alignment, int Offset,
|
||||
bool isTarget, unsigned TargetFlags) {
|
||||
assert((TargetFlags == 0 || isTarget) &&
|
||||
"Cannot set target flags on target-independent globals");
|
||||
if (Alignment == 0)
|
||||
Alignment = getDataLayout().getPrefTypeAlignment(C->getType());
|
||||
if (!Alignment)
|
||||
Alignment = getDataLayout().getPrefTypeAlign(C->getType());
|
||||
unsigned Opc = isTarget ? ISD::TargetConstantPool : ISD::ConstantPool;
|
||||
FoldingSetNodeID ID;
|
||||
AddNodeIDNode(ID, Opc, getVTList(VT), None);
|
||||
ID.AddInteger(Alignment);
|
||||
ID.AddInteger(Alignment->value());
|
||||
ID.AddInteger(Offset);
|
||||
C->addSelectionDAGCSEId(ID);
|
||||
ID.AddInteger(TargetFlags);
|
||||
@ -1517,7 +1517,7 @@ SDValue SelectionDAG::getConstantPool(MachineConstantPoolValue *C, EVT VT,
|
||||
if (SDNode *E = FindNodeOrInsertPos(ID, IP))
|
||||
return SDValue(E, 0);
|
||||
|
||||
auto *N = newSDNode<ConstantPoolSDNode>(isTarget, C, VT, Offset, Alignment,
|
||||
auto *N = newSDNode<ConstantPoolSDNode>(isTarget, C, VT, Offset, *Alignment,
|
||||
TargetFlags);
|
||||
CSEMap.InsertNode(N, IP);
|
||||
InsertNode(N);
|
||||
|
@ -4675,7 +4675,7 @@ SDValue AArch64TargetLowering::getTargetNode(JumpTableSDNode *N, EVT Ty,
|
||||
SDValue AArch64TargetLowering::getTargetNode(ConstantPoolSDNode *N, EVT Ty,
|
||||
SelectionDAG &DAG,
|
||||
unsigned Flag) const {
|
||||
return DAG.getTargetConstantPool(N->getConstVal(), Ty, N->getAlignment(),
|
||||
return DAG.getTargetConstantPool(N->getConstVal(), Ty, N->getAlign(),
|
||||
N->getOffset(), Flag);
|
||||
}
|
||||
|
||||
|
@ -2359,7 +2359,7 @@ ARMTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
|
||||
ARMConstantPoolConstant::Create(GV, ARMPCLabelIndex, ARMCP::CPValue, 0);
|
||||
|
||||
// Get the address of the callee into a register
|
||||
SDValue CPAddr = DAG.getTargetConstantPool(CPV, PtrVt, 4);
|
||||
SDValue CPAddr = DAG.getTargetConstantPool(CPV, PtrVt, Align(4));
|
||||
CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr);
|
||||
Callee = DAG.getLoad(
|
||||
PtrVt, dl, DAG.getEntryNode(), CPAddr,
|
||||
@ -2373,7 +2373,7 @@ ARMTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
|
||||
ARMConstantPoolSymbol::Create(*DAG.getContext(), Sym,
|
||||
ARMPCLabelIndex, 0);
|
||||
// Get the address of the callee into a register
|
||||
SDValue CPAddr = DAG.getTargetConstantPool(CPV, PtrVt, 4);
|
||||
SDValue CPAddr = DAG.getTargetConstantPool(CPV, PtrVt, Align(4));
|
||||
CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr);
|
||||
Callee = DAG.getLoad(
|
||||
PtrVt, dl, DAG.getEntryNode(), CPAddr,
|
||||
@ -2425,7 +2425,7 @@ ARMTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
|
||||
ARMConstantPoolValue *CPV =
|
||||
ARMConstantPoolSymbol::Create(*DAG.getContext(), Sym,
|
||||
ARMPCLabelIndex, 4);
|
||||
SDValue CPAddr = DAG.getTargetConstantPool(CPV, PtrVt, 4);
|
||||
SDValue CPAddr = DAG.getTargetConstantPool(CPV, PtrVt, Align(4));
|
||||
CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr);
|
||||
Callee = DAG.getLoad(
|
||||
PtrVt, dl, DAG.getEntryNode(), CPAddr,
|
||||
@ -3074,11 +3074,10 @@ SDValue ARMTargetLowering::LowerConstantPool(SDValue Op,
|
||||
}
|
||||
|
||||
if (CP->isMachineConstantPoolEntry())
|
||||
Res = DAG.getTargetConstantPool(CP->getMachineCPVal(), PtrVT,
|
||||
CP->getAlignment());
|
||||
Res =
|
||||
DAG.getTargetConstantPool(CP->getMachineCPVal(), PtrVT, CP->getAlign());
|
||||
else
|
||||
Res = DAG.getTargetConstantPool(CP->getConstVal(), PtrVT,
|
||||
CP->getAlignment());
|
||||
Res = DAG.getTargetConstantPool(CP->getConstVal(), PtrVT, CP->getAlign());
|
||||
return DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, Res);
|
||||
}
|
||||
|
||||
@ -3097,14 +3096,14 @@ SDValue ARMTargetLowering::LowerBlockAddress(SDValue Op,
|
||||
SDValue CPAddr;
|
||||
bool IsPositionIndependent = isPositionIndependent() || Subtarget->isROPI();
|
||||
if (!IsPositionIndependent) {
|
||||
CPAddr = DAG.getTargetConstantPool(BA, PtrVT, 4);
|
||||
CPAddr = DAG.getTargetConstantPool(BA, PtrVT, Align(4));
|
||||
} else {
|
||||
unsigned PCAdj = Subtarget->isThumb() ? 4 : 8;
|
||||
ARMPCLabelIndex = AFI->createPICLabelUId();
|
||||
ARMConstantPoolValue *CPV =
|
||||
ARMConstantPoolConstant::Create(BA, ARMPCLabelIndex,
|
||||
ARMCP::CPBlockAddress, PCAdj);
|
||||
CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, 4);
|
||||
CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, Align(4));
|
||||
}
|
||||
CPAddr = DAG.getNode(ARMISD::Wrapper, DL, PtrVT, CPAddr);
|
||||
SDValue Result = DAG.getLoad(
|
||||
@ -3233,8 +3232,9 @@ ARMTargetLowering::LowerGlobalTLSAddressWindows(SDValue Op,
|
||||
const auto *GA = cast<GlobalAddressSDNode>(Op);
|
||||
auto *CPV = ARMConstantPoolConstant::Create(GA->getGlobal(), ARMCP::SECREL);
|
||||
SDValue Offset = DAG.getLoad(
|
||||
PtrVT, DL, Chain, DAG.getNode(ARMISD::Wrapper, DL, MVT::i32,
|
||||
DAG.getTargetConstantPool(CPV, PtrVT, 4)),
|
||||
PtrVT, DL, Chain,
|
||||
DAG.getNode(ARMISD::Wrapper, DL, MVT::i32,
|
||||
DAG.getTargetConstantPool(CPV, PtrVT, Align(4))),
|
||||
MachinePointerInfo::getConstantPool(DAG.getMachineFunction()));
|
||||
|
||||
return DAG.getNode(ISD::ADD, DL, PtrVT, TLS, Offset);
|
||||
@ -3253,7 +3253,7 @@ ARMTargetLowering::LowerToTLSGeneralDynamicModel(GlobalAddressSDNode *GA,
|
||||
ARMConstantPoolValue *CPV =
|
||||
ARMConstantPoolConstant::Create(GA->getGlobal(), ARMPCLabelIndex,
|
||||
ARMCP::CPValue, PCAdj, ARMCP::TLSGD, true);
|
||||
SDValue Argument = DAG.getTargetConstantPool(CPV, PtrVT, 4);
|
||||
SDValue Argument = DAG.getTargetConstantPool(CPV, PtrVT, Align(4));
|
||||
Argument = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, Argument);
|
||||
Argument = DAG.getLoad(
|
||||
PtrVT, dl, DAG.getEntryNode(), Argument,
|
||||
@ -3304,7 +3304,7 @@ ARMTargetLowering::LowerToTLSExecModels(GlobalAddressSDNode *GA,
|
||||
ARMConstantPoolConstant::Create(GA->getGlobal(), ARMPCLabelIndex,
|
||||
ARMCP::CPValue, PCAdj, ARMCP::GOTTPOFF,
|
||||
true);
|
||||
Offset = DAG.getTargetConstantPool(CPV, PtrVT, 4);
|
||||
Offset = DAG.getTargetConstantPool(CPV, PtrVT, Align(4));
|
||||
Offset = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, Offset);
|
||||
Offset = DAG.getLoad(
|
||||
PtrVT, dl, Chain, Offset,
|
||||
@ -3322,7 +3322,7 @@ ARMTargetLowering::LowerToTLSExecModels(GlobalAddressSDNode *GA,
|
||||
assert(model == TLSModel::LocalExec);
|
||||
ARMConstantPoolValue *CPV =
|
||||
ARMConstantPoolConstant::Create(GV, ARMCP::TPOFF);
|
||||
Offset = DAG.getTargetConstantPool(CPV, PtrVT, 4);
|
||||
Offset = DAG.getTargetConstantPool(CPV, PtrVT, Align(4));
|
||||
Offset = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, Offset);
|
||||
Offset = DAG.getLoad(
|
||||
PtrVT, dl, Chain, Offset,
|
||||
@ -3425,11 +3425,11 @@ static SDValue promoteToConstantPool(const ARMTargetLowering *TLI,
|
||||
// that are strings for simplicity.
|
||||
auto *CDAInit = dyn_cast<ConstantDataArray>(Init);
|
||||
unsigned Size = DAG.getDataLayout().getTypeAllocSize(Init->getType());
|
||||
unsigned Align = DAG.getDataLayout().getPreferredAlignment(GVar);
|
||||
unsigned PrefAlign = DAG.getDataLayout().getPreferredAlignment(GVar);
|
||||
unsigned RequiredPadding = 4 - (Size % 4);
|
||||
bool PaddingPossible =
|
||||
RequiredPadding == 4 || (CDAInit && CDAInit->isString());
|
||||
if (!PaddingPossible || Align > 4 || Size > ConstpoolPromotionMaxSize ||
|
||||
if (!PaddingPossible || PrefAlign > 4 || Size > ConstpoolPromotionMaxSize ||
|
||||
Size == 0)
|
||||
return SDValue();
|
||||
|
||||
@ -3468,8 +3468,7 @@ static SDValue promoteToConstantPool(const ARMTargetLowering *TLI,
|
||||
}
|
||||
|
||||
auto CPVal = ARMConstantPoolConstant::Create(GVar, Init);
|
||||
SDValue CPAddr =
|
||||
DAG.getTargetConstantPool(CPVal, PtrVT, /*Align=*/4);
|
||||
SDValue CPAddr = DAG.getTargetConstantPool(CPVal, PtrVT, Align(4));
|
||||
if (!AFI->getGlobalsPromotedToConstantPool().count(GVar)) {
|
||||
AFI->markGlobalAsPromotedToConstantPool(GVar);
|
||||
AFI->setPromotedConstpoolIncrease(AFI->getPromotedConstpoolIncrease() +
|
||||
@ -3539,7 +3538,7 @@ SDValue ARMTargetLowering::LowerGlobalAddressELF(SDValue Op,
|
||||
} else { // use literal pool for address constant
|
||||
ARMConstantPoolValue *CPV =
|
||||
ARMConstantPoolConstant::Create(GV, ARMCP::SBREL);
|
||||
SDValue CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, 4);
|
||||
SDValue CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, Align(4));
|
||||
CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr);
|
||||
RelAddr = DAG.getLoad(
|
||||
PtrVT, dl, DAG.getEntryNode(), CPAddr,
|
||||
@ -3559,7 +3558,7 @@ SDValue ARMTargetLowering::LowerGlobalAddressELF(SDValue Op,
|
||||
return DAG.getNode(ARMISD::Wrapper, dl, PtrVT,
|
||||
DAG.getTargetGlobalAddress(GV, dl, PtrVT));
|
||||
} else {
|
||||
SDValue CPAddr = DAG.getTargetConstantPool(GV, PtrVT, 4);
|
||||
SDValue CPAddr = DAG.getTargetConstantPool(GV, PtrVT, Align(4));
|
||||
CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr);
|
||||
return DAG.getLoad(
|
||||
PtrVT, dl, DAG.getEntryNode(), CPAddr,
|
||||
@ -3754,7 +3753,7 @@ ARMTargetLowering::LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG,
|
||||
ARMConstantPoolValue *CPV =
|
||||
ARMConstantPoolConstant::Create(&MF.getFunction(), ARMPCLabelIndex,
|
||||
ARMCP::CPLSDA, PCAdj);
|
||||
CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, 4);
|
||||
CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, Align(4));
|
||||
CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr);
|
||||
SDValue Result = DAG.getLoad(
|
||||
PtrVT, dl, DAG.getEntryNode(), CPAddr,
|
||||
|
@ -1098,19 +1098,20 @@ HexagonTargetLowering::LowerConstantPool(SDValue Op, SelectionDAG &DAG) const {
|
||||
isVTi1Type = true;
|
||||
}
|
||||
}
|
||||
unsigned Align = CPN->getAlignment();
|
||||
Align Alignment = CPN->getAlign();
|
||||
bool IsPositionIndependent = isPositionIndependent();
|
||||
unsigned char TF = IsPositionIndependent ? HexagonII::MO_PCREL : 0;
|
||||
|
||||
unsigned Offset = 0;
|
||||
SDValue T;
|
||||
if (CPN->isMachineConstantPoolEntry())
|
||||
T = DAG.getTargetConstantPool(CPN->getMachineCPVal(), ValTy, Align, Offset,
|
||||
TF);
|
||||
T = DAG.getTargetConstantPool(CPN->getMachineCPVal(), ValTy, Alignment,
|
||||
Offset, TF);
|
||||
else if (isVTi1Type)
|
||||
T = DAG.getTargetConstantPool(CVal, ValTy, Align, Offset, TF);
|
||||
T = DAG.getTargetConstantPool(CVal, ValTy, Alignment, Offset, TF);
|
||||
else
|
||||
T = DAG.getTargetConstantPool(CPN->getConstVal(), ValTy, Align, Offset, TF);
|
||||
T = DAG.getTargetConstantPool(CPN->getConstVal(), ValTy, Alignment, Offset,
|
||||
TF);
|
||||
|
||||
assert(cast<ConstantPoolSDNode>(T)->getTargetFlags() == TF &&
|
||||
"Inconsistent target flag encountered");
|
||||
|
@ -445,10 +445,11 @@ HexagonTargetLowering::buildHvxVectorReg(ArrayRef<SDValue> Values,
|
||||
ArrayRef<Constant*> Tmp((Constant**)Consts.begin(),
|
||||
(Constant**)Consts.end());
|
||||
Constant *CV = ConstantVector::get(Tmp);
|
||||
unsigned Align = HwLen;
|
||||
SDValue CP = LowerConstantPool(DAG.getConstantPool(CV, VecTy, Align), DAG);
|
||||
Align Alignment(HwLen);
|
||||
SDValue CP =
|
||||
LowerConstantPool(DAG.getConstantPool(CV, VecTy, Alignment), DAG);
|
||||
return DAG.getLoad(VecTy, dl, DAG.getEntryNode(), CP,
|
||||
MachinePointerInfo::getConstantPool(MF), Align);
|
||||
MachinePointerInfo::getConstantPool(MF), Alignment);
|
||||
}
|
||||
|
||||
// A special case is a situation where the vector is built entirely from
|
||||
@ -1090,10 +1091,12 @@ HexagonTargetLowering::compressHvxPred(SDValue VecQ, const SDLoc &dl,
|
||||
Tmp.push_back(ConstantInt::get(Int8Ty, 1ull << j));
|
||||
}
|
||||
Constant *CV = ConstantVector::get(Tmp);
|
||||
unsigned Align = HwLen;
|
||||
SDValue CP = LowerConstantPool(DAG.getConstantPool(CV, ByteTy, Align), DAG);
|
||||
SDValue Bytes = DAG.getLoad(ByteTy, dl, DAG.getEntryNode(), CP,
|
||||
MachinePointerInfo::getConstantPool(MF), Align);
|
||||
Align Alignment(HwLen);
|
||||
SDValue CP =
|
||||
LowerConstantPool(DAG.getConstantPool(CV, ByteTy, Alignment), DAG);
|
||||
SDValue Bytes =
|
||||
DAG.getLoad(ByteTy, dl, DAG.getEntryNode(), CP,
|
||||
MachinePointerInfo::getConstantPool(MF), Alignment);
|
||||
|
||||
// Select the bytes that correspond to true bits in the vector predicate.
|
||||
SDValue Sel = DAG.getSelect(dl, VecTy, VecQ, DAG.getBitcast(VecTy, Bytes),
|
||||
|
@ -1136,7 +1136,7 @@ SDValue LanaiTargetLowering::LowerConstantPool(SDValue Op,
|
||||
if (getTargetMachine().getCodeModel() == CodeModel::Small ||
|
||||
TLOF->isConstantInSmallSection(DAG.getDataLayout(), C)) {
|
||||
SDValue Small = DAG.getTargetConstantPool(
|
||||
C, MVT::i32, N->getAlignment(), N->getOffset(), LanaiII::MO_NO_FLAG);
|
||||
C, MVT::i32, N->getAlign(), N->getOffset(), LanaiII::MO_NO_FLAG);
|
||||
return DAG.getNode(ISD::OR, DL, MVT::i32,
|
||||
DAG.getRegister(Lanai::R0, MVT::i32),
|
||||
DAG.getNode(LanaiISD::SMALL, DL, MVT::i32, Small));
|
||||
@ -1144,9 +1144,9 @@ SDValue LanaiTargetLowering::LowerConstantPool(SDValue Op,
|
||||
uint8_t OpFlagHi = LanaiII::MO_ABS_HI;
|
||||
uint8_t OpFlagLo = LanaiII::MO_ABS_LO;
|
||||
|
||||
SDValue Hi = DAG.getTargetConstantPool(C, MVT::i32, N->getAlignment(),
|
||||
SDValue Hi = DAG.getTargetConstantPool(C, MVT::i32, N->getAlign(),
|
||||
N->getOffset(), OpFlagHi);
|
||||
SDValue Lo = DAG.getTargetConstantPool(C, MVT::i32, N->getAlignment(),
|
||||
SDValue Lo = DAG.getTargetConstantPool(C, MVT::i32, N->getAlign(),
|
||||
N->getOffset(), OpFlagLo);
|
||||
Hi = DAG.getNode(LanaiISD::HI, DL, MVT::i32, Hi);
|
||||
Lo = DAG.getNode(LanaiISD::LO, DL, MVT::i32, Lo);
|
||||
|
@ -263,8 +263,8 @@ bool MSP430DAGToDAGISel::SelectAddr(SDValue N,
|
||||
MVT::i16, AM.Disp,
|
||||
0/*AM.SymbolFlags*/);
|
||||
else if (AM.CP)
|
||||
Disp = CurDAG->getTargetConstantPool(AM.CP, MVT::i16,
|
||||
AM.Align, AM.Disp, 0/*AM.SymbolFlags*/);
|
||||
Disp = CurDAG->getTargetConstantPool(AM.CP, MVT::i16, Align(AM.Align),
|
||||
AM.Disp, 0 /*AM.SymbolFlags*/);
|
||||
else if (AM.ES)
|
||||
Disp = CurDAG->getTargetExternalSymbol(AM.ES, MVT::i16, 0/*AM.SymbolFlags*/);
|
||||
else if (AM.JT != -1)
|
||||
|
@ -173,7 +173,7 @@ SDValue MipsTargetLowering::getTargetNode(JumpTableSDNode *N, EVT Ty,
|
||||
SDValue MipsTargetLowering::getTargetNode(ConstantPoolSDNode *N, EVT Ty,
|
||||
SelectionDAG &DAG,
|
||||
unsigned Flag) const {
|
||||
return DAG.getTargetConstantPool(N->getConstVal(), Ty, N->getAlignment(),
|
||||
return DAG.getTargetConstantPool(N->getConstVal(), Ty, N->getAlign(),
|
||||
N->getOffset(), Flag);
|
||||
}
|
||||
|
||||
|
@ -6736,8 +6736,7 @@ void PPCDAGToDAGISel::PeepholePPC64() {
|
||||
} else if (ConstantPoolSDNode *CP =
|
||||
dyn_cast<ConstantPoolSDNode>(ImmOpnd)) {
|
||||
const Constant *C = CP->getConstVal();
|
||||
ImmOpnd = CurDAG->getTargetConstantPool(C, MVT::i64,
|
||||
CP->getAlignment(),
|
||||
ImmOpnd = CurDAG->getTargetConstantPool(C, MVT::i64, CP->getAlign(),
|
||||
Offset, Flags);
|
||||
}
|
||||
}
|
||||
|
@ -2817,14 +2817,12 @@ SDValue PPCTargetLowering::LowerConstantPool(SDValue Op,
|
||||
if (Subtarget.isUsingPCRelativeCalls()) {
|
||||
SDLoc DL(CP);
|
||||
EVT Ty = getPointerTy(DAG.getDataLayout());
|
||||
SDValue ConstPool = DAG.getTargetConstantPool(C, Ty,
|
||||
CP->getAlignment(),
|
||||
CP->getOffset(),
|
||||
PPCII::MO_PCREL_FLAG);
|
||||
SDValue ConstPool = DAG.getTargetConstantPool(
|
||||
C, Ty, CP->getAlign(), CP->getOffset(), PPCII::MO_PCREL_FLAG);
|
||||
return DAG.getNode(PPCISD::MAT_PCREL_ADDR, DL, Ty, ConstPool);
|
||||
}
|
||||
setUsesTOCBasePtr(DAG);
|
||||
SDValue GA = DAG.getTargetConstantPool(C, PtrVT, CP->getAlignment(), 0);
|
||||
SDValue GA = DAG.getTargetConstantPool(C, PtrVT, CP->getAlign(), 0);
|
||||
return getTOCEntry(DAG, SDLoc(CP), GA);
|
||||
}
|
||||
|
||||
@ -2833,15 +2831,15 @@ SDValue PPCTargetLowering::LowerConstantPool(SDValue Op,
|
||||
getLabelAccessInfo(IsPIC, Subtarget, MOHiFlag, MOLoFlag);
|
||||
|
||||
if (IsPIC && Subtarget.isSVR4ABI()) {
|
||||
SDValue GA = DAG.getTargetConstantPool(C, PtrVT, CP->getAlignment(),
|
||||
PPCII::MO_PIC_FLAG);
|
||||
SDValue GA =
|
||||
DAG.getTargetConstantPool(C, PtrVT, CP->getAlign(), PPCII::MO_PIC_FLAG);
|
||||
return getTOCEntry(DAG, SDLoc(CP), GA);
|
||||
}
|
||||
|
||||
SDValue CPIHi =
|
||||
DAG.getTargetConstantPool(C, PtrVT, CP->getAlignment(), 0, MOHiFlag);
|
||||
DAG.getTargetConstantPool(C, PtrVT, CP->getAlign(), 0, MOHiFlag);
|
||||
SDValue CPILo =
|
||||
DAG.getTargetConstantPool(C, PtrVT, CP->getAlignment(), 0, MOLoFlag);
|
||||
DAG.getTargetConstantPool(C, PtrVT, CP->getAlign(), 0, MOLoFlag);
|
||||
return LowerLabelRef(CPIHi, CPILo, IsPIC, DAG);
|
||||
}
|
||||
|
||||
@ -9052,8 +9050,8 @@ SDValue PPCTargetLowering::LowerBUILD_VECTOR(SDValue Op,
|
||||
}
|
||||
|
||||
Constant *CP = ConstantVector::get(CV);
|
||||
SDValue CPIdx = DAG.getConstantPool(CP, getPointerTy(DAG.getDataLayout()),
|
||||
16 /* alignment */);
|
||||
SDValue CPIdx =
|
||||
DAG.getConstantPool(CP, getPointerTy(DAG.getDataLayout()), Align(16));
|
||||
|
||||
SDValue Ops[] = {DAG.getEntryNode(), CPIdx};
|
||||
SDVTList VTs = DAG.getVTList({MVT::v4i1, /*chain*/ MVT::Other});
|
||||
|
@ -448,7 +448,7 @@ static SDValue getTargetNode(BlockAddressSDNode *N, SDLoc DL, EVT Ty,
|
||||
|
||||
static SDValue getTargetNode(ConstantPoolSDNode *N, SDLoc DL, EVT Ty,
|
||||
SelectionDAG &DAG, unsigned Flags) {
|
||||
return DAG.getTargetConstantPool(N->getConstVal(), Ty, N->getAlignment(),
|
||||
return DAG.getTargetConstantPool(N->getConstVal(), Ty, N->getAlign(),
|
||||
N->getOffset(), Flags);
|
||||
}
|
||||
|
||||
|
@ -1906,10 +1906,8 @@ SDValue SparcTargetLowering::withTargetFlags(SDValue Op, unsigned TF,
|
||||
GA->getOffset(), TF);
|
||||
|
||||
if (const ConstantPoolSDNode *CP = dyn_cast<ConstantPoolSDNode>(Op))
|
||||
return DAG.getTargetConstantPool(CP->getConstVal(),
|
||||
CP->getValueType(0),
|
||||
CP->getAlignment(),
|
||||
CP->getOffset(), TF);
|
||||
return DAG.getTargetConstantPool(CP->getConstVal(), CP->getValueType(0),
|
||||
CP->getAlign(), CP->getOffset(), TF);
|
||||
|
||||
if (const BlockAddressSDNode *BA = dyn_cast<BlockAddressSDNode>(Op))
|
||||
return DAG.getTargetBlockAddress(BA->getBlockAddress(),
|
||||
|
@ -3128,7 +3128,7 @@ SDValue SystemZTargetLowering::lowerGlobalTLSAddress(GlobalAddressSDNode *Node,
|
||||
SystemZConstantPoolValue *CPV =
|
||||
SystemZConstantPoolValue::Create(GV, SystemZCP::TLSGD);
|
||||
|
||||
Offset = DAG.getConstantPool(CPV, PtrVT, 8);
|
||||
Offset = DAG.getConstantPool(CPV, PtrVT, Align(8));
|
||||
Offset = DAG.getLoad(
|
||||
PtrVT, DL, DAG.getEntryNode(), Offset,
|
||||
MachinePointerInfo::getConstantPool(DAG.getMachineFunction()));
|
||||
@ -3143,7 +3143,7 @@ SDValue SystemZTargetLowering::lowerGlobalTLSAddress(GlobalAddressSDNode *Node,
|
||||
SystemZConstantPoolValue *CPV =
|
||||
SystemZConstantPoolValue::Create(GV, SystemZCP::TLSLDM);
|
||||
|
||||
Offset = DAG.getConstantPool(CPV, PtrVT, 8);
|
||||
Offset = DAG.getConstantPool(CPV, PtrVT, Align(8));
|
||||
Offset = DAG.getLoad(
|
||||
PtrVT, DL, DAG.getEntryNode(), Offset,
|
||||
MachinePointerInfo::getConstantPool(DAG.getMachineFunction()));
|
||||
@ -3161,7 +3161,7 @@ SDValue SystemZTargetLowering::lowerGlobalTLSAddress(GlobalAddressSDNode *Node,
|
||||
// Add the per-symbol offset.
|
||||
CPV = SystemZConstantPoolValue::Create(GV, SystemZCP::DTPOFF);
|
||||
|
||||
SDValue DTPOffset = DAG.getConstantPool(CPV, PtrVT, 8);
|
||||
SDValue DTPOffset = DAG.getConstantPool(CPV, PtrVT, Align(8));
|
||||
DTPOffset = DAG.getLoad(
|
||||
PtrVT, DL, DAG.getEntryNode(), DTPOffset,
|
||||
MachinePointerInfo::getConstantPool(DAG.getMachineFunction()));
|
||||
@ -3186,7 +3186,7 @@ SDValue SystemZTargetLowering::lowerGlobalTLSAddress(GlobalAddressSDNode *Node,
|
||||
SystemZConstantPoolValue *CPV =
|
||||
SystemZConstantPoolValue::Create(GV, SystemZCP::NTPOFF);
|
||||
|
||||
Offset = DAG.getConstantPool(CPV, PtrVT, 8);
|
||||
Offset = DAG.getConstantPool(CPV, PtrVT, Align(8));
|
||||
Offset = DAG.getLoad(
|
||||
PtrVT, DL, DAG.getEntryNode(), Offset,
|
||||
MachinePointerInfo::getConstantPool(DAG.getMachineFunction()));
|
||||
@ -3227,11 +3227,11 @@ SDValue SystemZTargetLowering::lowerConstantPool(ConstantPoolSDNode *CP,
|
||||
|
||||
SDValue Result;
|
||||
if (CP->isMachineConstantPoolEntry())
|
||||
Result = DAG.getTargetConstantPool(CP->getMachineCPVal(), PtrVT,
|
||||
CP->getAlignment());
|
||||
Result =
|
||||
DAG.getTargetConstantPool(CP->getMachineCPVal(), PtrVT, CP->getAlign());
|
||||
else
|
||||
Result = DAG.getTargetConstantPool(CP->getConstVal(), PtrVT,
|
||||
CP->getAlignment(), CP->getOffset());
|
||||
Result = DAG.getTargetConstantPool(CP->getConstVal(), PtrVT, CP->getAlign(),
|
||||
CP->getOffset());
|
||||
|
||||
// Use LARL to load the address of the constant pool entry.
|
||||
return DAG.getNode(SystemZISD::PCREL_WRAPPER, DL, PtrVT, Result);
|
||||
|
@ -297,8 +297,8 @@ namespace {
|
||||
MVT::i32, AM.Disp,
|
||||
AM.SymbolFlags);
|
||||
else if (AM.CP)
|
||||
Disp = CurDAG->getTargetConstantPool(AM.CP, MVT::i32,
|
||||
AM.Align, AM.Disp, AM.SymbolFlags);
|
||||
Disp = CurDAG->getTargetConstantPool(AM.CP, MVT::i32, Align(AM.Align),
|
||||
AM.Disp, AM.SymbolFlags);
|
||||
else if (AM.ES) {
|
||||
assert(!AM.Disp && "Non-zero displacement is ignored with ES.");
|
||||
Disp = CurDAG->getTargetExternalSymbol(AM.ES, MVT::i32, AM.SymbolFlags);
|
||||
|
@ -18533,7 +18533,7 @@ X86TargetLowering::LowerConstantPool(SDValue Op, SelectionDAG &DAG) const {
|
||||
|
||||
auto PtrVT = getPointerTy(DAG.getDataLayout());
|
||||
SDValue Result = DAG.getTargetConstantPool(
|
||||
CP->getConstVal(), PtrVT, CP->getAlignment(), CP->getOffset(), OpFlag);
|
||||
CP->getConstVal(), PtrVT, CP->getAlign(), CP->getOffset(), OpFlag);
|
||||
SDLoc DL(CP);
|
||||
Result = DAG.getNode(getGlobalWrapperKind(), DL, PtrVT, Result);
|
||||
// With PIC, the address is actually $g + Offset.
|
||||
@ -19471,7 +19471,7 @@ static SDValue LowerUINT_TO_FP_i64(SDValue Op, SelectionDAG &DAG,
|
||||
static const uint32_t CV0[] = { 0x43300000, 0x45300000, 0, 0 };
|
||||
Constant *C0 = ConstantDataVector::get(*Context, CV0);
|
||||
auto PtrVT = DAG.getTargetLoweringInfo().getPointerTy(DAG.getDataLayout());
|
||||
SDValue CPIdx0 = DAG.getConstantPool(C0, PtrVT, 16);
|
||||
SDValue CPIdx0 = DAG.getConstantPool(C0, PtrVT, Align(16));
|
||||
|
||||
SmallVector<Constant*,2> CV1;
|
||||
CV1.push_back(
|
||||
@ -19481,7 +19481,7 @@ static SDValue LowerUINT_TO_FP_i64(SDValue Op, SelectionDAG &DAG,
|
||||
ConstantFP::get(*Context, APFloat(APFloat::IEEEdouble(),
|
||||
APInt(64, 0x4530000000000000ULL))));
|
||||
Constant *C1 = ConstantVector::get(CV1);
|
||||
SDValue CPIdx1 = DAG.getConstantPool(C1, PtrVT, 16);
|
||||
SDValue CPIdx1 = DAG.getConstantPool(C1, PtrVT, Align(16));
|
||||
|
||||
// Load the 64-bit value into an XMM register.
|
||||
SDValue XR1 =
|
||||
@ -19686,7 +19686,7 @@ static SDValue lowerUINT_TO_FP_vXi32(SDValue Op, SelectionDAG &DAG,
|
||||
*DAG.getContext(),
|
||||
APFloat(APFloat::IEEEdouble(), APInt(64, 0x4330000000000000ULL)));
|
||||
auto PtrVT = DAG.getTargetLoweringInfo().getPointerTy(DAG.getDataLayout());
|
||||
SDValue CPIdx = DAG.getConstantPool(Bias, PtrVT, /*Alignment*/ 8);
|
||||
SDValue CPIdx = DAG.getConstantPool(Bias, PtrVT, Align(8));
|
||||
SDVTList Tys = DAG.getVTList(MVT::v4f64, MVT::Other);
|
||||
SDValue Ops[] = {DAG.getEntryNode(), CPIdx};
|
||||
SDValue VBias = DAG.getMemIntrinsicNode(
|
||||
|
@ -329,10 +329,10 @@ LowerConstantPool(SDValue Op, SelectionDAG &DAG) const
|
||||
SDValue Res;
|
||||
if (CP->isMachineConstantPoolEntry()) {
|
||||
Res = DAG.getTargetConstantPool(CP->getMachineCPVal(), PtrVT,
|
||||
CP->getAlignment(), CP->getOffset());
|
||||
CP->getAlign(), CP->getOffset());
|
||||
} else {
|
||||
Res = DAG.getTargetConstantPool(CP->getConstVal(), PtrVT,
|
||||
CP->getAlignment(), CP->getOffset());
|
||||
Res = DAG.getTargetConstantPool(CP->getConstVal(), PtrVT, CP->getAlign(),
|
||||
CP->getOffset());
|
||||
}
|
||||
return DAG.getNode(XCoreISD::CPRelativeWrapper, dl, MVT::i32, Res);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user