diff options
author | Matthias Braun <matze@braunis.de> | 2016-12-05 06:00:46 +0000 |
---|---|---|
committer | Matthias Braun <matze@braunis.de> | 2016-12-05 06:00:46 +0000 |
commit | bb053164413d86d0e7b354dec68f521c073ff4c4 (patch) | |
tree | 9d9d46fb86555ab502ccf0f478ceb2edc6cb1716 /llvm/utils/TableGen/CodeGenInstruction.cpp | |
parent | 7cf3b112248267e517758894ab8e6333792aea60 (diff) | |
download | bcm5719-llvm-bb053164413d86d0e7b354dec68f521c073ff4c4.tar.gz bcm5719-llvm-bb053164413d86d0e7b354dec68f521c073ff4c4.zip |
TableGen: Use StringInit instead of std::string for DagInit arg names
llvm-svn: 288644
Diffstat (limited to 'llvm/utils/TableGen/CodeGenInstruction.cpp')
-rw-r--r-- | llvm/utils/TableGen/CodeGenInstruction.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/llvm/utils/TableGen/CodeGenInstruction.cpp b/llvm/utils/TableGen/CodeGenInstruction.cpp index 6007e1c5b61..bb2ec2a64e4 100644 --- a/llvm/utils/TableGen/CodeGenInstruction.cpp +++ b/llvm/utils/TableGen/CodeGenInstruction.cpp @@ -53,13 +53,13 @@ CGIOperandList::CGIOperandList(Record *R) : TheDef(R) { OperandList.reserve(e); for (unsigned i = 0; i != e; ++i){ Init *ArgInit; - std::string ArgName; + StringRef ArgName; if (i < NumDefs) { ArgInit = OutDI->getArg(i); - ArgName = OutDI->getArgName(i); + ArgName = OutDI->getArgNameStr(i); } else { ArgInit = InDI->getArg(i-NumDefs); - ArgName = InDI->getArgName(i-NumDefs); + ArgName = InDI->getArgNameStr(i-NumDefs); } DefInit *Arg = dyn_cast<DefInit>(ArgInit); @@ -193,7 +193,7 @@ CGIOperandList::ParseOperandName(const std::string &Op, bool AllowWholeOp) { // Find the operand with the right name. for (unsigned i = 0, e = MIOpInfo->getNumArgs(); i != e; ++i) - if (MIOpInfo->getArgName(i) == SubOpName) + if (MIOpInfo->getArgNameStr(i) == SubOpName) return std::make_pair(OpIdx, i); // Otherwise, didn't find it! @@ -449,10 +449,10 @@ bool CodeGenInstAlias::tryAliasOpMatch(DagInit *Result, unsigned AliasOpNo, if (ADI && ADI->getDef() == InstOpRec) { // If the operand is a record, it must have a name, and the record type // must match up with the instruction's argument type. - if (Result->getArgName(AliasOpNo).empty()) + if (!Result->getArgName(AliasOpNo)) PrintFatalError(Loc, "result argument #" + Twine(AliasOpNo) + " must have a name!"); - ResOp = ResultOperand(Result->getArgName(AliasOpNo), ResultRecord); + ResOp = ResultOperand(Result->getArgNameStr(AliasOpNo), ResultRecord); return true; } @@ -470,7 +470,7 @@ bool CodeGenInstAlias::tryAliasOpMatch(DagInit *Result, unsigned AliasOpNo, if (!T.getRegisterClass(InstOpRec) .hasSubClass(&T.getRegisterClass(ADI->getDef()))) return false; - ResOp = ResultOperand(Result->getArgName(AliasOpNo), ResultRecord); + ResOp = ResultOperand(Result->getArgNameStr(AliasOpNo), ResultRecord); return true; } @@ -492,7 +492,7 @@ bool CodeGenInstAlias::tryAliasOpMatch(DagInit *Result, unsigned AliasOpNo, " is not a member of the " + InstOpRec->getName() + " register class!"); - if (!Result->getArgName(AliasOpNo).empty()) + if (Result->getArgName(AliasOpNo)) PrintFatalError(Loc, "result fixed register argument must " "not have a name!"); @@ -521,7 +521,7 @@ bool CodeGenInstAlias::tryAliasOpMatch(DagInit *Result, unsigned AliasOpNo, if (hasSubOps || !InstOpRec->isSubClassOf("Operand")) return false; // Integer arguments can't have names. - if (!Result->getArgName(AliasOpNo).empty()) + if (Result->getArgName(AliasOpNo)) PrintFatalError(Loc, "result argument #" + Twine(AliasOpNo) + " must not have a name!"); ResOp = ResultOperand(II->getValue()); @@ -552,7 +552,7 @@ bool CodeGenInstAlias::tryAliasOpMatch(DagInit *Result, unsigned AliasOpNo, // MIOperandInfo perhaps? if (InstOpRec->getValueInit("Type") != ADI->getDef()->getValueInit("Type")) return false; - ResOp = ResultOperand(Result->getArgName(AliasOpNo), ADI->getDef()); + ResOp = ResultOperand(Result->getArgNameStr(AliasOpNo), ADI->getDef()); return true; } @@ -597,14 +597,14 @@ CodeGenInstAlias::CodeGenInstAlias(Record *R, unsigned Variant, StringMap<Record*> NameClass; for (unsigned i = 0, e = Result->getNumArgs(); i != e; ++i) { DefInit *ADI = dyn_cast<DefInit>(Result->getArg(i)); - if (!ADI || Result->getArgName(i).empty()) + if (!ADI || !Result->getArgName(i)) continue; // Verify we don't have something like: (someinst GR16:$foo, GR32:$foo) // $foo can exist multiple times in the result list, but it must have the // same type. - Record *&Entry = NameClass[Result->getArgName(i)]; + Record *&Entry = NameClass[Result->getArgNameStr(i)]; if (Entry && Entry != ADI->getDef()) - PrintFatalError(R->getLoc(), "result value $" + Result->getArgName(i) + + PrintFatalError(R->getLoc(), "result value $" + Result->getArgNameStr(i) + " is both " + Entry->getName() + " and " + ADI->getDef()->getName() + "!"); Entry = ADI->getDef(); @@ -647,9 +647,9 @@ CodeGenInstAlias::CodeGenInstAlias(Record *R, unsigned Variant, // Take care to instantiate each of the suboperands with the correct // nomenclature: $foo.bar - ResultOperands.emplace_back(Result->getArgName(AliasOpNo).str() - + "." + MIOI->getArgName(SubOp).str(), - SubRec); + ResultOperands.emplace_back( + Result->getArgName(AliasOpNo)->getAsUnquotedString() + "." + + MIOI->getArgName(SubOp)->getAsUnquotedString(), SubRec); ResultInstOperandIndex.push_back(std::make_pair(i, SubOp)); } ++AliasOpNo; |