mirror of
https://github.com/RPCS3/llvm.git
synced 2025-04-06 23:31:48 +00:00
Convert a bunch of loops to foreach. NFC.
This uses the new SDNode::op_values() iterator range committed in r240805. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240817 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
226505c0a1
commit
e0e37a2382
include/llvm/CodeGen
lib/CodeGen/SelectionDAG
@ -591,7 +591,7 @@ public:
|
|||||||
const SDValue &operator*() const { return I->get(); }
|
const SDValue &operator*() const { return I->get(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
iterator_range<value_op_iterator> op_values() {
|
iterator_range<value_op_iterator> op_values() const {
|
||||||
return iterator_range<value_op_iterator>(value_op_iterator(op_begin()),
|
return iterator_range<value_op_iterator>(value_op_iterator(op_begin()),
|
||||||
value_op_iterator(op_end()));
|
value_op_iterator(op_end()));
|
||||||
}
|
}
|
||||||
|
@ -227,8 +227,7 @@ SUnit *ScheduleDAGFast::CopyAndMoveSuccessors(SUnit *SU) {
|
|||||||
else if (VT == MVT::Other)
|
else if (VT == MVT::Other)
|
||||||
TryUnfold = true;
|
TryUnfold = true;
|
||||||
}
|
}
|
||||||
for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i) {
|
for (const SDValue &Op : N->op_values()) {
|
||||||
const SDValue &Op = N->getOperand(i);
|
|
||||||
MVT VT = Op.getNode()->getSimpleValueType(Op.getResNo());
|
MVT VT = Op.getNode()->getSimpleValueType(Op.getResNo());
|
||||||
if (VT == MVT::Glue)
|
if (VT == MVT::Glue)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -415,8 +415,8 @@ static bool IsChainDependent(SDNode *Outer, SDNode *Inner,
|
|||||||
// to get to the CALLSEQ_BEGIN, but we need to find the path with the
|
// to get to the CALLSEQ_BEGIN, but we need to find the path with the
|
||||||
// most nesting in order to ensure that we find the corresponding match.
|
// most nesting in order to ensure that we find the corresponding match.
|
||||||
if (N->getOpcode() == ISD::TokenFactor) {
|
if (N->getOpcode() == ISD::TokenFactor) {
|
||||||
for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i)
|
for (const SDValue &Op : N->op_values())
|
||||||
if (IsChainDependent(N->getOperand(i).getNode(), Inner, NestLevel, TII))
|
if (IsChainDependent(Op.getNode(), Inner, NestLevel, TII))
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -433,9 +433,9 @@ static bool IsChainDependent(SDNode *Outer, SDNode *Inner,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Otherwise, find the chain and continue climbing.
|
// Otherwise, find the chain and continue climbing.
|
||||||
for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i)
|
for (const SDValue &Op : N->op_values())
|
||||||
if (N->getOperand(i).getValueType() == MVT::Other) {
|
if (Op.getValueType() == MVT::Other) {
|
||||||
N = N->getOperand(i).getNode();
|
N = Op.getNode();
|
||||||
goto found_chain_operand;
|
goto found_chain_operand;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -464,10 +464,10 @@ FindCallSeqStart(SDNode *N, unsigned &NestLevel, unsigned &MaxNest,
|
|||||||
if (N->getOpcode() == ISD::TokenFactor) {
|
if (N->getOpcode() == ISD::TokenFactor) {
|
||||||
SDNode *Best = nullptr;
|
SDNode *Best = nullptr;
|
||||||
unsigned BestMaxNest = MaxNest;
|
unsigned BestMaxNest = MaxNest;
|
||||||
for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i) {
|
for (const SDValue &Op : N->op_values()) {
|
||||||
unsigned MyNestLevel = NestLevel;
|
unsigned MyNestLevel = NestLevel;
|
||||||
unsigned MyMaxNest = MaxNest;
|
unsigned MyMaxNest = MaxNest;
|
||||||
if (SDNode *New = FindCallSeqStart(N->getOperand(i).getNode(),
|
if (SDNode *New = FindCallSeqStart(Op.getNode(),
|
||||||
MyNestLevel, MyMaxNest, TII))
|
MyNestLevel, MyMaxNest, TII))
|
||||||
if (!Best || (MyMaxNest > BestMaxNest)) {
|
if (!Best || (MyMaxNest > BestMaxNest)) {
|
||||||
Best = New;
|
Best = New;
|
||||||
@ -493,9 +493,9 @@ FindCallSeqStart(SDNode *N, unsigned &NestLevel, unsigned &MaxNest,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Otherwise, find the chain and continue climbing.
|
// Otherwise, find the chain and continue climbing.
|
||||||
for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i)
|
for (const SDValue &Op : N->op_values())
|
||||||
if (N->getOperand(i).getValueType() == MVT::Other) {
|
if (Op.getValueType() == MVT::Other) {
|
||||||
N = N->getOperand(i).getNode();
|
N = Op.getNode();
|
||||||
goto found_chain_operand;
|
goto found_chain_operand;
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -960,8 +960,7 @@ SUnit *ScheduleDAGRRList::CopyAndMoveSuccessors(SUnit *SU) {
|
|||||||
else if (VT == MVT::Other)
|
else if (VT == MVT::Other)
|
||||||
TryUnfold = true;
|
TryUnfold = true;
|
||||||
}
|
}
|
||||||
for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i) {
|
for (const SDValue &Op : N->op_values()) {
|
||||||
const SDValue &Op = N->getOperand(i);
|
|
||||||
MVT VT = Op.getNode()->getSimpleValueType(Op.getResNo());
|
MVT VT = Op.getNode()->getSimpleValueType(Op.getResNo());
|
||||||
if (VT == MVT::Glue)
|
if (VT == MVT::Glue)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -1256,10 +1255,9 @@ static void CheckForLiveRegDefMasked(SUnit *SU, const uint32_t *RegMask,
|
|||||||
|
|
||||||
/// getNodeRegMask - Returns the register mask attached to an SDNode, if any.
|
/// getNodeRegMask - Returns the register mask attached to an SDNode, if any.
|
||||||
static const uint32_t *getNodeRegMask(const SDNode *N) {
|
static const uint32_t *getNodeRegMask(const SDNode *N) {
|
||||||
for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i)
|
for (const SDValue &Op : N->op_values())
|
||||||
if (const RegisterMaskSDNode *Op =
|
if (const auto *RegOp = dyn_cast<RegisterMaskSDNode>(Op.getNode()))
|
||||||
dyn_cast<RegisterMaskSDNode>(N->getOperand(i).getNode()))
|
return RegOp->getRegMask();
|
||||||
return Op->getRegMask();
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -332,9 +332,9 @@ void ScheduleDAGSDNodes::BuildSchedUnits() {
|
|||||||
SDNode *NI = Worklist.pop_back_val();
|
SDNode *NI = Worklist.pop_back_val();
|
||||||
|
|
||||||
// Add all operands to the worklist unless they've already been added.
|
// Add all operands to the worklist unless they've already been added.
|
||||||
for (unsigned i = 0, e = NI->getNumOperands(); i != e; ++i)
|
for (const SDValue &Op : NI->op_values())
|
||||||
if (Visited.insert(NI->getOperand(i).getNode()).second)
|
if (Visited.insert(Op.getNode()).second)
|
||||||
Worklist.push_back(NI->getOperand(i).getNode());
|
Worklist.push_back(Op.getNode());
|
||||||
|
|
||||||
if (isPassiveNode(NI)) // Leaf node, e.g. a TargetImmediate.
|
if (isPassiveNode(NI)) // Leaf node, e.g. a TargetImmediate.
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user