aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/CodeGen/DAGISelHeader.h12
-rw-r--r--include/llvm/CodeGen/SelectionDAG.h10
-rw-r--r--include/llvm/CodeGen/SelectionDAGNodes.h61
-rw-r--r--include/llvm/Target/TargetLowering.h8
-rw-r--r--lib/CodeGen/SelectionDAG/DAGCombiner.cpp598
-rw-r--r--lib/CodeGen/SelectionDAG/LegalizeDAG.cpp262
-rw-r--r--lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp36
-rw-r--r--lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp38
-rw-r--r--lib/CodeGen/SelectionDAG/LegalizeTypes.cpp85
-rw-r--r--lib/CodeGen/SelectionDAG/LegalizeTypes.h11
-rw-r--r--lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp2
-rw-r--r--lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp18
-rw-r--r--lib/CodeGen/SelectionDAG/ScheduleDAG.cpp20
-rw-r--r--lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp12
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAG.cpp180
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp60
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp6
-rw-r--r--lib/CodeGen/SelectionDAG/TargetLowering.cpp72
-rw-r--r--lib/Target/ARM/ARMISelDAGToDAG.cpp20
-rw-r--r--lib/Target/ARM/ARMISelLowering.cpp24
-rw-r--r--lib/Target/Alpha/AlphaISelDAGToDAG.cpp8
-rw-r--r--lib/Target/Alpha/AlphaISelLowering.cpp22
-rw-r--r--lib/Target/CellSPU/SPUISelDAGToDAG.cpp6
-rw-r--r--lib/Target/CellSPU/SPUISelLowering.cpp70
-rw-r--r--lib/Target/CellSPU/SPUOperands.td46
-rw-r--r--lib/Target/IA64/IA64ISelDAGToDAG.cpp6
-rw-r--r--lib/Target/IA64/IA64ISelLowering.cpp8
-rw-r--r--lib/Target/Mips/MipsISelDAGToDAG.cpp8
-rw-r--r--lib/Target/Mips/MipsISelLowering.cpp18
-rw-r--r--lib/Target/PIC16/PIC16ISelDAGToDAG.cpp12
-rw-r--r--lib/Target/PIC16/PIC16ISelLowering.cpp16
-rw-r--r--lib/Target/PowerPC/PPCISelDAGToDAG.cpp24
-rw-r--r--lib/Target/PowerPC/PPCISelLowering.cpp144
-rw-r--r--lib/Target/PowerPC/PPCInstrAltivec.td6
-rw-r--r--lib/Target/Sparc/SparcISelDAGToDAG.cpp4
-rw-r--r--lib/Target/Sparc/SparcISelLowering.cpp16
-rw-r--r--lib/Target/X86/X86ISelDAGToDAG.cpp144
-rw-r--r--lib/Target/X86/X86ISelLowering.cpp216
-rw-r--r--utils/TableGen/DAGISelEmitter.cpp68
39 files changed, 1195 insertions, 1182 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*(); }
diff --git a/include/llvm/Target/TargetLowering.h b/include/llvm/Target/TargetLowering.h
index c0c153c2fe..2b51b2f7ab 100644
--- a/include/llvm/Target/TargetLowering.h
+++ b/include/llvm/Target/TargetLowering.h
@@ -1086,11 +1086,11 @@ public:
static bool CheckTailCallReturnConstraints(SDValue Call, SDValue Ret) {
unsigned NumOps = Ret.getNumOperands();
if ((NumOps == 1 &&
- (Ret.getOperand(0) == SDValue(Call.Val,1) ||
- Ret.getOperand(0) == SDValue(Call.Val,0))) ||
+ (Ret.getOperand(0) == SDValue(Call.getNode(),1) ||
+ Ret.getOperand(0) == SDValue(Call.getNode(),0))) ||
(NumOps > 1 &&
- Ret.getOperand(0) == SDValue(Call.Val,Call.Val->getNumValues()-1) &&
- Ret.getOperand(1) == SDValue(Call.Val,0)))
+ Ret.getOperand(0) == SDValue(Call.getNode(),Call.getNode()->getNumValues()-1) &&
+ Ret.getOperand(1) == SDValue(Call.getNode(),0)))
return true;
return false;
}
diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 15133b368e..a57d815c2d 100644
--- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -148,8 +148,8 @@ namespace {
// Visitation implementation - Implement dag node combining for different
// node types. The semantics are as follows:
// Return Value:
- // SDValue.Val == 0 - No change was made
- // SDValue.Val == N - N was replaced, is dead, and is already handled.
+ // SDValue.getNode() == 0 - No change was made
+ // SDValue.getNode() == N - N was replaced, is dead, and is already handled.
// otherwise - N should be replaced by the returned Operand.
//
SDValue visitTokenFactor(SDNode *N);
@@ -491,7 +491,7 @@ static bool isSetCCEquivalent(SDValue N, SDValue &LHS, SDValue &RHS,
// free when it is profitable to do so.
static bool isOneUseSetCC(SDValue N) {
SDValue N0, N1, N2;
- if (isSetCCEquivalent(N, N0, N1, N2) && N.Val->hasOneUse())
+ if (isSetCCEquivalent(N, N0, N1, N2) && N.getNode()->hasOneUse())
return true;
return false;
}
@@ -503,11 +503,11 @@ SDValue DAGCombiner::ReassociateOps(unsigned Opc, SDValue N0, SDValue N1){
if (N0.getOpcode() == Opc && isa<ConstantSDNode>(N0.getOperand(1))) {
if (isa<ConstantSDNode>(N1)) {
SDValue OpNode = DAG.getNode(Opc, VT, N0.getOperand(1), N1);
- AddToWorkList(OpNode.Val);
+ AddToWorkList(OpNode.getNode());
return DAG.getNode(Opc, VT, OpNode, N0.getOperand(0));
} else if (N0.hasOneUse()) {
SDValue OpNode = DAG.getNode(Opc, VT, N0.getOperand(0), N1);
- AddToWorkList(OpNode.Val);
+ AddToWorkList(OpNode.getNode());
return DAG.getNode(Opc, VT, OpNode, N0.getOperand(1));
}
}
@@ -516,11 +516,11 @@ SDValue DAGCombiner::ReassociateOps(unsigned Opc, SDValue N0, SDValue N1){
if (N1.getOpcode() == Opc && isa<ConstantSDNode>(N1.getOperand(1))) {
if (isa<ConstantSDNode>(N0)) {
SDValue OpNode = DAG.getNode(Opc, VT, N1.getOperand(1), N0);
- AddToWorkList(OpNode.Val);
+ AddToWorkList(OpNode.getNode());
return DAG.getNode(Opc, VT, OpNode, N1.getOperand(0));
} else if (N1.hasOneUse()) {
SDValue OpNode = DAG.getNode(Opc, VT, N1.getOperand(0), N0);
- AddToWorkList(OpNode.Val);
+ AddToWorkList(OpNode.getNode());
return DAG.getNode(Opc, VT, OpNode, N1.getOperand(1));
}
}
@@ -532,7 +532,7 @@ SDValue DAGCombiner::CombineTo(SDNode *N, const SDValue *To, unsigned NumTo,
assert(N->getNumValues() == NumTo && "Broken CombineTo call!");
++NodesCombined;
DOUT << "\nReplacing.1 "; DEBUG(N->dump(&DAG));
- DOUT << "\nWith: "; DEBUG(To[0].Val->dump(&DAG));
+ DOUT << "\nWith: "; DEBUG(To[0].getNode()->dump(&DAG));
DOUT << " and " << NumTo-1 << " other values\n";
WorkListRemover DeadNodes(*this);
DAG.ReplaceAllUsesWith(N, To, &DeadNodes);
@@ -540,8 +540,8 @@ SDValue DAGCombiner::CombineTo(SDNode *N, const SDValue *To, unsigned NumTo,
if (AddTo) {
// Push the new nodes and any users onto the worklist
for (unsigned i = 0, e = NumTo; i != e; ++i) {
- AddToWorkList(To[i].Val);
- AddUsersToWorkList(To[i].Val);
+ AddToWorkList(To[i].getNode());
+ AddUsersToWorkList(To[i].getNode());
}
}
@@ -564,12 +564,12 @@ bool DAGCombiner::SimplifyDemandedBits(SDValue Op, const APInt &Demanded) {
return false;
// Revisit the node.
- AddToWorkList(Op.Val);
+ AddToWorkList(Op.getNode());
// Replace the old value with the new one.
++NodesCombined;
- DOUT << "\nReplacing.2 "; DEBUG(TLO.Old.Val->dump(&DAG));
- DOUT << "\nWith: "; DEBUG(TLO.New.Val->dump(&DAG));
+ DOUT << "\nReplacing.2 "; DEBUG(TLO.Old.getNode()->dump(&DAG));
+ DOUT << "\nWith: "; DEBUG(TLO.New.getNode()->dump(&DAG));
DOUT << '\n';
// Replace all uses. If any nodes become isomorphic to other nodes and
@@ -578,22 +578,22 @@ bool DAGCombiner::SimplifyDemandedBits(SDValue Op, const APInt &Demanded) {
DAG.ReplaceAllUsesOfValueWith(TLO.Old, TLO.New, &DeadNodes);
// Push the new node and any (possibly new) users onto the worklist.
- AddToWorkList(TLO.New.Val);
- AddUsersToWorkList(TLO.New.Val);
+ AddToWorkList(TLO.New.getNode());
+ AddUsersToWorkList(TLO.New.getNode());
// Finally, if the node is now dead, remove it from the graph. The node
// may not be dead if the replacement process recursively simplified to
// something else needing this node.
- if (TLO.Old.Val->use_empty()) {
- removeFromWorkList(TLO.Old.Val);
+ if (TLO.Old.getNode()->use_empty()) {
+ removeFromWorkList(TLO.Old.getNode());
// If the operands of this node are only used by the node, they will now
// be dead. Make sure to visit them first to delete dead nodes early.
- for (unsigned i = 0, e = TLO.Old.Val->getNumOperands(); i != e; ++i)
- if (TLO.Old.Val->getOperand(i).Val->hasOneUse())
- AddToWorkList(TLO.Old.Val->getOperand(i).Val);
+ for (unsigned i = 0, e = TLO.Old.getNode()->getNumOperands(); i != e; ++i)
+ if (TLO.Old.getNode()->getOperand(i).getNode()->hasOneUse())
+ AddToWorkList(TLO.Old.getNode()->getOperand(i).getNode());
- DAG.DeleteNode(TLO.Old.Val);
+ DAG.DeleteNode(TLO.Old.getNode());
}
return true;
}
@@ -608,7 +608,7 @@ void DAGCombiner::ProcessNode(SDNode *N) {
// reduced number of uses, allowing other xforms.
if (N->use_empty() && N != &Dummy) {
for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i)
- AddToWorkList(N->getOperand(i).Val);
+ AddToWorkList(N->getOperand(i).getNode());
DAG.DeleteNode(N);
return;
@@ -616,7 +616,7 @@ void DAGCombiner::ProcessNode(SDNode *N) {
SDValue RV = combine(N);
- if (RV.Val == 0)
+ if (RV.getNode() == 0)
return;
++NodesCombined;
@@ -625,19 +625,19 @@ void DAGCombiner::ProcessNode(SDNode *N) {
// zero, we know that the node must have defined multiple values and
// CombineTo was used. Since CombineTo takes care of the worklist
// mechanics for us, we have no work to do in this case.
- if (RV.Val == N)
+ if (RV.getNode() == N)
return;
assert(N->getOpcode() != ISD::DELETED_NODE &&
- RV.Val->getOpcode() != ISD::DELETED_NODE &&
+ RV.getNode()->getOpcode() != ISD::DELETED_NODE &&
"Node was deleted but visit returned new node!");
DOUT << "\nReplacing.3 "; DEBUG(N->dump(&DAG));
- DOUT << "\nWith: "; DEBUG(RV.Val->dump(&DAG));
+ DOUT << "\nWith: "; DEBUG(RV.getNode()->dump(&DAG));
DOUT << '\n';
- if (N->getNumValues() == RV.Val->getNumValues())
- DAG.ReplaceAllUsesWith(N, RV.Val);
+ if (N->getNumValues() == RV.getNode()->getNumValues())
+ DAG.ReplaceAllUsesWith(N, RV.getNode());
else {
assert(N->getValueType(0) == RV.getValueType() &&
N->getNumValues() == 1 && "Type mismatch");
@@ -650,8 +650,8 @@ void DAGCombiner::ProcessNode(SDNode *N) {
DAG.DeleteNode(N);
// Push the new node and any users onto the worklist
- AddToWorkList(RV.Val);
- AddUsersToWorkList(RV.Val);
+ AddToWorkList(RV.getNode());
+ AddUsersToWorkList(RV.getNode());
}
void DAGCombiner::Run(bool RunningAfterLegalize) {
@@ -761,7 +761,7 @@ SDValue DAGCombiner::combine(SDNode *N) {
SDValue RV = visit(N);
// If nothing happened, try a target-specific DAG combine.
- if (RV.Val == 0) {
+ if (RV.getNode() == 0) {
assert(N->getOpcode() != ISD::DELETED_NODE &&
"Node was deleted but visit returned NULL!");
@@ -778,7 +778,7 @@ SDValue DAGCombiner::combine(SDNode *N) {
// If N is a commutative binary node, try commuting it to enable more
// sdisel CSE.
- if (RV.Val == 0 &&
+ if (RV.getNode() == 0 &&
SelectionDAG::isCommutativeBinOp(N->getOpcode()) &&
N->getNumValues() == 1) {
SDValue N0 = N->getOperand(0);
@@ -815,9 +815,9 @@ SDValue DAGCombiner::visitTokenFactor(SDNode *N) {
// If N has two operands, where one has an input chain equal to the other,
// the 'other' chain is redundant.
if (N->getNumOperands() == 2) {
- if (getInputChainForNode(N->getOperand(0).Val) == N->getOperand(1))
+ if (getInputChainForNode(N->getOperand(0).getNode()) == N->getOperand(1))
return N->getOperand(0);
- if (getInputChainForNode(N->getOperand(1).Val) == N->getOperand(0))
+ if (getInputChainForNode(N->getOperand(1).getNode()) == N->getOperand(0))
return N->getOperand(1);
}
@@ -847,11 +847,11 @@ SDValue DAGCombiner::visitTokenFactor(SDNode *N) {
case ISD::TokenFactor:
if ((CombinerAA || Op.hasOneUse()) &&
- std::find(TFs.begin(), TFs.end(), Op.Val) == TFs.end()) {
+ std::find(TFs.begin(), TFs.end(), Op.getNode()) == TFs.end()) {
// Queue up for processing.
- TFs.push_back(Op.Val);
+ TFs.push_back(Op.getNode());
// Clean up in case the token factor is removed.
- AddToWorkList(Op.Val);
+ AddToWorkList(Op.getNode());
Changed = true;
break;
}
@@ -859,7 +859,7 @@ SDValue DAGCombiner::visitTokenFactor(SDNode *N) {
default:
// Only add if it isn't already in the list.
- if (SeenOps.insert(Op.Val))
+ if (SeenOps.insert(Op.getNode()))
Ops.push_back(Op);
else
Changed = true;
@@ -905,7 +905,7 @@ SDValue combineShlAddConstant(SDValue N0, SDValue N1, SelectionDAG &DAG) {
SDValue N00 = N0.getOperand(0);
SDValue N01 = N0.getOperand(1);
ConstantSDNode *N01C = dyn_cast<ConstantSDNode>(N01);
- if (N01C && N00.getOpcode() == ISD::ADD && N00.Val->hasOneUse() &&
+ if (N01C && N00.getOpcode() == ISD::ADD && N00.getNode()->hasOneUse() &&
isa<ConstantSDNode>(N00.getOperand(1))) {
N0 = DAG.getNode(ISD::ADD, VT,
DAG.getNode(ISD::SHL, VT, N00.getOperand(0), N01),
@@ -975,7 +975,7 @@ SDValue DAGCombiner::visitADD(SDNode *N) {
// fold vector ops
if (VT.isVector()) {
SDValue FoldedVOp = SimplifyVBinOp(N);
- if (FoldedVOp.Val) return FoldedVOp;
+ if (FoldedVOp.getNode()) return FoldedVOp;
}
// fold (add x, undef) -> undef
@@ -1001,7 +1001,7 @@ SDValue DAGCombiner::visitADD(SDNode *N) {
N0.getOperand(1));
// reassociate add
SDValue RADD = ReassociateOps(ISD::ADD, N0, N1);
- if (RADD.Val != 0)
+ if (RADD.getNode() != 0)
return RADD;
// fold ((0-A) + B) -> B-A
if (N0.getOpcode() == ISD::SUB && isa<ConstantSDNode>(N0.getOperand(0)) &&
@@ -1036,23 +1036,23 @@ SDValue DAGCombiner::visitADD(SDNode *N) {
}
// fold (add (shl (add x, c1), c2), ) -> (add (add (shl x, c2), c1<<c2), )
- if (N0.getOpcode() == ISD::SHL && N0.Val->hasOneUse()) {
+ if (N0.getOpcode() == ISD::SHL && N0.getNode()->hasOneUse()) {
SDValue Result = combineShlAddConstant(N0, N1, DAG);
- if (Result.Val) return Result;
+ if (Result.getNode()) return Result;
}
- if (N1.getOpcode() == ISD::SHL && N1.Val->hasOneUse()) {
+ if (N1.getOpcode() == ISD::SHL && N1.getNode()->hasOneUse()) {
SDValue Result = combineShlAddConstant(N1, N0, DAG);
- if (Result.Val) return Result;
+ if (Result.getNode()) return Result;
}
// fold (add (select cc, 0, c), x) -> (select cc, x, (add, x, c))
- if (N0.getOpcode() == ISD::SELECT && N0.Val->hasOneUse()) {
+ if (N0.getOpcode() == ISD::SELECT && N0.getNode()->hasOneUse()) {
SDValue Result = combineSelectAndUse(N, N0, N1, DAG);
- if (Result.Val) return Result;
+ if (Result.getNode()) return Result;
}
- if (N1.getOpcode() == ISD::SELECT && N1.Val->hasOneUse()) {
+ if (N1.getOpcode() == ISD::SELECT && N1.getNode()->hasOneUse()) {
SDValue Result = combineSelectAndUse(N, N1, N0, DAG);
- if (Result.Val) return Result;
+ if (Result.getNode()) return Result;
}
return SDValue();
@@ -1121,14 +1121,14 @@ SDValue DAGCombiner::visitADDE(SDNode *N) {
SDValue DAGCombiner::visitSUB(SDNode *N) {
SDValue N0 = N->getOperand(0);
SDValue N1 = N->getOperand(1);
- ConstantSDNode *N0C = dyn_cast<ConstantSDNode>(N0.Val);
- ConstantSDNode *N1C = dyn_cast<ConstantSDNode>(N1.Val);
+ ConstantSDNode *N0C = dyn_cast<ConstantSDNode>(N0.getNode());
+ ConstantSDNode *N1C = dyn_cast<ConstantSDNode>(N1.getNode());
MVT VT = N0.getValueType();
// fold vector ops
if (VT.isVector()) {
SDValue FoldedVOp = SimplifyVBinOp(N);
- if (FoldedVOp.Val) return FoldedVOp;
+ if (FoldedVOp.getNode()) return FoldedVOp;
}
// fold (sub x, x) -> 0
@@ -1148,9 +1148,9 @@ SDValue DAGCombiner::visitSUB(SDNode *N) {
if (N0.getOpcode() == ISD::ADD && N0.getOperand(1) == N1)
return N0.getOperand(0);
// fold (sub x, (select cc, 0, c)) -> (select cc, x, (sub, x, c))
- if (N1.getOpcode() == ISD::SELECT && N1.Val->hasOneUse()) {
+ if (N1.getOpcode() == ISD::SELECT && N1.getNode()->hasOneUse()) {
SDValue Result = combineSelectAndUse(N, N1, N0, DAG);
- if (Result.Val) return Result;
+ if (Result.getNode()) return Result;
}
// If either operand of a sub is undef, the result is undef
if (N0.getOpcode() == ISD::UNDEF)
@@ -1171,7 +1171,7 @@ SDValue DAGCombiner::visitMUL(SDNode *N) {
// fold vector ops
if (VT.isVector()) {
SDValue FoldedVOp = SimplifyVBinOp(N);
- if (FoldedVOp.Val) return FoldedVOp;
+ if (FoldedVOp.getNode()) return FoldedVOp;
}
// fold (mul x, undef) -> 0
@@ -1208,7 +1208,7 @@ SDValue DAGCombiner::visitMUL(SDNode *N) {
if (N1C && N0.getOpcode() == ISD::SHL &&
isa<ConstantSDNode>(N0.getOperand(1))) {
SDValue C3 = DAG.getNode(ISD::SHL, VT, N1, N0.getOperand(1));
- AddToWorkList(C3.Val);
+ AddToWorkList(C3.getNode());
return DAG.getNode(ISD::MUL, VT, N0.getOperand(0), C3);
}
@@ -1218,19 +1218,19 @@ SDValue DAGCombiner::visitMUL(SDNode *N) {
SDValue Sh(0,0), Y(0,0);
// Check for both (mul (shl X, C), Y) and (mul Y, (shl X, C)).
if (N0.getOpcode() == ISD::SHL && isa<ConstantSDNode>(N0.getOperand(1)) &&
- N0.Val->hasOneUse()) {
+ N0.getNode()->hasOneUse()) {
Sh = N0; Y = N1;
} else if (N1.getOpcode() == ISD::SHL &&
- isa<ConstantSDNode>(N1.getOperand(1)) && N1.Val->hasOneUse()) {
+ isa<ConstantSDNode>(N1.getOperand(1)) && N1.getNode()->hasOneUse()) {
Sh = N1; Y = N0;
}
- if (Sh.Val) {
+ if (Sh.getNode()) {
SDValue Mul = DAG.getNode(ISD::MUL, VT, Sh.getOperand(0), Y);
return DAG.getNode(ISD::SHL, VT, Mul, Sh.getOperand(1));
}
}
// fold (mul (add x, c1), c2) -> (add (mul x, c2), c1*c2)
- if (N1C && N0.getOpcode() == ISD::ADD && N0.Val->hasOneUse() &&
+ if (N1C && N0.getOpcode() == ISD::ADD && N0.getNode()->hasOneUse() &&
isa<ConstantSDNode>(N0.getOperand(1))) {
return DAG.getNode(ISD::ADD, VT,
DAG.getNode(ISD::MUL, VT, N0.getOperand(0), N1),
@@ -1239,7 +1239,7 @@ SDValue DAGCombiner::visitMUL(SDNode *N) {
// reassociate mul