diff options
author | Kazu Hirata <kazu@google.com> | 2025-06-15 21:00:29 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-15 21:00:29 -0700 |
commit | 7a4a83b551eaf159ce10b612def3be62d80706d4 (patch) | |
tree | 06f75d3050a9b268f6551aed158b8ec019637b61 /llvm/utils/TableGen/Common | |
parent | f71fb2dc01e117481f56e040c25391883d43c1c5 (diff) | |
download | llvm-7a4a83b551eaf159ce10b612def3be62d80706d4.zip llvm-7a4a83b551eaf159ce10b612def3be62d80706d4.tar.gz llvm-7a4a83b551eaf159ce10b612def3be62d80706d4.tar.bz2 |
[TableGen] Use range-based for loops (NFC) (#144283)
Diffstat (limited to 'llvm/utils/TableGen/Common')
-rw-r--r-- | llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp | 4 | ||||
-rw-r--r-- | llvm/utils/TableGen/Common/CodeGenDAGPatterns.h | 14 | ||||
-rw-r--r-- | llvm/utils/TableGen/Common/CodeGenInstruction.h | 3 | ||||
-rw-r--r-- | llvm/utils/TableGen/Common/CodeGenSchedule.cpp | 7 | ||||
-rw-r--r-- | llvm/utils/TableGen/Common/DAGISelMatcher.cpp | 8 |
5 files changed, 16 insertions, 20 deletions
diff --git a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp index d33c0db..810b35e 100644 --- a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp +++ b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp @@ -1824,8 +1824,8 @@ bool TreePatternNode::UpdateNodeTypeFromInst(unsigned ResNo, } bool TreePatternNode::ContainsUnresolvedType(TreePattern &TP) const { - for (unsigned i = 0, e = Types.size(); i != e; ++i) - if (!TP.getInfer().isConcrete(Types[i], true)) + for (const TypeSetByHwMode &Type : Types) + if (!TP.getInfer().isConcrete(Type, true)) return true; for (const TreePatternNode &Child : children()) if (Child.ContainsUnresolvedType(TP)) diff --git a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.h b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.h index a5aadf2..64fec27 100644 --- a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.h +++ b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.h @@ -747,8 +747,8 @@ public: /// hasChild - Return true if N is any of our children. bool hasChild(const TreePatternNode *N) const { - for (unsigned i = 0, e = Children.size(); i != e; ++i) - if (Children[i].get() == N) + for (const TreePatternNodePtr &Child : Children) + if (Child.get() == N) return true; return false; } @@ -1171,9 +1171,9 @@ public: } const CodeGenIntrinsic &getIntrinsic(const Record *R) const { - for (unsigned i = 0, e = Intrinsics.size(); i != e; ++i) - if (Intrinsics[i].TheDef == R) - return Intrinsics[i]; + for (const CodeGenIntrinsic &Intrinsic : Intrinsics) + if (Intrinsic.TheDef == R) + return Intrinsic; llvm_unreachable("Unknown intrinsic!"); } @@ -1280,8 +1280,8 @@ private: inline bool SDNodeInfo::ApplyTypeConstraints(TreePatternNode &N, TreePattern &TP) const { bool MadeChange = false; - for (unsigned i = 0, e = TypeConstraints.size(); i != e; ++i) - MadeChange |= TypeConstraints[i].ApplyTypeConstraint(N, *this, TP); + for (const SDTypeConstraint &TypeConstraint : TypeConstraints) + MadeChange |= TypeConstraint.ApplyTypeConstraint(N, *this, TP); return MadeChange; } diff --git a/llvm/utils/TableGen/Common/CodeGenInstruction.h b/llvm/utils/TableGen/Common/CodeGenInstruction.h index e38979a..3a5abc5 100644 --- a/llvm/utils/TableGen/Common/CodeGenInstruction.h +++ b/llvm/utils/TableGen/Common/CodeGenInstruction.h @@ -127,8 +127,7 @@ public: /// getTiedOperand - If this operand is tied to another one, return the /// other operand number. Otherwise, return -1. int getTiedRegister() const { - for (unsigned j = 0, e = Constraints.size(); j != e; ++j) { - const CGIOperandList::ConstraintInfo &CI = Constraints[j]; + for (const CGIOperandList::ConstraintInfo &CI : Constraints) { if (CI.isTied()) return CI.getTiedOperand(); } diff --git a/llvm/utils/TableGen/Common/CodeGenSchedule.cpp b/llvm/utils/TableGen/Common/CodeGenSchedule.cpp index 7295480..af7e439 100644 --- a/llvm/utils/TableGen/Common/CodeGenSchedule.cpp +++ b/llvm/utils/TableGen/Common/CodeGenSchedule.cpp @@ -2232,13 +2232,10 @@ void PredTransitions::dump() const { dbgs() << LS << SchedModels.getSchedRW(PC.RWIdx, PC.IsRead).Name << ":" << PC.Predicate->getName(); dbgs() << "},\n => {"; - for (SmallVectorImpl<SmallVector<unsigned, 4>>::const_iterator - WSI = TI.WriteSequences.begin(), - WSE = TI.WriteSequences.end(); - WSI != WSE; ++WSI) { + for (const auto &WS : TI.WriteSequences) { dbgs() << "("; ListSeparator LS; - for (unsigned N : *WSI) + for (unsigned N : WS) dbgs() << LS << SchedModels.getSchedWrite(N).Name; dbgs() << "),"; } diff --git a/llvm/utils/TableGen/Common/DAGISelMatcher.cpp b/llvm/utils/TableGen/Common/DAGISelMatcher.cpp index 8780c4f..3543bb5a 100644 --- a/llvm/utils/TableGen/Common/DAGISelMatcher.cpp +++ b/llvm/utils/TableGen/Common/DAGISelMatcher.cpp @@ -286,11 +286,11 @@ void EmitNodeMatcherCommon::printImpl(raw_ostream &OS, indent Indent) const { OS << (isa<MorphNodeToMatcher>(this) ? "MorphNodeTo: " : "EmitNode: ") << CGI.Namespace << "::" << CGI.TheDef->getName() << ": <todo flags> "; - for (unsigned i = 0, e = VTs.size(); i != e; ++i) - OS << ' ' << getEnumName(VTs[i]); + for (MVT::SimpleValueType VT : VTs) + OS << ' ' << getEnumName(VT); OS << '('; - for (unsigned i = 0, e = Operands.size(); i != e; ++i) - OS << Operands[i] << ' '; + for (unsigned Operand : Operands) + OS << Operand << ' '; OS << ")\n"; } |