llvm.org GIT mirror llvm / 66e7bb8
Use range-based for loops. NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249941 91177308-0d34-0410-b5e6-96231b3b80d8 Craig Topper 5 years ago
1 changed file(s) with 15 addition(s) and 17 deletion(s). Raw diff Collapse all Expand all
11061106 }
11071107
11081108 static void
1109 RewriteIntelBracExpression(SmallVectorImpl *AsmRewrites,
1109 RewriteIntelBracExpression(SmallVectorImpl &AsmRewrites,
11101110 StringRef SymName, int64_t ImmDisp,
11111111 int64_t FinalImmDisp, SMLoc &BracLoc,
11121112 SMLoc &StartInBrac, SMLoc &End) {
11131113 // Remove the '[' and ']' from the IR string.
1114 AsmRewrites->emplace_back(AOK_Skip, BracLoc, 1);
1115 AsmRewrites->emplace_back(AOK_Skip, End, 1);
1114 AsmRewrites.emplace_back(AOK_Skip, BracLoc, 1);
1115 AsmRewrites.emplace_back(AOK_Skip, End, 1);
11161116
11171117 // If ImmDisp is non-zero, then we parsed a displacement before the
11181118 // bracketed expression (i.e., ImmDisp [ BaseReg + Scale*IndexReg + Disp])
11231123 // We have an immediate displacement before the bracketed expression.
11241124 // Adjust this to match the final immediate displacement.
11251125 bool Found = false;
1126 for (SmallVectorImpl::iterator I = AsmRewrites->begin(),
1127 E = AsmRewrites->end(); I != E; ++I) {
1128 if ((*I).Loc.getPointer() > BracLoc.getPointer())
1126 for (AsmRewrite &AR : AsmRewrites) {
1127 if (AR.Loc.getPointer() > BracLoc.getPointer())
11291128 continue;
1130 if ((*I).Kind == AOK_ImmPrefix || (*I).Kind == AOK_Imm) {
1129 if (AR.Kind == AOK_ImmPrefix || AR.Kind == AOK_Imm) {
11311130 assert (!Found && "ImmDisp already rewritten.");
1132 (*I).Kind = AOK_Imm;
1133 (*I).Len = BracLoc.getPointer() - (*I).Loc.getPointer();
1134 (*I).Val = FinalImmDisp;
1131 AR.Kind = AOK_Imm;
1132 AR.Len = BracLoc.getPointer() - AR.Loc.getPointer();
1133 AR.Val = FinalImmDisp;
11351134 Found = true;
11361135 break;
11371136 }
11421141 // We have a symbolic and an immediate displacement, but no displacement
11431142 // before the bracketed expression. Put the immediate displacement
11441143 // before the bracketed expression.
1145 AsmRewrites->emplace_back(AOK_Imm, BracLoc, 0, FinalImmDisp);
1144 AsmRewrites.emplace_back(AOK_Imm, BracLoc, 0, FinalImmDisp);
11461145 }
11471146 }
11481147 // Remove all the ImmPrefix rewrites within the brackets.
1149 for (SmallVectorImpl::iterator I = AsmRewrites->begin(),
1150 E = AsmRewrites->end(); I != E; ++I) {
1151 if ((*I).Loc.getPointer() < StartInBrac.getPointer())
1148 for (AsmRewrite &AR : AsmRewrites) {
1149 if (AR.Loc.getPointer() < StartInBrac.getPointer())
11521150 continue;
1153 if ((*I).Kind == AOK_ImmPrefix)
1154 (*I).Kind = AOK_Delete;
1151 if (AR.Kind == AOK_ImmPrefix)
1152 AR.Kind = AOK_Delete;
11551153 }
11561154 const char *SymLocPtr = SymName.data();
11571155 // Skip everything before the symbol.
13101308 // A symbolic displacement.
13111309 Disp = Sym;
13121310 if (isParsingInlineAsm())
1313 RewriteIntelBracExpression(InstInfo->AsmRewrites, SM.getSymName(),
1311 RewriteIntelBracExpression(*InstInfo->AsmRewrites, SM.getSymName(),
13141312 ImmDisp, SM.getImm(), BracLoc, StartInBrac,
13151313 End);
13161314 }