Convert AddNodeIDNode and SelectionDAG::getNodeIfExiists to use ArrayRef<SDValue>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207383 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Craig Topper 2014-04-27 23:22:43 +00:00
parent 2dc04b4604
commit a8e8d83e65
3 changed files with 43 additions and 44 deletions

View File

@ -915,8 +915,7 @@ public:
/// getNodeIfExists - Get the specified node if it's already available, or /// getNodeIfExists - Get the specified node if it's already available, or
/// else return NULL. /// else return NULL.
SDNode *getNodeIfExists(unsigned Opcode, SDVTList VTs, SDNode *getNodeIfExists(unsigned Opcode, SDVTList VTs, ArrayRef<SDValue> Ops);
const SDValue *Ops, unsigned NumOps);
/// getDbgValue - Creates a SDDbgValue node. /// getDbgValue - Creates a SDDbgValue node.
/// ///

View File

@ -1317,7 +1317,7 @@ SDValue DAGCombiner::combine(SDNode *N) {
if (isa<ConstantSDNode>(N0) || !isa<ConstantSDNode>(N1)) { if (isa<ConstantSDNode>(N0) || !isa<ConstantSDNode>(N1)) {
SDValue Ops[] = { N1, N0 }; SDValue Ops[] = { N1, N0 };
SDNode *CSENode = DAG.getNodeIfExists(N->getOpcode(), N->getVTList(), SDNode *CSENode = DAG.getNodeIfExists(N->getOpcode(), N->getVTList(),
Ops, 2); Ops);
if (CSENode) if (CSENode)
return SDValue(CSENode, 0); return SDValue(CSENode, 0);
} }

View File

@ -381,12 +381,11 @@ static void AddNodeIDOperands(FoldingSetNodeID &ID,
} }
} }
static void AddNodeIDNode(FoldingSetNodeID &ID, static void AddNodeIDNode(FoldingSetNodeID &ID, unsigned short OpC,
unsigned short OpC, SDVTList VTList, SDVTList VTList, ArrayRef<SDValue> OpList) {
const SDValue *OpList, unsigned N) {
AddNodeIDOpcode(ID, OpC); AddNodeIDOpcode(ID, OpC);
AddNodeIDValueTypes(ID, VTList); AddNodeIDValueTypes(ID, VTList);
AddNodeIDOperands(ID, OpList, N); AddNodeIDOperands(ID, OpList.data(), OpList.size());
} }
/// AddNodeIDCustom - If this is an SDNode with special info, add this info to /// AddNodeIDCustom - If this is an SDNode with special info, add this info to
@ -769,7 +768,7 @@ SDNode *SelectionDAG::FindModifiedNodeSlot(SDNode *N, SDValue Op,
SDValue Ops[] = { Op }; SDValue Ops[] = { Op };
FoldingSetNodeID ID; FoldingSetNodeID ID;
AddNodeIDNode(ID, N->getOpcode(), N->getVTList(), Ops, 1); AddNodeIDNode(ID, N->getOpcode(), N->getVTList(), Ops);
AddNodeIDCustom(ID, N); AddNodeIDCustom(ID, N);
SDNode *Node = CSEMap.FindNodeOrInsertPos(ID, InsertPos); SDNode *Node = CSEMap.FindNodeOrInsertPos(ID, InsertPos);
return Node; return Node;
@ -787,7 +786,7 @@ SDNode *SelectionDAG::FindModifiedNodeSlot(SDNode *N,
SDValue Ops[] = { Op1, Op2 }; SDValue Ops[] = { Op1, Op2 };
FoldingSetNodeID ID; FoldingSetNodeID ID;
AddNodeIDNode(ID, N->getOpcode(), N->getVTList(), Ops, 2); AddNodeIDNode(ID, N->getOpcode(), N->getVTList(), Ops);
AddNodeIDCustom(ID, N); AddNodeIDCustom(ID, N);
SDNode *Node = CSEMap.FindNodeOrInsertPos(ID, InsertPos); SDNode *Node = CSEMap.FindNodeOrInsertPos(ID, InsertPos);
return Node; return Node;
@ -805,7 +804,8 @@ SDNode *SelectionDAG::FindModifiedNodeSlot(SDNode *N,
return nullptr; return nullptr;
FoldingSetNodeID ID; FoldingSetNodeID ID;
AddNodeIDNode(ID, N->getOpcode(), N->getVTList(), Ops, NumOps); AddNodeIDNode(ID, N->getOpcode(), N->getVTList(),
ArrayRef<SDValue>(Ops, NumOps));
AddNodeIDCustom(ID, N); AddNodeIDCustom(ID, N);
SDNode *Node = CSEMap.FindNodeOrInsertPos(ID, InsertPos); SDNode *Node = CSEMap.FindNodeOrInsertPos(ID, InsertPos);
return Node; return Node;
@ -1071,7 +1071,7 @@ SDValue SelectionDAG::getConstant(const ConstantInt &Val, EVT VT, bool isT,
"APInt size does not match type size!"); "APInt size does not match type size!");
unsigned Opc = isT ? ISD::TargetConstant : ISD::Constant; unsigned Opc = isT ? ISD::TargetConstant : ISD::Constant;
FoldingSetNodeID ID; FoldingSetNodeID ID;
AddNodeIDNode(ID, Opc, getVTList(EltVT), nullptr, 0); AddNodeIDNode(ID, Opc, getVTList(EltVT), None);
ID.AddPointer(Elt); ID.AddPointer(Elt);
ID.AddBoolean(isO); ID.AddBoolean(isO);
void *IP = nullptr; void *IP = nullptr;
@ -1114,7 +1114,7 @@ SDValue SelectionDAG::getConstantFP(const ConstantFP& V, EVT VT, bool isTarget){
// we don't have issues with SNANs. // we don't have issues with SNANs.
unsigned Opc = isTarget ? ISD::TargetConstantFP : ISD::ConstantFP; unsigned Opc = isTarget ? ISD::TargetConstantFP : ISD::ConstantFP;
FoldingSetNodeID ID; FoldingSetNodeID ID;
AddNodeIDNode(ID, Opc, getVTList(EltVT), nullptr, 0); AddNodeIDNode(ID, Opc, getVTList(EltVT), None);
ID.AddPointer(&V); ID.AddPointer(&V);
void *IP = nullptr; void *IP = nullptr;
SDNode *N = nullptr; SDNode *N = nullptr;
@ -1182,7 +1182,7 @@ SDValue SelectionDAG::getGlobalAddress(const GlobalValue *GV, SDLoc DL,
Opc = isTargetGA ? ISD::TargetGlobalAddress : ISD::GlobalAddress; Opc = isTargetGA ? ISD::TargetGlobalAddress : ISD::GlobalAddress;
FoldingSetNodeID ID; FoldingSetNodeID ID;
AddNodeIDNode(ID, Opc, getVTList(VT), nullptr, 0); AddNodeIDNode(ID, Opc, getVTList(VT), None);
ID.AddPointer(GV); ID.AddPointer(GV);
ID.AddInteger(Offset); ID.AddInteger(Offset);
ID.AddInteger(TargetFlags); ID.AddInteger(TargetFlags);
@ -1202,7 +1202,7 @@ SDValue SelectionDAG::getGlobalAddress(const GlobalValue *GV, SDLoc DL,
SDValue SelectionDAG::getFrameIndex(int FI, EVT VT, bool isTarget) { SDValue SelectionDAG::getFrameIndex(int FI, EVT VT, bool isTarget) {
unsigned Opc = isTarget ? ISD::TargetFrameIndex : ISD::FrameIndex; unsigned Opc = isTarget ? ISD::TargetFrameIndex : ISD::FrameIndex;
FoldingSetNodeID ID; FoldingSetNodeID ID;
AddNodeIDNode(ID, Opc, getVTList(VT), nullptr, 0); AddNodeIDNode(ID, Opc, getVTList(VT), None);
ID.AddInteger(FI); ID.AddInteger(FI);
void *IP = nullptr; void *IP = nullptr;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
@ -1220,7 +1220,7 @@ SDValue SelectionDAG::getJumpTable(int JTI, EVT VT, bool isTarget,
"Cannot set target flags on target-independent jump tables"); "Cannot set target flags on target-independent jump tables");
unsigned Opc = isTarget ? ISD::TargetJumpTable : ISD::JumpTable; unsigned Opc = isTarget ? ISD::TargetJumpTable : ISD::JumpTable;
FoldingSetNodeID ID; FoldingSetNodeID ID;
AddNodeIDNode(ID, Opc, getVTList(VT), nullptr, 0); AddNodeIDNode(ID, Opc, getVTList(VT), None);
ID.AddInteger(JTI); ID.AddInteger(JTI);
ID.AddInteger(TargetFlags); ID.AddInteger(TargetFlags);
void *IP = nullptr; void *IP = nullptr;
@ -1245,7 +1245,7 @@ SDValue SelectionDAG::getConstantPool(const Constant *C, EVT VT,
TM.getTargetLowering()->getDataLayout()->getPrefTypeAlignment(C->getType()); TM.getTargetLowering()->getDataLayout()->getPrefTypeAlignment(C->getType());
unsigned Opc = isTarget ? ISD::TargetConstantPool : ISD::ConstantPool; unsigned Opc = isTarget ? ISD::TargetConstantPool : ISD::ConstantPool;
FoldingSetNodeID ID; FoldingSetNodeID ID;
AddNodeIDNode(ID, Opc, getVTList(VT), nullptr, 0); AddNodeIDNode(ID, Opc, getVTList(VT), None);
ID.AddInteger(Alignment); ID.AddInteger(Alignment);
ID.AddInteger(Offset); ID.AddInteger(Offset);
ID.AddPointer(C); ID.AddPointer(C);
@ -1273,7 +1273,7 @@ SDValue SelectionDAG::getConstantPool(MachineConstantPoolValue *C, EVT VT,
TM.getTargetLowering()->getDataLayout()->getPrefTypeAlignment(C->getType()); TM.getTargetLowering()->getDataLayout()->getPrefTypeAlignment(C->getType());
unsigned Opc = isTarget ? ISD::TargetConstantPool : ISD::ConstantPool; unsigned Opc = isTarget ? ISD::TargetConstantPool : ISD::ConstantPool;
FoldingSetNodeID ID; FoldingSetNodeID ID;
AddNodeIDNode(ID, Opc, getVTList(VT), nullptr, 0); AddNodeIDNode(ID, Opc, getVTList(VT), None);
ID.AddInteger(Alignment); ID.AddInteger(Alignment);
ID.AddInteger(Offset); ID.AddInteger(Offset);
C->addSelectionDAGCSEId(ID); C->addSelectionDAGCSEId(ID);
@ -1292,7 +1292,7 @@ SDValue SelectionDAG::getConstantPool(MachineConstantPoolValue *C, EVT VT,
SDValue SelectionDAG::getTargetIndex(int Index, EVT VT, int64_t Offset, SDValue SelectionDAG::getTargetIndex(int Index, EVT VT, int64_t Offset,
unsigned char TargetFlags) { unsigned char TargetFlags) {
FoldingSetNodeID ID; FoldingSetNodeID ID;
AddNodeIDNode(ID, ISD::TargetIndex, getVTList(VT), nullptr, 0); AddNodeIDNode(ID, ISD::TargetIndex, getVTList(VT), None);
ID.AddInteger(Index); ID.AddInteger(Index);
ID.AddInteger(Offset); ID.AddInteger(Offset);
ID.AddInteger(TargetFlags); ID.AddInteger(TargetFlags);
@ -1309,7 +1309,7 @@ SDValue SelectionDAG::getTargetIndex(int Index, EVT VT, int64_t Offset,
SDValue SelectionDAG::getBasicBlock(MachineBasicBlock *MBB) { SDValue SelectionDAG::getBasicBlock(MachineBasicBlock *MBB) {
FoldingSetNodeID ID; FoldingSetNodeID ID;
AddNodeIDNode(ID, ISD::BasicBlock, getVTList(MVT::Other), nullptr, 0); AddNodeIDNode(ID, ISD::BasicBlock, getVTList(MVT::Other), None);
ID.AddPointer(MBB); ID.AddPointer(MBB);
void *IP = nullptr; void *IP = nullptr;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
@ -1448,7 +1448,7 @@ SDValue SelectionDAG::getVectorShuffle(EVT VT, SDLoc dl, SDValue N1,
FoldingSetNodeID ID; FoldingSetNodeID ID;
SDValue Ops[2] = { N1, N2 }; SDValue Ops[2] = { N1, N2 };
AddNodeIDNode(ID, ISD::VECTOR_SHUFFLE, getVTList(VT), Ops, 2); AddNodeIDNode(ID, ISD::VECTOR_SHUFFLE, getVTList(VT), Ops);
for (unsigned i = 0; i != NElts; ++i) for (unsigned i = 0; i != NElts; ++i)
ID.AddInteger(MaskVec[i]); ID.AddInteger(MaskVec[i]);
@ -1483,7 +1483,7 @@ SDValue SelectionDAG::getConvertRndSat(EVT VT, SDLoc dl,
FoldingSetNodeID ID; FoldingSetNodeID ID;
SDValue Ops[] = { Val, DTy, STy, Rnd, Sat }; SDValue Ops[] = { Val, DTy, STy, Rnd, Sat };
AddNodeIDNode(ID, ISD::CONVERT_RNDSAT, getVTList(VT), &Ops[0], 5); AddNodeIDNode(ID, ISD::CONVERT_RNDSAT, getVTList(VT), Ops);
void* IP = nullptr; void* IP = nullptr;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
return SDValue(E, 0); return SDValue(E, 0);
@ -1498,7 +1498,7 @@ SDValue SelectionDAG::getConvertRndSat(EVT VT, SDLoc dl,
SDValue SelectionDAG::getRegister(unsigned RegNo, EVT VT) { SDValue SelectionDAG::getRegister(unsigned RegNo, EVT VT) {
FoldingSetNodeID ID; FoldingSetNodeID ID;
AddNodeIDNode(ID, ISD::Register, getVTList(VT), nullptr, 0); AddNodeIDNode(ID, ISD::Register, getVTList(VT), None);
ID.AddInteger(RegNo); ID.AddInteger(RegNo);
void *IP = nullptr; void *IP = nullptr;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
@ -1512,7 +1512,7 @@ SDValue SelectionDAG::getRegister(unsigned RegNo, EVT VT) {
SDValue SelectionDAG::getRegisterMask(const uint32_t *RegMask) { SDValue SelectionDAG::getRegisterMask(const uint32_t *RegMask) {
FoldingSetNodeID ID; FoldingSetNodeID ID;
AddNodeIDNode(ID, ISD::RegisterMask, getVTList(MVT::Untyped), nullptr, 0); AddNodeIDNode(ID, ISD::RegisterMask, getVTList(MVT::Untyped), None);
ID.AddPointer(RegMask); ID.AddPointer(RegMask);
void *IP = nullptr; void *IP = nullptr;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
@ -1527,7 +1527,7 @@ SDValue SelectionDAG::getRegisterMask(const uint32_t *RegMask) {
SDValue SelectionDAG::getEHLabel(SDLoc dl, SDValue Root, MCSymbol *Label) { SDValue SelectionDAG::getEHLabel(SDLoc dl, SDValue Root, MCSymbol *Label) {
FoldingSetNodeID ID; FoldingSetNodeID ID;
SDValue Ops[] = { Root }; SDValue Ops[] = { Root };
AddNodeIDNode(ID, ISD::EH_LABEL, getVTList(MVT::Other), &Ops[0], 1); AddNodeIDNode(ID, ISD::EH_LABEL, getVTList(MVT::Other), Ops);
ID.AddPointer(Label); ID.AddPointer(Label);
void *IP = nullptr; void *IP = nullptr;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
@ -1548,7 +1548,7 @@ SDValue SelectionDAG::getBlockAddress(const BlockAddress *BA, EVT VT,
unsigned Opc = isTarget ? ISD::TargetBlockAddress : ISD::BlockAddress; unsigned Opc = isTarget ? ISD::TargetBlockAddress : ISD::BlockAddress;
FoldingSetNodeID ID; FoldingSetNodeID ID;
AddNodeIDNode(ID, Opc, getVTList(VT), nullptr, 0); AddNodeIDNode(ID, Opc, getVTList(VT), None);
ID.AddPointer(BA); ID.AddPointer(BA);
ID.AddInteger(Offset); ID.AddInteger(Offset);
ID.AddInteger(TargetFlags); ID.AddInteger(TargetFlags);
@ -1568,7 +1568,7 @@ SDValue SelectionDAG::getSrcValue(const Value *V) {
"SrcValue is not a pointer?"); "SrcValue is not a pointer?");
FoldingSetNodeID ID; FoldingSetNodeID ID;
AddNodeIDNode(ID, ISD::SRCVALUE, getVTList(MVT::Other), nullptr, 0); AddNodeIDNode(ID, ISD::SRCVALUE, getVTList(MVT::Other), None);
ID.AddPointer(V); ID.AddPointer(V);
void *IP = nullptr; void *IP = nullptr;
@ -1584,7 +1584,7 @@ SDValue SelectionDAG::getSrcValue(const Value *V) {
/// getMDNode - Return an MDNodeSDNode which holds an MDNode. /// getMDNode - Return an MDNodeSDNode which holds an MDNode.
SDValue SelectionDAG::getMDNode(const MDNode *MD) { SDValue SelectionDAG::getMDNode(const MDNode *MD) {
FoldingSetNodeID ID; FoldingSetNodeID ID;
AddNodeIDNode(ID, ISD::MDNODE_SDNODE, getVTList(MVT::Other), nullptr, 0); AddNodeIDNode(ID, ISD::MDNODE_SDNODE, getVTList(MVT::Other), None);
ID.AddPointer(MD); ID.AddPointer(MD);
void *IP = nullptr; void *IP = nullptr;
@ -1602,7 +1602,7 @@ SDValue SelectionDAG::getAddrSpaceCast(SDLoc dl, EVT VT, SDValue Ptr,
unsigned SrcAS, unsigned DestAS) { unsigned SrcAS, unsigned DestAS) {
SDValue Ops[] = {Ptr}; SDValue Ops[] = {Ptr};
FoldingSetNodeID ID; FoldingSetNodeID ID;
AddNodeIDNode(ID, ISD::ADDRSPACECAST, getVTList(VT), &Ops[0], 1); AddNodeIDNode(ID, ISD::ADDRSPACECAST, getVTList(VT), Ops);
ID.AddInteger(SrcAS); ID.AddInteger(SrcAS);
ID.AddInteger(DestAS); ID.AddInteger(DestAS);
@ -2522,7 +2522,7 @@ bool SelectionDAG::isEqualTo(SDValue A, SDValue B) const {
/// ///
SDValue SelectionDAG::getNode(unsigned Opcode, SDLoc DL, EVT VT) { SDValue SelectionDAG::getNode(unsigned Opcode, SDLoc DL, EVT VT) {
FoldingSetNodeID ID; FoldingSetNodeID ID;
AddNodeIDNode(ID, Opcode, getVTList(VT), nullptr, 0); AddNodeIDNode(ID, Opcode, getVTList(VT), None);
void *IP = nullptr; void *IP = nullptr;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
return SDValue(E, 0); return SDValue(E, 0);
@ -2794,7 +2794,7 @@ SDValue SelectionDAG::getNode(unsigned Opcode, SDLoc DL,
if (VT != MVT::Glue) { // Don't CSE flag producing nodes if (VT != MVT::Glue) { // Don't CSE flag producing nodes
FoldingSetNodeID ID; FoldingSetNodeID ID;
SDValue Ops[1] = { Operand }; SDValue Ops[1] = { Operand };
AddNodeIDNode(ID, Opcode, VTs, Ops, 1); AddNodeIDNode(ID, Opcode, VTs, Ops);
void *IP = nullptr; void *IP = nullptr;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
return SDValue(E, 0); return SDValue(E, 0);
@ -3380,7 +3380,7 @@ SDValue SelectionDAG::getNode(unsigned Opcode, SDLoc DL, EVT VT, SDValue N1,
if (VT != MVT::Glue) { if (VT != MVT::Glue) {
SDValue Ops[] = { N1, N2 }; SDValue Ops[] = { N1, N2 };
FoldingSetNodeID ID; FoldingSetNodeID ID;
AddNodeIDNode(ID, Opcode, VTs, Ops, 2); AddNodeIDNode(ID, Opcode, VTs, Ops);
void *IP = nullptr; void *IP = nullptr;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
return SDValue(E, 0); return SDValue(E, 0);
@ -3487,7 +3487,7 @@ SDValue SelectionDAG::getNode(unsigned Opcode, SDLoc DL, EVT VT,
if (VT != MVT::Glue) { if (VT != MVT::Glue) {
SDValue Ops[] = { N1, N2, N3 }; SDValue Ops[] = { N1, N2, N3 };
FoldingSetNodeID ID; FoldingSetNodeID ID;
AddNodeIDNode(ID, Opcode, VTs, Ops, 3); AddNodeIDNode(ID, Opcode, VTs, Ops);
void *IP = nullptr; void *IP = nullptr;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
return SDValue(E, 0); return SDValue(E, 0);
@ -4245,7 +4245,7 @@ SDValue SelectionDAG::getAtomic(unsigned Opcode, SDLoc dl, EVT MemVT,
SynchronizationScope SynchScope) { SynchronizationScope SynchScope) {
FoldingSetNodeID ID; FoldingSetNodeID ID;
ID.AddInteger(MemVT.getRawBits()); ID.AddInteger(MemVT.getRawBits());
AddNodeIDNode(ID, Opcode, VTList, Ops, NumOps); AddNodeIDNode(ID, Opcode, VTList, ArrayRef<SDValue>(Ops, NumOps));
ID.AddInteger(MMO->getPointerInfo().getAddrSpace()); ID.AddInteger(MMO->getPointerInfo().getAddrSpace());
void* IP = nullptr; void* IP = nullptr;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) { if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) {
@ -4450,7 +4450,7 @@ SelectionDAG::getMemIntrinsicNode(unsigned Opcode, SDLoc dl, SDVTList VTList,
MemIntrinsicSDNode *N; MemIntrinsicSDNode *N;
if (VTList.VTs[VTList.NumVTs-1] != MVT::Glue) { if (VTList.VTs[VTList.NumVTs-1] != MVT::Glue) {
FoldingSetNodeID ID; FoldingSetNodeID ID;
AddNodeIDNode(ID, Opcode, VTList, Ops.data(), Ops.size()); AddNodeIDNode(ID, Opcode, VTList, Ops);
ID.AddInteger(MMO->getPointerInfo().getAddrSpace()); ID.AddInteger(MMO->getPointerInfo().getAddrSpace());
void *IP = nullptr; void *IP = nullptr;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) { if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) {
@ -4568,7 +4568,7 @@ SelectionDAG::getLoad(ISD::MemIndexedMode AM, ISD::LoadExtType ExtType,
getVTList(VT, Ptr.getValueType(), MVT::Other) : getVTList(VT, MVT::Other); getVTList(VT, Ptr.getValueType(), MVT::Other) : getVTList(VT, MVT::Other);
SDValue Ops[] = { Chain, Ptr, Offset }; SDValue Ops[] = { Chain, Ptr, Offset };
FoldingSetNodeID ID; FoldingSetNodeID ID;
AddNodeIDNode(ID, ISD::LOAD, VTs, Ops, 3); AddNodeIDNode(ID, ISD::LOAD, VTs, Ops);
ID.AddInteger(MemVT.getRawBits()); ID.AddInteger(MemVT.getRawBits());
ID.AddInteger(encodeMemSDNodeFlags(ExtType, AM, MMO->isVolatile(), ID.AddInteger(encodeMemSDNodeFlags(ExtType, AM, MMO->isVolatile(),
MMO->isNonTemporal(), MMO->isNonTemporal(),
@ -4676,7 +4676,7 @@ SDValue SelectionDAG::getStore(SDValue Chain, SDLoc dl, SDValue Val,
SDValue Undef = getUNDEF(Ptr.getValueType()); SDValue Undef = getUNDEF(Ptr.getValueType());
SDValue Ops[] = { Chain, Val, Ptr, Undef }; SDValue Ops[] = { Chain, Val, Ptr, Undef };
FoldingSetNodeID ID; FoldingSetNodeID ID;
AddNodeIDNode(ID, ISD::STORE, VTs, Ops, 4); AddNodeIDNode(ID, ISD::STORE, VTs, Ops);
ID.AddInteger(VT.getRawBits()); ID.AddInteger(VT.getRawBits());
ID.AddInteger(encodeMemSDNodeFlags(false, ISD::UNINDEXED, MMO->isVolatile(), ID.AddInteger(encodeMemSDNodeFlags(false, ISD::UNINDEXED, MMO->isVolatile(),
MMO->isNonTemporal(), MMO->isInvariant())); MMO->isNonTemporal(), MMO->isInvariant()));
@ -4745,7 +4745,7 @@ SDValue SelectionDAG::getTruncStore(SDValue Chain, SDLoc dl, SDValue Val,
SDValue Undef = getUNDEF(Ptr.getValueType()); SDValue Undef = getUNDEF(Ptr.getValueType());
SDValue Ops[] = { Chain, Val, Ptr, Undef }; SDValue Ops[] = { Chain, Val, Ptr, Undef };
FoldingSetNodeID ID; FoldingSetNodeID ID;
AddNodeIDNode(ID, ISD::STORE, VTs, Ops, 4); AddNodeIDNode(ID, ISD::STORE, VTs, Ops);
ID.AddInteger(SVT.getRawBits()); ID.AddInteger(SVT.getRawBits());
ID.AddInteger(encodeMemSDNodeFlags(true, ISD::UNINDEXED, MMO->isVolatile(), ID.AddInteger(encodeMemSDNodeFlags(true, ISD::UNINDEXED, MMO->isVolatile(),
MMO->isNonTemporal(), MMO->isInvariant())); MMO->isNonTemporal(), MMO->isInvariant()));
@ -4772,7 +4772,7 @@ SelectionDAG::getIndexedStore(SDValue OrigStore, SDLoc dl, SDValue Base,
SDVTList VTs = getVTList(Base.getValueType(), MVT::Other); SDVTList VTs = getVTList(Base.getValueType(), MVT::Other);
SDValue Ops[] = { ST->getChain(), ST->getValue(), Base, Offset }; SDValue Ops[] = { ST->getChain(), ST->getValue(), Base, Offset };
FoldingSetNodeID ID; FoldingSetNodeID ID;
AddNodeIDNode(ID, ISD::STORE, VTs, Ops, 4); AddNodeIDNode(ID, ISD::STORE, VTs, Ops);
ID.AddInteger(ST->getMemoryVT().getRawBits()); ID.AddInteger(ST->getMemoryVT().getRawBits());
ID.AddInteger(ST->getRawSubclassData()); ID.AddInteger(ST->getRawSubclassData());
ID.AddInteger(ST->getPointerInfo().getAddrSpace()); ID.AddInteger(ST->getPointerInfo().getAddrSpace());
@ -4851,7 +4851,7 @@ SDValue SelectionDAG::getNode(unsigned Opcode, SDLoc DL, EVT VT,
if (VT != MVT::Glue) { if (VT != MVT::Glue) {
FoldingSetNodeID ID; FoldingSetNodeID ID;
AddNodeIDNode(ID, Opcode, VTs, Ops.data(), NumOps); AddNodeIDNode(ID, Opcode, VTs, Ops);
void *IP = nullptr; void *IP = nullptr;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
@ -4910,7 +4910,7 @@ SDValue SelectionDAG::getNode(unsigned Opcode, SDLoc DL, SDVTList VTList,
unsigned NumOps = Ops.size(); unsigned NumOps = Ops.size();
if (VTList.VTs[VTList.NumVTs-1] != MVT::Glue) { if (VTList.VTs[VTList.NumVTs-1] != MVT::Glue) {
FoldingSetNodeID ID; FoldingSetNodeID ID;
AddNodeIDNode(ID, Opcode, VTList, Ops.data(), NumOps); AddNodeIDNode(ID, Opcode, VTList, Ops);
void *IP = nullptr; void *IP = nullptr;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
return SDValue(E, 0); return SDValue(E, 0);
@ -5344,7 +5344,7 @@ SDNode *SelectionDAG::MorphNodeTo(SDNode *N, unsigned Opc,
void *IP = nullptr; void *IP = nullptr;
if (VTs.VTs[VTs.NumVTs-1] != MVT::Glue) { if (VTs.VTs[VTs.NumVTs-1] != MVT::Glue) {
FoldingSetNodeID ID; FoldingSetNodeID ID;
AddNodeIDNode(ID, Opc, VTs, Ops.data(), NumOps); AddNodeIDNode(ID, Opc, VTs, Ops);
if (SDNode *ON = CSEMap.FindNodeOrInsertPos(ID, IP)) if (SDNode *ON = CSEMap.FindNodeOrInsertPos(ID, IP))
return UpdadeSDLocOnMergedSDNode(ON, SDLoc(N)); return UpdadeSDLocOnMergedSDNode(ON, SDLoc(N));
} }
@ -5550,7 +5550,7 @@ SelectionDAG::getMachineNode(unsigned Opcode, SDLoc DL, SDVTList VTs,
if (DoCSE) { if (DoCSE) {
FoldingSetNodeID ID; FoldingSetNodeID ID;
AddNodeIDNode(ID, ~Opcode, VTs, Ops, NumOps); AddNodeIDNode(ID, ~Opcode, VTs, OpsArray);
IP = nullptr; IP = nullptr;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) { if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) {
return cast<MachineSDNode>(UpdadeSDLocOnMergedSDNode(E, DL)); return cast<MachineSDNode>(UpdadeSDLocOnMergedSDNode(E, DL));
@ -5607,10 +5607,10 @@ SelectionDAG::getTargetInsertSubreg(int SRIdx, SDLoc DL, EVT VT,
/// getNodeIfExists - Get the specified node if it's already available, or /// getNodeIfExists - Get the specified node if it's already available, or
/// else return NULL. /// else return NULL.
SDNode *SelectionDAG::getNodeIfExists(unsigned Opcode, SDVTList VTList, SDNode *SelectionDAG::getNodeIfExists(unsigned Opcode, SDVTList VTList,
const SDValue *Ops, unsigned NumOps) { ArrayRef<SDValue> Ops) {
if (VTList.VTs[VTList.NumVTs-1] != MVT::Glue) { if (VTList.VTs[VTList.NumVTs-1] != MVT::Glue) {
FoldingSetNodeID ID; FoldingSetNodeID ID;
AddNodeIDNode(ID, Opcode, VTList, Ops, NumOps); AddNodeIDNode(ID, Opcode, VTList, Ops);
void *IP = nullptr; void *IP = nullptr;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
return E; return E;