class MachineDebugInfo;
class MachineFunction;
class MachineDebugInfo;
class MachineFunction;
-/// SDVTList - This represents a list of ValueType's that has been intern'd by
-/// a SelectionDAG. Instances of this simple value class are returned by
-/// SelectionDAG::getVTList(...).
-///
-struct SDVTList {
- const MVT::ValueType *VTs;
- unsigned short NumVTs;
-};
-
/// SelectionDAG class - This is used to represent a portion of an LLVM function
/// in a low-level Data Dependence DAG representation suitable for instruction
/// selection. This DAG is constructed as the first step of instruction
/// SelectionDAG class - This is used to represent a portion of an LLVM function
/// in a low-level Data Dependence DAG representation suitable for instruction
/// selection. This DAG is constructed as the first step of instruction
namespace llvm {
class SDNode;
class SDOperand;
namespace llvm {
class SDNode;
class SDOperand;
/// SelectionDAGCSEMap - This class is used for two purposes:
/// 1. Given information (e.g. opcode and operand info) about a node we want
/// SelectionDAGCSEMap - This class is used for two purposes:
/// 1. Given information (e.g. opcode and operand info) about a node we want
public:
NodeID() {}
NodeID(SDNode *N);
public:
NodeID() {}
NodeID(SDNode *N);
- NodeID(unsigned short ID, const void *VTList);
- NodeID(unsigned short ID, const void *VTList, SDOperand Op);
- NodeID(unsigned short ID, const void *VTList,
+ NodeID(unsigned short ID, SDVTList VTList);
+ NodeID(unsigned short ID, SDVTList VTList, SDOperand Op);
+ NodeID(unsigned short ID, SDVTList VTList,
SDOperand Op1, SDOperand Op2);
SDOperand Op1, SDOperand Op2);
- NodeID(unsigned short ID, const void *VTList,
+ NodeID(unsigned short ID, SDVTList VTList,
SDOperand Op1, SDOperand Op2, SDOperand Op3);
SDOperand Op1, SDOperand Op2, SDOperand Op3);
- NodeID(unsigned short ID, const void *VTList,
+ NodeID(unsigned short ID, SDVTList VTList,
const SDOperand *OpList, unsigned N);
void SetOpcode(unsigned short ID) {
const SDOperand *OpList, unsigned N);
void SetOpcode(unsigned short ID) {
- void SetValueTypes(const void *VTList) { AddPointer(VTList); }
+ void SetValueTypes(SDVTList VTList);
void SetOperands() {}
void SetOperands(SDOperand Op) { AddOperand(Op); }
void SetOperands(SDOperand Op1, SDOperand Op2) {
void SetOperands() {}
void SetOperands(SDOperand Op) { AddOperand(Op); }
void SetOperands(SDOperand Op1, SDOperand Op2) {
template<typename NodeTy, typename Traits> class iplist;
template<typename NodeTy> class ilist_iterator;
template<typename NodeTy, typename Traits> class iplist;
template<typename NodeTy> class ilist_iterator;
+/// SDVTList - This represents a list of ValueType's that has been intern'd by
+/// a SelectionDAG. Instances of this simple value class are returned by
+/// SelectionDAG::getVTList(...).
+///
+struct SDVTList {
+ const MVT::ValueType *VTs;
+ unsigned short NumVTs;
+};
+
+
/// ISD namespace - This namespace contains an enum which represents all of the
/// SelectionDAG node types and value types.
///
/// ISD namespace - This namespace contains an enum which represents all of the
/// SelectionDAG node types and value types.
///
op_iterator op_end() const { return OperandList+NumOperands; }
op_iterator op_end() const { return OperandList+NumOperands; }
+ SDVTList getVTList() const {
+ SDVTList X = { ValueList, NumValues };
+ return X;
+ };
+
/// getNumValues - Return the number of values defined/returned by this
/// operator.
///
/// getNumValues - Return the number of values defined/returned by this
/// operator.
///
- void setValueTypes(const MVT::ValueType *List, unsigned NumVal) {
+ void setValueTypes(SDVTList L) {
assert(NumValues == 0 && "Should not have values yet!");
assert(NumValues == 0 && "Should not have values yet!");
- ValueList = List;
- NumValues = NumVal;
+ ValueList = L.VTs;
+ NumValues = L.NumVTs;
}
void setOperands(SDOperand Op0) {
}
void setOperands(SDOperand Op0) {
#include <algorithm>
using namespace llvm;
#include <algorithm>
using namespace llvm;
+/// makeVTList - Return an instance of the SDVTList struct initialized with the
+/// specified members.
+static SDVTList makeVTList(const MVT::ValueType *VTs, unsigned NumVTs) {
+ SDVTList Res = {VTs, NumVTs};
+ return Res;
+}
+
static bool isCommutativeBinOp(unsigned Opcode) {
switch (Opcode) {
case ISD::ADD:
static bool isCommutativeBinOp(unsigned Opcode) {
switch (Opcode) {
case ISD::ADD:
SelectionDAGCSEMap::NodeID ID;
ID.SetOpcode(N->getOpcode());
SelectionDAGCSEMap::NodeID ID;
ID.SetOpcode(N->getOpcode());
- ID.SetValueTypes(N->value_begin());
+ ID.SetValueTypes(N->getVTList());
ID.SetOperands(Op);
return CSEMap.FindNodeOrInsertPos(ID, InsertPos);
}
ID.SetOperands(Op);
return CSEMap.FindNodeOrInsertPos(ID, InsertPos);
}
SelectionDAGCSEMap::NodeID ID;
ID.SetOpcode(N->getOpcode());
SelectionDAGCSEMap::NodeID ID;
ID.SetOpcode(N->getOpcode());
- ID.SetValueTypes(N->value_begin());
+ ID.SetValueTypes(N->getVTList());
ID.SetOperands(Op1, Op2);
return CSEMap.FindNodeOrInsertPos(ID, InsertPos);
}
ID.SetOperands(Op1, Op2);
return CSEMap.FindNodeOrInsertPos(ID, InsertPos);
}
SelectionDAGCSEMap::NodeID ID;
ID.SetOpcode(N->getOpcode());
SelectionDAGCSEMap::NodeID ID;
ID.SetOpcode(N->getOpcode());
- ID.SetValueTypes(N->value_begin());
+ ID.SetValueTypes(N->getVTList());
ID.SetOperands(Ops, NumOps);
return CSEMap.FindNodeOrInsertPos(ID, InsertPos);
}
ID.SetOperands(Ops, NumOps);
return CSEMap.FindNodeOrInsertPos(ID, InsertPos);
}
Val &= MVT::getIntVTBitMask(VT);
unsigned Opc = isT ? ISD::TargetConstant : ISD::Constant;
Val &= MVT::getIntVTBitMask(VT);
unsigned Opc = isT ? ISD::TargetConstant : ISD::Constant;
- SelectionDAGCSEMap::NodeID ID(Opc, getNodeValueTypes(VT));
+ SelectionDAGCSEMap::NodeID ID(Opc, getVTList(VT));
ID.AddInteger(Val);
void *IP = 0;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
ID.AddInteger(Val);
void *IP = 0;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
// value, so that we don't have problems with 0.0 comparing equal to -0.0, and
// we don't have issues with SNANs.
unsigned Opc = isTarget ? ISD::TargetConstantFP : ISD::ConstantFP;
// value, so that we don't have problems with 0.0 comparing equal to -0.0, and
// we don't have issues with SNANs.
unsigned Opc = isTarget ? ISD::TargetConstantFP : ISD::ConstantFP;
- SelectionDAGCSEMap::NodeID ID(Opc, getNodeValueTypes(VT));
+ SelectionDAGCSEMap::NodeID ID(Opc, getVTList(VT));
ID.AddInteger(DoubleToBits(Val));
void *IP = 0;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
ID.AddInteger(DoubleToBits(Val));
void *IP = 0;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
MVT::ValueType VT, int Offset,
bool isTargetGA) {
unsigned Opc = isTargetGA ? ISD::TargetGlobalAddress : ISD::GlobalAddress;
MVT::ValueType VT, int Offset,
bool isTargetGA) {
unsigned Opc = isTargetGA ? ISD::TargetGlobalAddress : ISD::GlobalAddress;
- SelectionDAGCSEMap::NodeID ID(Opc, getNodeValueTypes(VT));
+ SelectionDAGCSEMap::NodeID ID(Opc, getVTList(VT));
ID.AddPointer(GV);
ID.AddInteger(Offset);
void *IP = 0;
ID.AddPointer(GV);
ID.AddInteger(Offset);
void *IP = 0;
SDOperand SelectionDAG::getFrameIndex(int FI, MVT::ValueType VT,
bool isTarget) {
unsigned Opc = isTarget ? ISD::TargetFrameIndex : ISD::FrameIndex;
SDOperand SelectionDAG::getFrameIndex(int FI, MVT::ValueType VT,
bool isTarget) {
unsigned Opc = isTarget ? ISD::TargetFrameIndex : ISD::FrameIndex;
- SelectionDAGCSEMap::NodeID ID(Opc, getNodeValueTypes(VT));
+ SelectionDAGCSEMap::NodeID ID(Opc, getVTList(VT));
ID.AddInteger(FI);
void *IP = 0;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
ID.AddInteger(FI);
void *IP = 0;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
SDOperand SelectionDAG::getJumpTable(int JTI, MVT::ValueType VT, bool isTarget){
unsigned Opc = isTarget ? ISD::TargetJumpTable : ISD::JumpTable;
SDOperand SelectionDAG::getJumpTable(int JTI, MVT::ValueType VT, bool isTarget){
unsigned Opc = isTarget ? ISD::TargetJumpTable : ISD::JumpTable;
- SelectionDAGCSEMap::NodeID ID(Opc, getNodeValueTypes(VT));
+ SelectionDAGCSEMap::NodeID ID(Opc, getVTList(VT));
ID.AddInteger(JTI);
void *IP = 0;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
ID.AddInteger(JTI);
void *IP = 0;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
unsigned Alignment, int Offset,
bool isTarget) {
unsigned Opc = isTarget ? ISD::TargetConstantPool : ISD::ConstantPool;
unsigned Alignment, int Offset,
bool isTarget) {
unsigned Opc = isTarget ? ISD::TargetConstantPool : ISD::ConstantPool;
- SelectionDAGCSEMap::NodeID ID(Opc, getNodeValueTypes(VT));
+ SelectionDAGCSEMap::NodeID ID(Opc, getVTList(VT));
ID.AddInteger(Alignment);
ID.AddInteger(Offset);
ID.AddPointer(C);
ID.AddInteger(Alignment);
ID.AddInteger(Offset);
ID.AddPointer(C);
SDOperand SelectionDAG::getBasicBlock(MachineBasicBlock *MBB) {
SDOperand SelectionDAG::getBasicBlock(MachineBasicBlock *MBB) {
- SelectionDAGCSEMap::NodeID ID(ISD::BasicBlock, getNodeValueTypes(MVT::Other));
+ SelectionDAGCSEMap::NodeID ID(ISD::BasicBlock, getVTList(MVT::Other));
ID.AddPointer(MBB);
void *IP = 0;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
ID.AddPointer(MBB);
void *IP = 0;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
}
SDOperand SelectionDAG::getRegister(unsigned RegNo, MVT::ValueType VT) {
}
SDOperand SelectionDAG::getRegister(unsigned RegNo, MVT::ValueType VT) {
- SelectionDAGCSEMap::NodeID ID(ISD::Register, getNodeValueTypes(VT));
+ SelectionDAGCSEMap::NodeID ID(ISD::Register, getVTList(VT));
ID.AddInteger(RegNo);
void *IP = 0;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
ID.AddInteger(RegNo);
void *IP = 0;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
assert((!V || isa<PointerType>(V->getType())) &&
"SrcValue is not a pointer?");
assert((!V || isa<PointerType>(V->getType())) &&
"SrcValue is not a pointer?");
- SelectionDAGCSEMap::NodeID ID(ISD::SRCVALUE, getNodeValueTypes(MVT::Other));
+ SelectionDAGCSEMap::NodeID ID(ISD::SRCVALUE, getVTList(MVT::Other));
ID.AddPointer(V);
ID.AddInteger(Offset);
void *IP = 0;
ID.AddPointer(V);
ID.AddInteger(Offset);
void *IP = 0;
/// getNode - Gets or creates the specified node.
///
SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT) {
/// getNode - Gets or creates the specified node.
///
SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT) {
- const MVT::ValueType *VTs = getNodeValueTypes(VT);
- SelectionDAGCSEMap::NodeID ID(Opcode, VTs);
+ SelectionDAGCSEMap::NodeID ID(Opcode, getVTList(VT));
void *IP = 0;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
return SDOperand(E, 0);
void *IP = 0;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
return SDOperand(E, 0);
- const MVT::ValueType *VTs = getNodeValueTypes(VT);
+ SDVTList VTs = getVTList(VT);
if (VT != MVT::Flag) { // Don't CSE flag producing nodes
SelectionDAGCSEMap::NodeID ID(Opcode, VTs, Operand);
void *IP = 0;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
return SDOperand(E, 0);
N = new SDNode(Opcode, Operand);
if (VT != MVT::Flag) { // Don't CSE flag producing nodes
SelectionDAGCSEMap::NodeID ID(Opcode, VTs, Operand);
void *IP = 0;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
return SDOperand(E, 0);
N = new SDNode(Opcode, Operand);
- N->setValueTypes(VTs, 1);
CSEMap.InsertNode(N, IP);
} else {
N = new SDNode(Opcode, Operand);
CSEMap.InsertNode(N, IP);
} else {
N = new SDNode(Opcode, Operand);
- N->setValueTypes(VTs, 1);
}
AllNodes.push_back(N);
return SDOperand(N, 0);
}
AllNodes.push_back(N);
return SDOperand(N, 0);
// Memoize this node if possible.
SDNode *N;
// Memoize this node if possible.
SDNode *N;
- const MVT::ValueType *VTs = getNodeValueTypes(VT);
+ SDVTList VTs = getVTList(VT);
if (VT != MVT::Flag) {
SelectionDAGCSEMap::NodeID ID(Opcode, VTs, N1, N2);
void *IP = 0;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
return SDOperand(E, 0);
N = new SDNode(Opcode, N1, N2);
if (VT != MVT::Flag) {
SelectionDAGCSEMap::NodeID ID(Opcode, VTs, N1, N2);
void *IP = 0;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
return SDOperand(E, 0);
N = new SDNode(Opcode, N1, N2);
- N->setValueTypes(VTs, 1);
CSEMap.InsertNode(N, IP);
} else {
N = new SDNode(Opcode, N1, N2);
CSEMap.InsertNode(N, IP);
} else {
N = new SDNode(Opcode, N1, N2);
- N->setValueTypes(VTs, 1);
// Memoize node if it doesn't produce a flag.
SDNode *N;
// Memoize node if it doesn't produce a flag.
SDNode *N;
- const MVT::ValueType *VTs = getNodeValueTypes(VT);
-
+ SDVTList VTs = getVTList(VT);
if (VT != MVT::Flag) {
SelectionDAGCSEMap::NodeID ID(Opcode, VTs, N1, N2, N3);
void *IP = 0;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
return SDOperand(E, 0);
N = new SDNode(Opcode, N1, N2, N3);
if (VT != MVT::Flag) {
SelectionDAGCSEMap::NodeID ID(Opcode, VTs, N1, N2, N3);
void *IP = 0;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
return SDOperand(E, 0);
N = new SDNode(Opcode, N1, N2, N3);
- N->setValueTypes(VTs, 1);
CSEMap.InsertNode(N, IP);
} else {
N = new SDNode(Opcode, N1, N2, N3);
CSEMap.InsertNode(N, IP);
} else {
N = new SDNode(Opcode, N1, N2, N3);
- N->setValueTypes(VTs, 1);
}
AllNodes.push_back(N);
return SDOperand(N, 0);
}
AllNodes.push_back(N);
return SDOperand(N, 0);
SDOperand SelectionDAG::getLoad(MVT::ValueType VT,
SDOperand Chain, SDOperand Ptr,
SDOperand SV) {
SDOperand SelectionDAG::getLoad(MVT::ValueType VT,
SDOperand Chain, SDOperand Ptr,
SDOperand SV) {
- const MVT::ValueType *VTs = getNodeValueTypes(VT, MVT::Other);
+ SDVTList VTs = getVTList(VT, MVT::Other);
SelectionDAGCSEMap::NodeID ID(ISD::LOAD, VTs, Chain, Ptr, SV);
void *IP = 0;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
return SDOperand(E, 0);
SDNode *N = new SDNode(ISD::LOAD, Chain, Ptr, SV);
SelectionDAGCSEMap::NodeID ID(ISD::LOAD, VTs, Chain, Ptr, SV);
void *IP = 0;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
return SDOperand(E, 0);
SDNode *N = new SDNode(ISD::LOAD, Chain, Ptr, SV);
- N->setValueTypes(VTs, 2);
CSEMap.InsertNode(N, IP);
AllNodes.push_back(N);
return SDOperand(N, 0);
CSEMap.InsertNode(N, IP);
AllNodes.push_back(N);
return SDOperand(N, 0);
// Memoize nodes.
SDNode *N;
// Memoize nodes.
SDNode *N;
- const MVT::ValueType *VTs = getNodeValueTypes(VT);
+ SDVTList VTs = getVTList(VT);
if (VT != MVT::Flag) {
SelectionDAGCSEMap::NodeID ID(Opcode, VTs, Ops, NumOps);
void *IP = 0;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
return SDOperand(E, 0);
N = new SDNode(Opcode, Ops, NumOps);
if (VT != MVT::Flag) {
SelectionDAGCSEMap::NodeID ID(Opcode, VTs, Ops, NumOps);
void *IP = 0;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
return SDOperand(E, 0);
N = new SDNode(Opcode, Ops, NumOps);
- N->setValueTypes(VTs, 1);
CSEMap.InsertNode(N, IP);
} else {
N = new SDNode(Opcode, Ops, NumOps);
CSEMap.InsertNode(N, IP);
} else {
N = new SDNode(Opcode, Ops, NumOps);
- N->setValueTypes(VTs, 1);
}
AllNodes.push_back(N);
return SDOperand(N, 0);
}
AllNodes.push_back(N);
return SDOperand(N, 0);
// Memoize the node unless it returns a flag.
SDNode *N;
// Memoize the node unless it returns a flag.
SDNode *N;
+ SDVTList VTList = makeVTList(VTs, NumVTs);
if (VTs[NumVTs-1] != MVT::Flag) {
SelectionDAGCSEMap::NodeID ID;
ID.SetOpcode(Opcode);
if (VTs[NumVTs-1] != MVT::Flag) {
SelectionDAGCSEMap::NodeID ID;
ID.SetOpcode(Opcode);
+ ID.SetValueTypes(VTList);
ID.SetOperands(&Ops[0], NumOps);
void *IP = 0;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
return SDOperand(E, 0);
N = new SDNode(Opcode, Ops, NumOps);
ID.SetOperands(&Ops[0], NumOps);
void *IP = 0;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
return SDOperand(E, 0);
N = new SDNode(Opcode, Ops, NumOps);
- N->setValueTypes(VTs, NumVTs);
+ N->setValueTypes(VTList);
CSEMap.InsertNode(N, IP);
} else {
N = new SDNode(Opcode, Ops, NumOps);
CSEMap.InsertNode(N, IP);
} else {
N = new SDNode(Opcode, Ops, NumOps);
- N->setValueTypes(VTs, NumVTs);
+ N->setValueTypes(VTList);
}
AllNodes.push_back(N);
return SDOperand(N, 0);
}
}
AllNodes.push_back(N);
return SDOperand(N, 0);
}
-/// makeVTList - Return an instance of the SDVTList struct initialized with the
-/// specified members.
-static SDVTList makeVTList(const MVT::ValueType *VTs, unsigned NumVTs) {
- SDVTList Res = {VTs, NumVTs};
- return Res;
-}
-
SDVTList SelectionDAG::getVTList(MVT::ValueType VT) {
return makeVTList(SDNode::getValueTypeList(VT), 1);
}
SDVTList SelectionDAG::getVTList(MVT::ValueType VT) {
return makeVTList(SDNode::getValueTypeList(VT), 1);
}
/// the current one.
SDOperand SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc,
MVT::ValueType VT) {
/// the current one.
SDOperand SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc,
MVT::ValueType VT) {
- const MVT::ValueType *VTs = getNodeValueTypes(VT);
+ SDVTList VTs = getVTList(VT);
SelectionDAGCSEMap::NodeID ID(ISD::BUILTIN_OP_END+TargetOpc, VTs);
void *IP = 0;
if (SDNode *ON = CSEMap.FindNodeOrInsertPos(ID, IP))
SelectionDAGCSEMap::NodeID ID(ISD::BUILTIN_OP_END+TargetOpc, VTs);
void *IP = 0;
if (SDNode *ON = CSEMap.FindNodeOrInsertPos(ID, IP))
RemoveNodeFromCSEMaps(N);
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc);
RemoveNodeFromCSEMaps(N);
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc);
- N->setValueTypes(getNodeValueTypes(VT), 1);
CSEMap.InsertNode(N, IP);
return SDOperand(N, 0);
CSEMap.InsertNode(N, IP);
return SDOperand(N, 0);
SDOperand SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc,
MVT::ValueType VT, SDOperand Op1) {
// If an identical node already exists, use it.
SDOperand SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc,
MVT::ValueType VT, SDOperand Op1) {
// If an identical node already exists, use it.
- const MVT::ValueType *VTs = getNodeValueTypes(VT);
+ SDVTList VTs = getVTList(VT);
SelectionDAGCSEMap::NodeID ID(ISD::BUILTIN_OP_END+TargetOpc, VTs, Op1);
void *IP = 0;
if (SDNode *ON = CSEMap.FindNodeOrInsertPos(ID, IP))
SelectionDAGCSEMap::NodeID ID(ISD::BUILTIN_OP_END+TargetOpc, VTs, Op1);
void *IP = 0;
if (SDNode *ON = CSEMap.FindNodeOrInsertPos(ID, IP))
RemoveNodeFromCSEMaps(N);
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc);
RemoveNodeFromCSEMaps(N);
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc);
- N->setValueTypes(getNodeValueTypes(VT), 1);
N->setOperands(Op1);
CSEMap.InsertNode(N, IP);
return SDOperand(N, 0);
N->setOperands(Op1);
CSEMap.InsertNode(N, IP);
return SDOperand(N, 0);
MVT::ValueType VT, SDOperand Op1,
SDOperand Op2) {
// If an identical node already exists, use it.
MVT::ValueType VT, SDOperand Op1,
SDOperand Op2) {
// If an identical node already exists, use it.
- const MVT::ValueType *VTs = getNodeValueTypes(VT);
+ SDVTList VTs = getVTList(VT);
SelectionDAGCSEMap::NodeID ID(ISD::BUILTIN_OP_END+TargetOpc, VTs, Op1, Op2);
void *IP = 0;
if (SDNode *ON = CSEMap.FindNodeOrInsertPos(ID, IP))
SelectionDAGCSEMap::NodeID ID(ISD::BUILTIN_OP_END+TargetOpc, VTs, Op1, Op2);
void *IP = 0;
if (SDNode *ON = CSEMap.FindNodeOrInsertPos(ID, IP))
RemoveNodeFromCSEMaps(N);
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc);
RemoveNodeFromCSEMaps(N);
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc);
- N->setValueTypes(VTs, 1);
N->setOperands(Op1, Op2);
CSEMap.InsertNode(N, IP); // Memoize the new node.
N->setOperands(Op1, Op2);
CSEMap.InsertNode(N, IP); // Memoize the new node.
MVT::ValueType VT, SDOperand Op1,
SDOperand Op2, SDOperand Op3) {
// If an identical node already exists, use it.
MVT::ValueType VT, SDOperand Op1,
SDOperand Op2, SDOperand Op3) {
// If an identical node already exists, use it.
- const MVT::ValueType *VTs = getNodeValueTypes(VT);
- SelectionDAGCSEMap::NodeID ID(ISD::BUILTIN_OP_END+TargetOpc, VTs, Op1, Op2, Op3);
+ SDVTList VTs = getVTList(VT);
+ SelectionDAGCSEMap::NodeID ID(ISD::BUILTIN_OP_END+TargetOpc, VTs,
+ Op1, Op2, Op3);
void *IP = 0;
if (SDNode *ON = CSEMap.FindNodeOrInsertPos(ID, IP))
return SDOperand(ON, 0);
RemoveNodeFromCSEMaps(N);
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc);
void *IP = 0;
if (SDNode *ON = CSEMap.FindNodeOrInsertPos(ID, IP))
return SDOperand(ON, 0);
RemoveNodeFromCSEMaps(N);
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc);
- N->setValueTypes(VTs, 1);
N->setOperands(Op1, Op2, Op3);
CSEMap.InsertNode(N, IP); // Memoize the new node.
N->setOperands(Op1, Op2, Op3);
CSEMap.InsertNode(N, IP); // Memoize the new node.
SDOperand Op2, SDOperand Op3,
SDOperand Op4) {
// If an identical node already exists, use it.
SDOperand Op2, SDOperand Op3,
SDOperand Op4) {
// If an identical node already exists, use it.
- const MVT::ValueType *VTs = getNodeValueTypes(VT);
+ SDVTList VTs = getVTList(VT);
SelectionDAGCSEMap::NodeID ID(ISD::BUILTIN_OP_END+TargetOpc, VTs);
ID.AddOperand(Op1);
ID.AddOperand(Op2);
SelectionDAGCSEMap::NodeID ID(ISD::BUILTIN_OP_END+TargetOpc, VTs);
ID.AddOperand(Op1);
ID.AddOperand(Op2);
RemoveNodeFromCSEMaps(N);
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc);
RemoveNodeFromCSEMaps(N);
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc);
- N->setValueTypes(VTs, 1);
N->setOperands(Op1, Op2, Op3, Op4);
CSEMap.InsertNode(N, IP); // Memoize the new node.
N->setOperands(Op1, Op2, Op3, Op4);
CSEMap.InsertNode(N, IP); // Memoize the new node.
MVT::ValueType VT, SDOperand Op1,
SDOperand Op2, SDOperand Op3,
SDOperand Op4, SDOperand Op5) {
MVT::ValueType VT, SDOperand Op1,
SDOperand Op2, SDOperand Op3,
SDOperand Op4, SDOperand Op5) {
- const MVT::ValueType *VTs = getNodeValueTypes(VT);
+ SDVTList VTs = getVTList(VT);
SelectionDAGCSEMap::NodeID ID(ISD::BUILTIN_OP_END+TargetOpc, VTs);
ID.AddOperand(Op1);
ID.AddOperand(Op2);
SelectionDAGCSEMap::NodeID ID(ISD::BUILTIN_OP_END+TargetOpc, VTs);
ID.AddOperand(Op1);
ID.AddOperand(Op2);
RemoveNodeFromCSEMaps(N);
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc);
RemoveNodeFromCSEMaps(N);
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc);
- N->setValueTypes(VTs, 1);
N->setOperands(Op1, Op2, Op3, Op4, Op5);
CSEMap.InsertNode(N, IP); // Memoize the new node.
N->setOperands(Op1, Op2, Op3, Op4, Op5);
CSEMap.InsertNode(N, IP); // Memoize the new node.
MVT::ValueType VT, SDOperand Op1,
SDOperand Op2, SDOperand Op3,SDOperand Op4,
SDOperand Op5, SDOperand Op6) {
MVT::ValueType VT, SDOperand Op1,
SDOperand Op2, SDOperand Op3,SDOperand Op4,
SDOperand Op5, SDOperand Op6) {
- const MVT::ValueType *VTs = getNodeValueTypes(VT);
+ SDVTList VTs = getVTList(VT);
SelectionDAGCSEMap::NodeID ID(ISD::BUILTIN_OP_END+TargetOpc, VTs);
ID.AddOperand(Op1);
ID.AddOperand(Op2);
SelectionDAGCSEMap::NodeID ID(ISD::BUILTIN_OP_END+TargetOpc, VTs);
ID.AddOperand(Op1);
ID.AddOperand(Op2);
RemoveNodeFromCSEMaps(N);
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc);
RemoveNodeFromCSEMaps(N);
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc);
- N->setValueTypes(VTs, 1);
N->setOperands(Op1, Op2, Op3, Op4, Op5, Op6);
CSEMap.InsertNode(N, IP); // Memoize the new node.
N->setOperands(Op1, Op2, Op3, Op4, Op5, Op6);
CSEMap.InsertNode(N, IP); // Memoize the new node.
SDOperand Op2, SDOperand Op3,SDOperand Op4,
SDOperand Op5, SDOperand Op6,
SDOperand Op7) {
SDOperand Op2, SDOperand Op3,SDOperand Op4,
SDOperand Op5, SDOperand Op6,
SDOperand Op7) {
- const MVT::ValueType *VTs = getNodeValueTypes(VT);
+ SDVTList VTs = getVTList(VT);
// If an identical node already exists, use it.
SelectionDAGCSEMap::NodeID ID(ISD::BUILTIN_OP_END+TargetOpc, VTs);
ID.AddOperand(Op1);
// If an identical node already exists, use it.
SelectionDAGCSEMap::NodeID ID(ISD::BUILTIN_OP_END+TargetOpc, VTs);
ID.AddOperand(Op1);
RemoveNodeFromCSEMaps(N);
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc);
RemoveNodeFromCSEMaps(N);
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc);
- N->setValueTypes(VTs, 1);
N->setOperands(Op1, Op2, Op3, Op4, Op5, Op6, Op7);
CSEMap.InsertNode(N, IP); // Memoize the new node.
N->setOperands(Op1, Op2, Op3, Op4, Op5, Op6, Op7);
CSEMap.InsertNode(N, IP); // Memoize the new node.
SDOperand Op5, SDOperand Op6,
SDOperand Op7, SDOperand Op8) {
// If an identical node already exists, use it.
SDOperand Op5, SDOperand Op6,
SDOperand Op7, SDOperand Op8) {
// If an identical node already exists, use it.
- const MVT::ValueType *VTs = getNodeValueTypes(VT);
+ SDVTList VTs = getVTList(VT);
SelectionDAGCSEMap::NodeID ID(ISD::BUILTIN_OP_END+TargetOpc, VTs);
ID.AddOperand(Op1);
ID.AddOperand(Op2);
SelectionDAGCSEMap::NodeID ID(ISD::BUILTIN_OP_END+TargetOpc, VTs);
ID.AddOperand(Op1);
ID.AddOperand(Op2);
RemoveNodeFromCSEMaps(N);
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc);
RemoveNodeFromCSEMaps(N);
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc);
- N->setValueTypes(VTs, 1);
N->setOperands(Op1, Op2, Op3, Op4, Op5, Op6, Op7, Op8);
CSEMap.InsertNode(N, IP); // Memoize the new node.
N->setOperands(Op1, Op2, Op3, Op4, Op5, Op6, Op7, Op8);
CSEMap.InsertNode(N, IP); // Memoize the new node.
SDOperand SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc,
MVT::ValueType VT1, MVT::ValueType VT2,
SDOperand Op1, SDOperand Op2) {
SDOperand SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc,
MVT::ValueType VT1, MVT::ValueType VT2,
SDOperand Op1, SDOperand Op2) {
- const MVT::ValueType *VTs = getNodeValueTypes(VT1, VT2);
+ SDVTList VTs = getVTList(VT1, VT2);
SelectionDAGCSEMap::NodeID ID(ISD::BUILTIN_OP_END+TargetOpc, VTs, Op1, Op2);
void *IP = 0;
if (SDNode *ON = CSEMap.FindNodeOrInsertPos(ID, IP))
SelectionDAGCSEMap::NodeID ID(ISD::BUILTIN_OP_END+TargetOpc, VTs, Op1, Op2);
void *IP = 0;
if (SDNode *ON = CSEMap.FindNodeOrInsertPos(ID, IP))
RemoveNodeFromCSEMaps(N);
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc);
RemoveNodeFromCSEMaps(N);
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc);
- N->setValueTypes(VTs, 2);
N->setOperands(Op1, Op2);
CSEMap.InsertNode(N, IP); // Memoize the new node.
N->setOperands(Op1, Op2);
CSEMap.InsertNode(N, IP); // Memoize the new node.
SDOperand Op1, SDOperand Op2,
SDOperand Op3) {
// If an identical node already exists, use it.
SDOperand Op1, SDOperand Op2,
SDOperand Op3) {
// If an identical node already exists, use it.
- const MVT::ValueType *VTs = getNodeValueTypes(VT1, VT2);
+ SDVTList VTs = getVTList(VT1, VT2);
SelectionDAGCSEMap::NodeID ID(ISD::BUILTIN_OP_END+TargetOpc, VTs,
Op1, Op2, Op3);
void *IP = 0;
SelectionDAGCSEMap::NodeID ID(ISD::BUILTIN_OP_END+TargetOpc, VTs,
Op1, Op2, Op3);
void *IP = 0;
RemoveNodeFromCSEMaps(N);
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc);
RemoveNodeFromCSEMaps(N);
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc);
- N->setValueTypes(VTs, 2);
N->setOperands(Op1, Op2, Op3);
CSEMap.InsertNode(N, IP); // Memoize the new node.
N->setOperands(Op1, Op2, Op3);
CSEMap.InsertNode(N, IP); // Memoize the new node.
SDOperand Op1, SDOperand Op2,
SDOperand Op3, SDOperand Op4) {
// If an identical node already exists, use it.
SDOperand Op1, SDOperand Op2,
SDOperand Op3, SDOperand Op4) {
// If an identical node already exists, use it.
- const MVT::ValueType *VTs = getNodeValueTypes(VT1, VT2);
+ SDVTList VTs = getVTList(VT1, VT2);
SelectionDAGCSEMap::NodeID ID(ISD::BUILTIN_OP_END+TargetOpc, VTs);
ID.AddOperand(Op1);
ID.AddOperand(Op2);
SelectionDAGCSEMap::NodeID ID(ISD::BUILTIN_OP_END+TargetOpc, VTs);
ID.AddOperand(Op1);
ID.AddOperand(Op2);
RemoveNodeFromCSEMaps(N);
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc);
RemoveNodeFromCSEMaps(N);
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc);
- N->setValueTypes(VTs, 2);
N->setOperands(Op1, Op2, Op3, Op4);
CSEMap.InsertNode(N, IP); // Memoize the new node.
N->setOperands(Op1, Op2, Op3, Op4);
CSEMap.InsertNode(N, IP); // Memoize the new node.
SDOperand Op3, SDOperand Op4,
SDOperand Op5) {
// If an identical node already exists, use it.
SDOperand Op3, SDOperand Op4,
SDOperand Op5) {
// If an identical node already exists, use it.
- const MVT::ValueType *VTs = getNodeValueTypes(VT1, VT2);
+ SDVTList VTs = getVTList(VT1, VT2);
SelectionDAGCSEMap::NodeID ID(ISD::BUILTIN_OP_END+TargetOpc, VTs);
ID.AddOperand(Op1);
ID.AddOperand(Op2);
SelectionDAGCSEMap::NodeID ID(ISD::BUILTIN_OP_END+TargetOpc, VTs);
ID.AddOperand(Op1);
ID.AddOperand(Op2);
RemoveNodeFromCSEMaps(N);
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc);
RemoveNodeFromCSEMaps(N);
N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc);
- N->setValueTypes(VTs, 2);
N->setOperands(Op1, Op2, Op3, Op4, Op5);
CSEMap.InsertNode(N, IP); // Memoize the new node.
N->setOperands(Op1, Op2, Op3, Op4, Op5);
CSEMap.InsertNode(N, IP); // Memoize the new node.
//===----------------------------------------------------------------------===//
// SelectionDAGCSEMap::NodeID Implementation
//===----------------------------------------------------------------------===//
// SelectionDAGCSEMap::NodeID Implementation
+/// SetValueTypes - Value type lists are intern'd so we can represent them
+/// solely with their pointer.
+void SelectionDAGCSEMap::NodeID::SetValueTypes(SDVTList VTList) {
+ AddPointer(VTList.VTs);
+}
+
SelectionDAGCSEMap::NodeID::NodeID(SDNode *N) {
SetOpcode(N->getOpcode());
// Add the return value info.
SelectionDAGCSEMap::NodeID::NodeID(SDNode *N) {
SetOpcode(N->getOpcode());
// Add the return value info.
- SetValueTypes(N->value_begin());
+ SetValueTypes(N->getVTList());
// Add the operand info.
SetOperands(N->op_begin(), N->getNumOperands());
// Add the operand info.
SetOperands(N->op_begin(), N->getNumOperands());
-SelectionDAGCSEMap::NodeID::NodeID(unsigned short ID, const void *VTList) {
+SelectionDAGCSEMap::NodeID::NodeID(unsigned short ID, SDVTList VTList) {
SetOpcode(ID);
SetValueTypes(VTList);
SetOperands();
}
SetOpcode(ID);
SetValueTypes(VTList);
SetOperands();
}
-SelectionDAGCSEMap::NodeID::NodeID(unsigned short ID, const void *VTList,
+SelectionDAGCSEMap::NodeID::NodeID(unsigned short ID, SDVTList VTList,
SDOperand Op) {
SetOpcode(ID);
SetValueTypes(VTList);
SetOperands(Op);
}
SDOperand Op) {
SetOpcode(ID);
SetValueTypes(VTList);
SetOperands(Op);
}
-SelectionDAGCSEMap::NodeID::NodeID(unsigned short ID, const void *VTList,
+SelectionDAGCSEMap::NodeID::NodeID(unsigned short ID, SDVTList VTList,
SDOperand Op1, SDOperand Op2) {
SetOpcode(ID);
SetValueTypes(VTList);
SetOperands(Op1, Op2);
}
SDOperand Op1, SDOperand Op2) {
SetOpcode(ID);
SetValueTypes(VTList);
SetOperands(Op1, Op2);
}
-SelectionDAGCSEMap::NodeID::NodeID(unsigned short ID, const void *VTList,
+SelectionDAGCSEMap::NodeID::NodeID(unsigned short ID, SDVTList VTList,
SDOperand Op1, SDOperand Op2,
SDOperand Op3) {
SetOpcode(ID);
SetValueTypes(VTList);
SetOperands(Op1, Op2, Op3);
}
SDOperand Op1, SDOperand Op2,
SDOperand Op3) {
SetOpcode(ID);
SetValueTypes(VTList);
SetOperands(Op1, Op2, Op3);
}
-SelectionDAGCSEMap::NodeID::NodeID(unsigned short ID, const void *VTList,
+SelectionDAGCSEMap::NodeID::NodeID(unsigned short ID, SDVTList VTList,
const SDOperand *OpList, unsigned N) {
SetOpcode(ID);
SetValueTypes(VTList);
const SDOperand *OpList, unsigned N) {
SetOpcode(ID);
SetValueTypes(VTList);