@@ -526,23 +526,20 @@ void MatcherGen::EmitMatchCode(const TreePatternNode &N,
526526 EmitOperatorMatchCode (N, NodeNoTypes);
527527
528528 // If there are node predicates for this node, generate their checks.
529- for (unsigned i = 0 , e = N.getPredicateCalls ().size (); i != e; ++i) {
530- const TreePredicateCall &Pred = N.getPredicateCalls ()[i];
529+ for (const TreePredicateCall &Pred : N.getPredicateCalls ()) {
531530 SmallVector<unsigned , 4 > Operands;
532531 if (Pred.Fn .usesOperands ()) {
533532 TreePattern *TP = Pred.Fn .getOrigPatFragRecord ();
534- for (unsigned i = 0 ; i < TP->getNumArgs (); ++i) {
535- std::string Name =
536- (" pred:" + Twine (Pred.Scope ) + " :" + TP->getArgName (i)).str ();
533+ for (const std::string &Arg : TP->getArgList ()) {
534+ std::string Name = (" pred:" + Twine (Pred.Scope ) + " :" + Arg).str ();
537535 Operands.push_back (getNamedArgumentSlot (Name));
538536 }
539537 }
540538 AddMatcher (new CheckPredicateMatcher (Pred.Fn , Operands));
541539 }
542540
543- for (unsigned i = 0 , e = ResultsToTypeCheck.size (); i != e; ++i)
544- AddMatcher (new CheckTypeMatcher (N.getSimpleType (ResultsToTypeCheck[i]),
545- ResultsToTypeCheck[i]));
541+ for (unsigned I : ResultsToTypeCheck)
542+ AddMatcher (new CheckTypeMatcher (N.getSimpleType (I), I));
546543}
547544
548545// / EmitMatcherCode - Generate the code that matches the predicate of this
@@ -836,8 +833,8 @@ void MatcherGen::EmitResultInstructionAsOperand(
836833 // overridden, or which we aren't letting it override; emit the 'default
837834 // ops' operands.
838835 const DAGDefaultOperand &DefaultOp = CGP.getDefaultOperand (OperandNode);
839- for (unsigned i = 0 , e = DefaultOp.DefaultOps . size (); i != e; ++i )
840- EmitResultOperand (*DefaultOp. DefaultOps [i] , InstOps);
836+ for (const TreePatternNodePtr &Op : DefaultOp.DefaultOps )
837+ EmitResultOperand (*Op , InstOps);
841838 continue ;
842839 }
843840
@@ -886,10 +883,10 @@ void MatcherGen::EmitResultInstructionAsOperand(
886883 if (isRoot && !PhysRegInputs.empty ()) {
887884 // Emit all of the CopyToReg nodes for the input physical registers. These
888885 // occur in patterns like (mul:i8 AL:i8, GR8:i8:$src).
889- for (unsigned i = 0 , e = PhysRegInputs. size (); i != e; ++i ) {
886+ for (const auto &PhysRegInput : PhysRegInputs) {
890887 const CodeGenRegister *Reg =
891- CGP.getTargetInfo ().getRegBank ().getReg (PhysRegInputs[i] .first );
892- AddMatcher (new EmitCopyToRegMatcher (PhysRegInputs[i] .second , Reg));
888+ CGP.getTargetInfo ().getRegBank ().getReg (PhysRegInput .first );
889+ AddMatcher (new EmitCopyToRegMatcher (PhysRegInput .second , Reg));
893890 }
894891
895892 // Even if the node has no other glue inputs, the resultant node must be
@@ -977,8 +974,8 @@ void MatcherGen::EmitResultInstructionAsOperand(
977974 NumFixedArityOperands, NextRecordedOperandNo));
978975
979976 // The non-chain and non-glue results of the newly emitted node get recorded.
980- for (unsigned i = 0 , e = ResultVTs. size (); i != e; ++i ) {
981- if (ResultVTs[i] == MVT::Other || ResultVTs[i] == MVT::Glue)
977+ for (MVT::SimpleValueType ResultVT : ResultVTs) {
978+ if (ResultVT == MVT::Other || ResultVT == MVT::Glue)
982979 break ;
983980 OutputOps.push_back (NextRecordedOperandNo++);
984981 }
0 commit comments