llvm.org GIT mirror llvm / d39a5d4
unique_ptrify MatchableInfo(const CodeGenInstAlias *Alias)'s parameter git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224733 91177308-0d34-0410-b5e6-96231b3b80d8 David Blaikie 4 years ago
1 changed file(s) with 13 addition(s) and 16 deletion(s). Raw diff Collapse all Expand all
390390 /// AsmVariantID - Target's assembly syntax variant no.
391391 int AsmVariantID;
392392
393 /// AsmString - The assembly string for this instruction (with variants
394 /// removed), e.g. "movsx $src, $dst".
395 std::string AsmString;
396
393397 /// TheDef - This is the definition of the instruction or InstAlias that this
394398 /// matchable came from.
395399 Record *const TheDef;
406410 /// ResOperands - This is the operand list that should be built for the result
407411 /// MCInst.
408412 SmallVector ResOperands;
409
410 /// AsmString - The assembly string for this instruction (with variants
411 /// removed), e.g. "movsx $src, $dst".
412 std::string AsmString;
413413
414414 /// Mnemonic - This is the first token of the matched instruction, its
415415 /// mnemonic.
433433 bool HasDeprecation;
434434
435435 MatchableInfo(const CodeGenInstruction &CGI)
436 : AsmVariantID(0), TheDef(CGI.TheDef), DefRec(&CGI),
437 AsmString(CGI.AsmString) {
438 }
439
440 MatchableInfo(const CodeGenInstAlias *Alias)
441 : AsmVariantID(0), TheDef(Alias->TheDef), DefRec(Alias),
442 AsmString(Alias->AsmString) {
436 : AsmVariantID(0), AsmString(CGI.AsmString), TheDef(CGI.TheDef), DefRec(&CGI) {
437 }
438
439 MatchableInfo(std::unique_ptr Alias)
440 : AsmVariantID(0), AsmString(Alias->AsmString), TheDef(Alias->TheDef), DefRec(Alias.release()) {
443441 }
444442
445443 ~MatchableInfo() {
446 if (DefRec.is())
447 delete DefRec.get();
444 delete DefRec.dyn_cast();
448445 }
449446
450447 // Two-operand aliases clone from the main matchable, but mark the second
13571354 std::vector AllInstAliases =
13581355 Records.getAllDerivedDefinitions("InstAlias");
13591356 for (unsigned i = 0, e = AllInstAliases.size(); i != e; ++i) {
1360 CodeGenInstAlias *Alias =
1361 new CodeGenInstAlias(AllInstAliases[i], AsmVariantNo, Target);
1357 auto Alias = llvm::make_unique(AllInstAliases[i],
1358 AsmVariantNo, Target);
13621359
13631360 // If the tblgen -match-prefix option is specified (for tblgen hackers),
13641361 // filter the set of instruction aliases we consider, based on the target
13671364 .startswith( MatchPrefix))
13681365 continue;
13691366
1370 std::unique_ptr II(new MatchableInfo(Alias));
1367 std::unique_ptr II(new MatchableInfo(std::move(Alias)));
13711368
13721369 II->initialize(*this, SingletonRegisters, AsmVariantNo, RegisterPrefix);
13731370