llvm.org GIT mirror llvm / 38eed02
Use emplace_back instead of a constructor call and push_back. NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249940 91177308-0d34-0410-b5e6-96231b3b80d8 Craig Topper 5 years ago
2 changed file(s) with 24 addition(s) and 29 deletion(s). Raw diff Collapse all Expand all
13361336 SI->LookupInlineAsmLabel(IDVal, getSourceManager(), IDLoc, true);
13371337 assert(RewrittenLabel.size() &&
13381338 "We should have an internal name here.");
1339 Info.AsmRewrites->push_back(AsmRewrite(AOK_Label, IDLoc,
1340 IDVal.size(), RewrittenLabel));
1339 Info.AsmRewrites->emplace_back(AOK_Label, IDLoc, IDVal.size(),
1340 RewrittenLabel);
13411341 IDVal = RewrittenLabel;
13421342 }
13431343 Sym = getContext().getOrCreateSymbol(IDVal);
44974497 if (!isUIntN(8, IntValue) && !isIntN(8, IntValue))
44984498 return Error(ExprLoc, "literal value out of range for directive");
44994499
4500 Info.AsmRewrites->push_back(AsmRewrite(AOK_Emit, IDLoc, Len));
4500 Info.AsmRewrites->emplace_back(AOK_Emit, IDLoc, Len);
45014501 return false;
45024502 }
45034503
45134513 if (!isPowerOf2_64(IntValue))
45144514 return Error(ExprLoc, "literal value not a power of two greater then zero");
45154515
4516 Info.AsmRewrites->push_back(
4517 AsmRewrite(AOK_Align, IDLoc, 5, Log2_64(IntValue)));
4516 Info.AsmRewrites->emplace_back(AOK_Align, IDLoc, 5, Log2_64(IntValue));
45184517 return false;
45194518 }
45204519
46104609 OutputDecls.push_back(OpDecl);
46114610 OutputDeclsAddressOf.push_back(Operand.needAddressOf());
46124611 OutputConstraints.push_back(("=" + Operand.getConstraint()).str());
4613 AsmStrRewrites.push_back(AsmRewrite(AOK_Output, Start, SymName.size()));
4612 AsmStrRewrites.emplace_back(AOK_Output, Start, SymName.size());
46144613 } else {
46154614 InputDecls.push_back(OpDecl);
46164615 InputDeclsAddressOf.push_back(Operand.needAddressOf());
46174616 InputConstraints.push_back(Operand.getConstraint().str());
4618 AsmStrRewrites.push_back(AsmRewrite(AOK_Input, Start, SymName.size()));
4617 AsmStrRewrites.emplace_back(AOK_Input, Start, SymName.size());
46194618 }
46204619 }
46214620
10711071 // Insert an explicit size if the user didn't have one.
10721072 if (!Size) {
10731073 Size = getPointerWidth();
1074 InstInfo->AsmRewrites->push_back(AsmRewrite(AOK_SizeDirective, Start,
1075 /*Len=*/0, Size));
1074 InstInfo->AsmRewrites->emplace_back(AOK_SizeDirective, Start,
1075 /*Len=*/0, Size);
10761076 }
10771077
10781078 // Create an absolute memory reference in order to match against
10911091 if (!Size) {
10921092 Size = Info.Type * 8; // Size is in terms of bits in this context.
10931093 if (Size)
1094 InstInfo->AsmRewrites->push_back(AsmRewrite(AOK_SizeDirective, Start,
1095 /*Len=*/0, Size));
1094 InstInfo->AsmRewrites->emplace_back(AOK_SizeDirective, Start,
1095 /*Len=*/0, Size);
10961096 }
10971097 }
10981098
11111111 int64_t FinalImmDisp, SMLoc &BracLoc,
11121112 SMLoc &StartInBrac, SMLoc &End) {
11131113 // Remove the '[' and ']' from the IR string.
1114 AsmRewrites->push_back(AsmRewrite(AOK_Skip, BracLoc, 1));
1115 AsmRewrites->push_back(AsmRewrite(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])
11421142 // We have a symbolic and an immediate displacement, but no displacement
11431143 // before the bracketed expression. Put the immediate displacement
11441144 // before the bracketed expression.
1145 AsmRewrites->push_back(AsmRewrite(AOK_Imm, BracLoc, 0, FinalImmDisp));
1145 AsmRewrites->emplace_back(AOK_Imm, BracLoc, 0, FinalImmDisp);
11461146 }
11471147 }
11481148 // Remove all the ImmPrefix rewrites within the brackets.
11571157 // Skip everything before the symbol.
11581158 if (unsigned Len = SymLocPtr - StartInBrac.getPointer()) {
11591159 assert(Len > 0 && "Expected a non-negative length.");
1160 AsmRewrites->push_back(AsmRewrite(AOK_Skip, StartInBrac, Len));
1160 AsmRewrites.emplace_back(AOK_Skip, StartInBrac, Len);
11611161 }
11621162 // Skip everything after the symbol.
11631163 if (unsigned Len = End.getPointer() - (SymLocPtr + SymName.size())) {
11641164 SMLoc Loc = SMLoc::getFromPointer(SymLocPtr + SymName.size());
11651165 assert(Len > 0 && "Expected a non-negative length.");
1166 AsmRewrites->push_back(AsmRewrite(AOK_Skip, Loc, Len));
1166 AsmRewrites.emplace_back(AOK_Skip, Loc, Len);
11671167 }
11681168 }
11691169
12321232 case AsmToken::Integer: {
12331233 StringRef ErrMsg;
12341234 if (isParsingInlineAsm() && SM.getAddImmPrefix())
1235 InstInfo->AsmRewrites->push_back(AsmRewrite(AOK_ImmPrefix,
1236 Tok.getLoc()));
1235 InstInfo->AsmRewrites->emplace_back(AOK_ImmPrefix, Tok.getLoc());
12371236 // Look for 'b' or 'f' following an Integer as a directional label
12381237 SMLoc Loc = getTok().getLoc();
12391238 int64_t IntVal = getTok().getIntVal();
14001399 Loc, false);
14011400 assert(InternalName.size() && "We should have an internal name here.");
14021401 // Push a rewrite for replacing the identifier name with the internal name.
1403 InstInfo->AsmRewrites->push_back(AsmRewrite(AOK_Label, Loc,
1404 Identifier.size(),
1405 InternalName));
1402 InstInfo->AsmRewrites->emplace_back(AOK_Label, Loc, Identifier.size(),
1403 InternalName);
14061404 }
14071405
14081406 // Create the symbol reference.
14291427 AsmToken ImmDispToken = Parser.Lex(); // Eat the integer.
14301428
14311429 if (isParsingInlineAsm())
1432 InstInfo->AsmRewrites->push_back(
1433 AsmRewrite(AOK_ImmPrefix, ImmDispToken.getLoc()));
1430 InstInfo->AsmRewrites->emplace_back(AOK_ImmPrefix, ImmDispToken.getLoc());
14341431
14351432 if (getLexer().isNot(AsmToken::LBrac)) {
14361433 // An immediate following a 'segment register', 'colon' token sequence can
15991596 SMLoc Loc = SMLoc::getFromPointer(DotDispStr.data());
16001597 unsigned Len = DotDispStr.size();
16011598 unsigned Val = OrigDispVal + DotDispVal;
1602 InstInfo->AsmRewrites->push_back(AsmRewrite(AOK_DotOperator, Loc, Len,
1603 Val));
1599 InstInfo->AsmRewrites->emplace_back(AOK_DotOperator, Loc, Len, Val);
16041600 }
16051601
16061602 NewDisp = MCConstantExpr::create(OrigDispVal + DotDispVal, getContext());
16241620 return nullptr;
16251621
16261622 // Don't emit the offset operator.
1627 InstInfo->AsmRewrites->push_back(AsmRewrite(AOK_Skip, OffsetOfLoc, 7));
1623 InstInfo->AsmRewrites->emplace_back(AOK_Skip, OffsetOfLoc, 7);
16281624
16291625 // The offset operator will have an 'r' constraint, thus we need to create
16301626 // register operand to ensure proper matching. Just pick a GPR based on
16751671 // Rewrite the type operator and the C or C++ type or variable in terms of an
16761672 // immediate. E.g. TYPE foo -> $$4
16771673 unsigned Len = End.getPointer() - TypeLoc.getPointer();
1678 InstInfo->AsmRewrites->push_back(AsmRewrite(AOK_Imm, TypeLoc, Len, CVal));
1674 InstInfo->AsmRewrites->emplace_back(AOK_Imm, TypeLoc, Len, CVal);
16791675
16801676 const MCExpr *Imm = MCConstantExpr::create(CVal, getContext());
16811677 return X86Operand::CreateImm(Imm, Start, End);
17221718 unsigned Len = Tok.getLoc().getPointer() - Start.getPointer();
17231719 if (StartTok.getString().size() == Len)
17241720 // Just add a prefix if this wasn't a complex immediate expression.
1725 InstInfo->AsmRewrites->push_back(AsmRewrite(AOK_ImmPrefix, Start));
1721 InstInfo->AsmRewrites->emplace_back(AOK_ImmPrefix, Start);
17261722 else
17271723 // Otherwise, rewrite the complex expression as a single immediate.
1728 InstInfo->AsmRewrites->push_back(AsmRewrite(AOK_Imm, Start, Len, Imm));
1724 InstInfo->AsmRewrites->emplace_back(AOK_Imm, Start, Len, Imm);
17291725 }
17301726
17311727 if (getLexer().isNot(AsmToken::LBrac)) {