aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/CodeGen
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/CodeGen')
-rw-r--r--include/llvm/CodeGen/DAGISelHeader.h12
-rw-r--r--include/llvm/CodeGen/SelectionDAG.h10
-rw-r--r--include/llvm/CodeGen/SelectionDAGNodes.h61
3 files changed, 44 insertions, 39 deletions
diff --git a/include/llvm/CodeGen/DAGISelHeader.h b/include/llvm/CodeGen/DAGISelHeader.h
index d67b8fe0f6..257c59583f 100644
--- a/include/llvm/CodeGen/DAGISelHeader.h
+++ b/include/llvm/CodeGen/DAGISelHeader.h
@@ -37,7 +37,7 @@ static bool IsChainCompatible(SDNode *Chain, SDNode *Op) {
else if (Chain->getNumOperands() > 0) {
SDValue C0 = Chain->getOperand(0);
if (C0.getValueType() == MVT::Other)
- return C0.Val != Op && IsChainCompatible(C0.Val, Op);
+ return C0.getNode() != Op && IsChainCompatible(C0.getNode(), Op);
}
return true;
}
@@ -76,9 +76,9 @@ inline bool isSelected(int Id) {
/// AddToISelQueue - adds a node to the instruction
/// selection queue.
void AddToISelQueue(SDValue N) DISABLE_INLINE {
- int Id = N.Val->getNodeId();
+ int Id = N.getNode()->getNodeId();
if (Id != -1 && !isQueued(Id)) {
- ISelQueue.push_back(N.Val);
+ ISelQueue.push_back(N.getNode());
std::push_heap(ISelQueue.begin(), ISelQueue.end(), isel_sort());
setQueued(Id);
}
@@ -120,7 +120,7 @@ inline void UpdateQueue(const ISelQueueUpdater &ISQU) {
void ReplaceUses(SDValue F, SDValue T) DISABLE_INLINE {
ISelQueueUpdater ISQU(ISelQueue);
CurDAG->ReplaceAllUsesOfValueWith(F, T, &ISQU);
- setSelected(F.Val->getNodeId());
+ setSelected(F.getNode()->getNodeId());
UpdateQueue(ISQU);
}
@@ -131,7 +131,7 @@ void ReplaceUses(const SDValue *F, const SDValue *T,
ISelQueueUpdater ISQU(ISelQueue);
CurDAG->ReplaceAllUsesOfValuesWith(F, T, Num, &ISQU);
for (unsigned i = 0; i != Num; ++i)
- setSelected(F[i].Val->getNodeId());
+ setSelected(F[i].getNode()->getNodeId());
UpdateQueue(ISQU);
}
@@ -165,7 +165,7 @@ void SelectRoot() {
// a reference to the root node, preventing it from being deleted,
// and tracking any changes of the root.
HandleSDNode Dummy(CurDAG->getRoot());
- ISelQueue.push_back(CurDAG->getRoot().Val);
+ ISelQueue.push_back(CurDAG->getRoot().getNode());
// Select pending nodes from the instruction selection queue
// until no more nodes are left for selection.
diff --git a/include/llvm/CodeGen/SelectionDAG.h b/include/llvm/CodeGen/SelectionDAG.h
index 3f13663d51..9fb0dc44f9 100644
--- a/include/llvm/CodeGen/SelectionDAG.h
+++ b/include/llvm/CodeGen/SelectionDAG.h
@@ -170,7 +170,7 @@ public:
/// setRoot - Set the current root tag of the SelectionDAG.
///
const SDValue &setRoot(SDValue N) {
- assert((!N.Val || N.getValueType() == MVT::Other) &&
+ assert((!N.getNode() || N.getValueType() == MVT::Other) &&
"DAG root value is not a chain!");
return Root = N;
}
@@ -295,7 +295,7 @@ public:
SDValue Flag) {
const MVT *VTs = getNodeValueTypes(MVT::Other, MVT::Flag);
SDValue Ops[] = { Chain, getRegister(Reg, N.getValueType()), N, Flag };
- return getNode(ISD::CopyToReg, VTs, 2, Ops, Flag.Val ? 4 : 3);
+ return getNode(ISD::CopyToReg, VTs, 2, Ops, Flag.getNode() ? 4 : 3);
}
// Similar to last getCopyToReg() except parameter Reg is a SDValue
@@ -303,7 +303,7 @@ public:
SDValue Flag) {
const MVT *VTs = getNodeValueTypes(MVT::Other, MVT::Flag);
SDValue Ops[] = { Chain, Reg, N, Flag };
- return getNode(ISD::CopyToReg, VTs, 2, Ops, Flag.Val ? 4 : 3);
+ return getNode(ISD::CopyToReg, VTs, 2, Ops, Flag.getNode() ? 4 : 3);
}
SDValue getCopyFromReg(SDValue Chain, unsigned Reg, MVT VT) {
@@ -319,7 +319,7 @@ public:
SDValue Flag) {
const MVT *VTs = getNodeValueTypes(VT, MVT::Other, MVT::Flag);
SDValue Ops[] = { Chain, getRegister(Reg, VT), Flag };
- return getNode(ISD::CopyFromReg, VTs, 3, Ops, Flag.Val ? 3 : 2);
+ return getNode(ISD::CopyFromReg, VTs, 3, Ops, Flag.getNode() ? 3 : 2);
}
SDValue getCondCode(ISD::CondCode Cond);
@@ -347,7 +347,7 @@ public:
Ops.push_back(Op2);
Ops.push_back(InFlag);
return getNode(ISD::CALLSEQ_END, NodeTys, &Ops[0],
- (unsigned)Ops.size() - (InFlag.Val == 0 ? 1 : 0));
+ (unsigned)Ops.size() - (InFlag.getNode() == 0 ? 1 : 0));
}
/// getNode - Gets or creates the specified node.
diff --git a/include/llvm/CodeGen/SelectionDAGNodes.h b/include/llvm/CodeGen/SelectionDAGNodes.h
index 8693173ca4..387f9268ea 100644
--- a/include/llvm/CodeGen/SelectionDAGNodes.h
+++ b/include/llvm/CodeGen/SelectionDAGNodes.h
@@ -837,29 +837,33 @@ namespace ISD {
/// of information is represented with the SDValue value type.
///
class SDValue {
-public:
- SDNode *Val; // The node defining the value we are using.
-private:
+ SDNode *Node; // The node defining the value we are using.
unsigned ResNo; // Which return value of the node we are using.
public:
- SDValue() : Val(0), ResNo(0) {}
- SDValue(SDNode *val, unsigned resno) : Val(val), ResNo(resno) {}
+ SDValue() : Node(0), ResNo(0) {}
+ SDValue(SDNode *node, unsigned resno) : Node(node), ResNo(resno) {}
/// get the index which selects a specific result in the SDNode
unsigned getResNo() const { return ResNo; }
+ /// get the SDNode which holds the desired result
+ SDNode *getNode() const { return Node; }
+
+ /// set the SDNode
+ void setNode(SDNode *N) { Node = N; }
+
bool operator==(const SDValue &O) const {
- return Val == O.Val && ResNo == O.ResNo;
+ return Node == O.Node && ResNo == O.ResNo;
}
bool operator!=(const SDValue &O) const {
return !operator==(O);
}
bool operator<(const SDValue &O) const {
- return Val < O.Val || (Val == O.Val && ResNo < O.ResNo);
+ return Node < O.Node || (Node == O.Node && ResNo < O.ResNo);
}
SDValue getValue(unsigned R) const {
- return SDValue(Val, R);
+ return SDValue(Node, R);
}
// isOperandOf - Return true if this node is an operand of N.
@@ -894,12 +898,12 @@ public:
unsigned Depth = 2) const;
/// use_empty - Return true if there are no nodes using value ResNo
- /// of node Val.
+ /// of Node.
///
inline bool use_empty() const;
/// hasOneUse - Return true if there is exactly one node using value
- /// ResNo of node Val.
+ /// ResNo of Node.
///
inline bool hasOneUse() const;
};
@@ -913,8 +917,8 @@ template<> struct DenseMapInfo<SDValue> {
return SDValue((SDNode*)-1, 0);
}
static unsigned getHashValue(const SDValue &Val) {
- return ((unsigned)((uintptr_t)Val.Val >> 4) ^
- (unsigned)((uintptr_t)Val.Val >> 9)) + Val.getResNo();
+ return ((unsigned)((uintptr_t)Val.getNode() >> 4) ^
+ (unsigned)((uintptr_t)Val.getNode() >> 9)) + Val.getResNo();
}
static bool isEqual(const SDValue &LHS, const SDValue &RHS) {
return LHS == RHS;
@@ -927,13 +931,13 @@ template<> struct DenseMapInfo<SDValue> {
template<> struct simplify_type<SDValue> {
typedef SDNode* SimpleType;
static SimpleType getSimplifiedValue(const SDValue &Val) {
- return static_cast<SimpleType>(Val.Val);
+ return static_cast<SimpleType>(Val.getNode());
}
};
template<> struct simplify_type<const SDValue> {
typedef SDNode* SimpleType;
static SimpleType getSimplifiedValue(const SDValue &Val) {
- return static_cast<SimpleType>(Val.Val);
+ return static_cast<SimpleType>(Val.getNode());
}
};
@@ -977,8 +981,9 @@ public:
const SDValue& getSDValue() const { return Operand; }
- SDNode *&getVal() { return Operand.Val; }
- SDNode *const &getVal() const { return Operand.Val; }
+ SDValue &getSDValue() { return Operand; }
+ SDNode *getVal() { return Operand.getNode(); }
+ SDNode *getVal() const { return Operand.getNode(); } // FIXME: const correct?
bool operator==(const SDValue &O) const {
return Operand == O;
@@ -1323,7 +1328,7 @@ protected:
for (unsigned i = 0; i != NumOps; ++i) {
OperandList[i] = Ops[i];
OperandList[i].setUser(this);
- Ops[i].Val->addUse(OperandList[i]);
+ Ops[i].getNode()->addUse(OperandList[i]);
}
ValueList = VTs.VTs;
@@ -1393,34 +1398,34 @@ protected:
// Define inline functions from the SDValue class.
inline unsigned SDValue::getOpcode() const {
- return Val->getOpcode();
+ return Node->getOpcode();
}
inline MVT SDValue::getValueType() const {
- return Val->getValueType(ResNo);
+ return Node->getValueType(ResNo);
}
inline unsigned SDValue::getNumOperands() const {
- return Val->getNumOperands();
+ return Node->getNumOperands();
}
inline const SDValue &SDValue::getOperand(unsigned i) const {
- return Val->getOperand(i);
+ return Node->getOperand(i);
}
inline uint64_t SDValue::getConstantOperandVal(unsigned i) const {
- return Val->getConstantOperandVal(i);
+ return Node->getConstantOperandVal(i);
}
inline bool SDValue::isTargetOpcode() const {
- return Val->isTargetOpcode();
+ return Node->isTargetOpcode();
}
inline bool SDValue::isMachineOpcode() const {
- return Val->isMachineOpcode();
+ return Node->isMachineOpcode();
}
inline unsigned SDValue::getMachineOpcode() const {
- return Val->getMachineOpcode();
+ return Node->getMachineOpcode();
}
inline bool SDValue::use_empty() const {
- return !Val->hasAnyUseOfValue(ResNo);
+ return !Node->hasAnyUseOfValue(ResNo);
}
inline bool SDValue::hasOneUse() const {
- return Val->hasNUsesOfValue(1, ResNo);
+ return Node->hasNUsesOfValue(1, ResNo);
}
/// UnarySDNode - This class is used for single-operand SDNodes. This is solely
@@ -2321,7 +2326,7 @@ public:
}
pointer operator*() const {
- return Node->getOperand(Operand).Val;
+ return Node->getOperand(Operand).getNode();
}
pointer operator->() const { return operator*(); }