tblgen: Twinify PrintFatalError.

No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205110 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Benjamin Kramer
2014-03-29 17:17:15 +00:00
parent 6908435639
commit abe43b546b
9 changed files with 62 additions and 58 deletions

View File

@ -27,9 +27,9 @@ void PrintError(ArrayRef<SMLoc> ErrorLoc, const Twine &Msg);
void PrintError(const char *Loc, const Twine &Msg); void PrintError(const char *Loc, const Twine &Msg);
void PrintError(const Twine &Msg); void PrintError(const Twine &Msg);
LLVM_ATTRIBUTE_NORETURN void PrintFatalError(const std::string &Msg); LLVM_ATTRIBUTE_NORETURN void PrintFatalError(const Twine &Msg);
LLVM_ATTRIBUTE_NORETURN void PrintFatalError(ArrayRef<SMLoc> ErrorLoc, LLVM_ATTRIBUTE_NORETURN void PrintFatalError(ArrayRef<SMLoc> ErrorLoc,
const std::string &Msg); const Twine &Msg);
extern SourceMgr SrcMgr; extern SourceMgr SrcMgr;
extern unsigned ErrorsPrinted; extern unsigned ErrorsPrinted;

View File

@ -62,12 +62,12 @@ void PrintError(const Twine &Msg) {
errs() << "error:" << Msg << "\n"; errs() << "error:" << Msg << "\n";
} }
void PrintFatalError(const std::string &Msg) { void PrintFatalError(const Twine &Msg) {
PrintError(Twine(Msg)); PrintError(Msg);
std::exit(1); std::exit(1);
} }
void PrintFatalError(ArrayRef<SMLoc> ErrorLoc, const std::string &Msg) { void PrintFatalError(ArrayRef<SMLoc> ErrorLoc, const Twine &Msg) {
PrintError(ErrorLoc, Msg); PrintError(ErrorLoc, Msg);
std::exit(1); std::exit(1);
} }

View File

@ -1786,7 +1786,7 @@ Init *Record::getValueInit(StringRef FieldName) const {
const RecordVal *R = getValue(FieldName); const RecordVal *R = getValue(FieldName);
if (R == 0 || R->getValue() == 0) if (R == 0 || R->getValue() == 0)
PrintFatalError(getLoc(), "Record `" + getName() + PrintFatalError(getLoc(), "Record `" + getName() +
"' does not have a field named `" + FieldName.str() + "'!\n"); "' does not have a field named `" + FieldName + "'!\n");
return R->getValue(); return R->getValue();
} }
@ -1799,12 +1799,12 @@ std::string Record::getValueAsString(StringRef FieldName) const {
const RecordVal *R = getValue(FieldName); const RecordVal *R = getValue(FieldName);
if (R == 0 || R->getValue() == 0) if (R == 0 || R->getValue() == 0)
PrintFatalError(getLoc(), "Record `" + getName() + PrintFatalError(getLoc(), "Record `" + getName() +
"' does not have a field named `" + FieldName.str() + "'!\n"); "' does not have a field named `" + FieldName + "'!\n");
if (StringInit *SI = dyn_cast<StringInit>(R->getValue())) if (StringInit *SI = dyn_cast<StringInit>(R->getValue()))
return SI->getValue(); return SI->getValue();
PrintFatalError(getLoc(), "Record `" + getName() + "', field `" + PrintFatalError(getLoc(), "Record `" + getName() + "', field `" +
FieldName.str() + "' does not have a string initializer!"); FieldName + "' does not have a string initializer!");
} }
/// getValueAsBitsInit - This method looks up the specified field and returns /// getValueAsBitsInit - This method looks up the specified field and returns
@ -1815,12 +1815,12 @@ BitsInit *Record::getValueAsBitsInit(StringRef FieldName) const {
const RecordVal *R = getValue(FieldName); const RecordVal *R = getValue(FieldName);
if (R == 0 || R->getValue() == 0) if (R == 0 || R->getValue() == 0)
PrintFatalError(getLoc(), "Record `" + getName() + PrintFatalError(getLoc(), "Record `" + getName() +
"' does not have a field named `" + FieldName.str() + "'!\n"); "' does not have a field named `" + FieldName + "'!\n");
if (BitsInit *BI = dyn_cast<BitsInit>(R->getValue())) if (BitsInit *BI = dyn_cast<BitsInit>(R->getValue()))
return BI; return BI;
PrintFatalError(getLoc(), "Record `" + getName() + "', field `" + PrintFatalError(getLoc(), "Record `" + getName() + "', field `" +
FieldName.str() + "' does not have a BitsInit initializer!"); FieldName + "' does not have a BitsInit initializer!");
} }
/// getValueAsListInit - This method looks up the specified field and returns /// getValueAsListInit - This method looks up the specified field and returns
@ -1831,12 +1831,12 @@ ListInit *Record::getValueAsListInit(StringRef FieldName) const {
const RecordVal *R = getValue(FieldName); const RecordVal *R = getValue(FieldName);
if (R == 0 || R->getValue() == 0) if (R == 0 || R->getValue() == 0)
PrintFatalError(getLoc(), "Record `" + getName() + PrintFatalError(getLoc(), "Record `" + getName() +
"' does not have a field named `" + FieldName.str() + "'!\n"); "' does not have a field named `" + FieldName + "'!\n");
if (ListInit *LI = dyn_cast<ListInit>(R->getValue())) if (ListInit *LI = dyn_cast<ListInit>(R->getValue()))
return LI; return LI;
PrintFatalError(getLoc(), "Record `" + getName() + "', field `" + PrintFatalError(getLoc(), "Record `" + getName() + "', field `" +
FieldName.str() + "' does not have a list initializer!"); FieldName + "' does not have a list initializer!");
} }
/// getValueAsListOfDefs - This method looks up the specified field and returns /// getValueAsListOfDefs - This method looks up the specified field and returns
@ -1852,7 +1852,7 @@ Record::getValueAsListOfDefs(StringRef FieldName) const {
Defs.push_back(DI->getDef()); Defs.push_back(DI->getDef());
} else { } else {
PrintFatalError(getLoc(), "Record `" + getName() + "', field `" + PrintFatalError(getLoc(), "Record `" + getName() + "', field `" +
FieldName.str() + "' list is not entirely DefInit!"); FieldName + "' list is not entirely DefInit!");
} }
} }
return Defs; return Defs;
@ -1866,12 +1866,12 @@ int64_t Record::getValueAsInt(StringRef FieldName) const {
const RecordVal *R = getValue(FieldName); const RecordVal *R = getValue(FieldName);
if (R == 0 || R->getValue() == 0) if (R == 0 || R->getValue() == 0)
PrintFatalError(getLoc(), "Record `" + getName() + PrintFatalError(getLoc(), "Record `" + getName() +
"' does not have a field named `" + FieldName.str() + "'!\n"); "' does not have a field named `" + FieldName + "'!\n");
if (IntInit *II = dyn_cast<IntInit>(R->getValue())) if (IntInit *II = dyn_cast<IntInit>(R->getValue()))
return II->getValue(); return II->getValue();
PrintFatalError(getLoc(), "Record `" + getName() + "', field `" + PrintFatalError(getLoc(), "Record `" + getName() + "', field `" +
FieldName.str() + "' does not have an int initializer!"); FieldName + "' does not have an int initializer!");
} }
/// getValueAsListOfInts - This method looks up the specified field and returns /// getValueAsListOfInts - This method looks up the specified field and returns
@ -1887,7 +1887,7 @@ Record::getValueAsListOfInts(StringRef FieldName) const {
Ints.push_back(II->getValue()); Ints.push_back(II->getValue());
} else { } else {
PrintFatalError(getLoc(), "Record `" + getName() + "', field `" + PrintFatalError(getLoc(), "Record `" + getName() + "', field `" +
FieldName.str() + "' does not have a list of ints initializer!"); FieldName + "' does not have a list of ints initializer!");
} }
} }
return Ints; return Ints;
@ -1906,7 +1906,7 @@ Record::getValueAsListOfStrings(StringRef FieldName) const {
Strings.push_back(II->getValue()); Strings.push_back(II->getValue());
} else { } else {
PrintFatalError(getLoc(), "Record `" + getName() + "', field `" + PrintFatalError(getLoc(), "Record `" + getName() + "', field `" +
FieldName.str() + "' does not have a list of strings initializer!"); FieldName + "' does not have a list of strings initializer!");
} }
} }
return Strings; return Strings;
@ -1920,12 +1920,12 @@ Record *Record::getValueAsDef(StringRef FieldName) const {
const RecordVal *R = getValue(FieldName); const RecordVal *R = getValue(FieldName);
if (R == 0 || R->getValue() == 0) if (R == 0 || R->getValue() == 0)
PrintFatalError(getLoc(), "Record `" + getName() + PrintFatalError(getLoc(), "Record `" + getName() +
"' does not have a field named `" + FieldName.str() + "'!\n"); "' does not have a field named `" + FieldName + "'!\n");
if (DefInit *DI = dyn_cast<DefInit>(R->getValue())) if (DefInit *DI = dyn_cast<DefInit>(R->getValue()))
return DI->getDef(); return DI->getDef();
PrintFatalError(getLoc(), "Record `" + getName() + "', field `" + PrintFatalError(getLoc(), "Record `" + getName() + "', field `" +
FieldName.str() + "' does not have a def initializer!"); FieldName + "' does not have a def initializer!");
} }
/// getValueAsBit - This method looks up the specified field and returns its /// getValueAsBit - This method looks up the specified field and returns its
@ -1936,12 +1936,12 @@ bool Record::getValueAsBit(StringRef FieldName) const {
const RecordVal *R = getValue(FieldName); const RecordVal *R = getValue(FieldName);
if (R == 0 || R->getValue() == 0) if (R == 0 || R->getValue() == 0)
PrintFatalError(getLoc(), "Record `" + getName() + PrintFatalError(getLoc(), "Record `" + getName() +
"' does not have a field named `" + FieldName.str() + "'!\n"); "' does not have a field named `" + FieldName + "'!\n");
if (BitInit *BI = dyn_cast<BitInit>(R->getValue())) if (BitInit *BI = dyn_cast<BitInit>(R->getValue()))
return BI->getValue(); return BI->getValue();
PrintFatalError(getLoc(), "Record `" + getName() + "', field `" + PrintFatalError(getLoc(), "Record `" + getName() + "', field `" +
FieldName.str() + "' does not have a bit initializer!"); FieldName + "' does not have a bit initializer!");
} }
bool Record::getValueAsBitOrUnset(StringRef FieldName, bool &Unset) const { bool Record::getValueAsBitOrUnset(StringRef FieldName, bool &Unset) const {
@ -1958,7 +1958,7 @@ bool Record::getValueAsBitOrUnset(StringRef FieldName, bool &Unset) const {
if (BitInit *BI = dyn_cast<BitInit>(R->getValue())) if (BitInit *BI = dyn_cast<BitInit>(R->getValue()))
return BI->getValue(); return BI->getValue();
PrintFatalError(getLoc(), "Record `" + getName() + "', field `" + PrintFatalError(getLoc(), "Record `" + getName() + "', field `" +
FieldName.str() + "' does not have a bit initializer!"); FieldName + "' does not have a bit initializer!");
} }
/// getValueAsDag - This method looks up the specified field and returns its /// getValueAsDag - This method looks up the specified field and returns its
@ -1969,12 +1969,12 @@ DagInit *Record::getValueAsDag(StringRef FieldName) const {
const RecordVal *R = getValue(FieldName); const RecordVal *R = getValue(FieldName);
if (R == 0 || R->getValue() == 0) if (R == 0 || R->getValue() == 0)
PrintFatalError(getLoc(), "Record `" + getName() + PrintFatalError(getLoc(), "Record `" + getName() +
"' does not have a field named `" + FieldName.str() + "'!\n"); "' does not have a field named `" + FieldName + "'!\n");
if (DagInit *DI = dyn_cast<DagInit>(R->getValue())) if (DagInit *DI = dyn_cast<DagInit>(R->getValue()))
return DI; return DI;
PrintFatalError(getLoc(), "Record `" + getName() + "', field `" + PrintFatalError(getLoc(), "Record `" + getName() + "', field `" +
FieldName.str() + "' does not have a dag initializer!"); FieldName + "' does not have a dag initializer!");
} }

View File

@ -719,12 +719,12 @@ void MatchableInfo::formTwoOperandAlias(StringRef Constraint) {
int DstAsmOperand = findAsmOperandNamed(Ops.second); int DstAsmOperand = findAsmOperandNamed(Ops.second);
if (SrcAsmOperand == -1) if (SrcAsmOperand == -1)
PrintFatalError(TheDef->getLoc(), PrintFatalError(TheDef->getLoc(),
"unknown source two-operand alias operand '" + "unknown source two-operand alias operand '" + Ops.first +
Ops.first.str() + "'."); "'.");
if (DstAsmOperand == -1) if (DstAsmOperand == -1)
PrintFatalError(TheDef->getLoc(), PrintFatalError(TheDef->getLoc(),
"unknown destination two-operand alias operand '" + "unknown destination two-operand alias operand '" +
Ops.second.str() + "'."); Ops.second + "'.");
// Find the ResOperand that refers to the operand we're aliasing away // Find the ResOperand that refers to the operand we're aliasing away
// and update it to refer to the combined operand instead. // and update it to refer to the combined operand instead.
@ -872,7 +872,7 @@ void MatchableInfo::tokenizeAsmString(const AsmMatcherInfo &Info) {
// FIXME : Check and raise an error if it is a register. // FIXME : Check and raise an error if it is a register.
if (Mnemonic[0] == '$') if (Mnemonic[0] == '$')
PrintFatalError(TheDef->getLoc(), PrintFatalError(TheDef->getLoc(),
"Invalid instruction mnemonic '" + Mnemonic.str() + "'!"); "Invalid instruction mnemonic '" + Mnemonic + "'!");
// Remove the first operand, it is tracked in the mnemonic field. // Remove the first operand, it is tracked in the mnemonic field.
AsmOperands.erase(AsmOperands.begin()); AsmOperands.erase(AsmOperands.begin());
@ -909,7 +909,7 @@ bool MatchableInfo::validate(StringRef CommentDelimiter, bool Hack) const {
StringRef Tok = AsmOperands[i].Token; StringRef Tok = AsmOperands[i].Token;
if (Tok[0] == '$' && Tok.find(':') != StringRef::npos) if (Tok[0] == '$' && Tok.find(':') != StringRef::npos)
PrintFatalError(TheDef->getLoc(), PrintFatalError(TheDef->getLoc(),
"matchable with operand modifier '" + Tok.str() + "matchable with operand modifier '" + Tok +
"' not supported by asm matcher. Mark isCodeGenOnly!"); "' not supported by asm matcher. Mark isCodeGenOnly!");
// Verify that any operand is only mentioned once. // Verify that any operand is only mentioned once.
@ -917,14 +917,14 @@ bool MatchableInfo::validate(StringRef CommentDelimiter, bool Hack) const {
if (Tok[0] == '$' && !OperandNames.insert(Tok).second) { if (Tok[0] == '$' && !OperandNames.insert(Tok).second) {
if (!Hack) if (!Hack)
PrintFatalError(TheDef->getLoc(), PrintFatalError(TheDef->getLoc(),
"ERROR: matchable with tied operand '" + Tok.str() + "ERROR: matchable with tied operand '" + Tok +
"' can never be matched!"); "' can never be matched!");
// FIXME: Should reject these. The ARM backend hits this with $lane in a // FIXME: Should reject these. The ARM backend hits this with $lane in a
// bunch of instructions. It is unclear what the right answer is. // bunch of instructions. It is unclear what the right answer is.
DEBUG({ DEBUG({
errs() << "warning: '" << TheDef->getName() << "': " errs() << "warning: '" << TheDef->getName() << "': "
<< "ignoring instruction with tied operand '" << "ignoring instruction with tied operand '"
<< Tok.str() << "'\n"; << Tok << "'\n";
}); });
return false; return false;
} }
@ -1500,8 +1500,8 @@ buildInstructionOperandReference(MatchableInfo *II,
// Map this token to an operand. // Map this token to an operand.
unsigned Idx; unsigned Idx;
if (!Operands.hasOperandNamed(OperandName, Idx)) if (!Operands.hasOperandNamed(OperandName, Idx))
PrintFatalError(II->TheDef->getLoc(), "error: unable to find operand: '" + PrintFatalError(II->TheDef->getLoc(),
OperandName.str() + "'"); "error: unable to find operand: '" + OperandName + "'");
// If the instruction operand has multiple suboperands, but the parser // If the instruction operand has multiple suboperands, but the parser
// match class for the asm operand is still the default "ImmAsmOperand", // match class for the asm operand is still the default "ImmAsmOperand",
@ -1573,8 +1573,8 @@ void AsmMatcherInfo::buildAliasOperandReference(MatchableInfo *II,
return; return;
} }
PrintFatalError(II->TheDef->getLoc(), "error: unable to find operand: '" + PrintFatalError(II->TheDef->getLoc(),
OperandName.str() + "'"); "error: unable to find operand: '" + OperandName + "'");
} }
void MatchableInfo::buildInstructionResultOperands() { void MatchableInfo::buildInstructionResultOperands() {

View File

@ -547,8 +547,8 @@ emitRegisterNameString(raw_ostream &O, StringRef AltName,
Reg.TheDef->getValueAsListOfStrings("AltNames"); Reg.TheDef->getValueAsListOfStrings("AltNames");
if (AltNames.size() <= Idx) if (AltNames.size() <= Idx)
PrintFatalError(Reg.TheDef->getLoc(), PrintFatalError(Reg.TheDef->getLoc(),
(Twine("Register definition missing alt name for '") + "Register definition missing alt name for '" +
AltName + "'.").str()); AltName + "'.");
AsmName = AltNames[Idx]; AsmName = AltNames[Idx];
} }
} }

View File

@ -2327,8 +2327,9 @@ void CodeGenDAGPatterns::ParseDefaultOperands() {
/* Resolve all types */; /* Resolve all types */;
if (TPN->ContainsUnresolvedType()) { if (TPN->ContainsUnresolvedType()) {
PrintFatalError("Value #" + utostr(i) + " of OperandWithDefaultOps '" + PrintFatalError("Value #" + Twine(i) + " of OperandWithDefaultOps '" +
DefaultOps[i]->getName() +"' doesn't have a concrete type!"); DefaultOps[i]->getName() +
"' doesn't have a concrete type!");
} }
DefaultOpInfo.DefaultOps.push_back(TPN); DefaultOpInfo.DefaultOps.push_back(TPN);
} }

View File

@ -106,11 +106,11 @@ CGIOperandList::CGIOperandList(Record *R) : TheDef(R) {
// Check that the operand has a name and that it's unique. // Check that the operand has a name and that it's unique.
if (ArgName.empty()) if (ArgName.empty())
PrintFatalError("In instruction '" + R->getName() + "', operand #" + utostr(i) + PrintFatalError("In instruction '" + R->getName() + "', operand #" +
" has no name!"); Twine(i) + " has no name!");
if (!OperandNames.insert(ArgName).second) if (!OperandNames.insert(ArgName).second)
PrintFatalError("In instruction '" + R->getName() + "', operand #" + utostr(i) + PrintFatalError("In instruction '" + R->getName() + "', operand #" +
" has the same name as a previous operand!"); Twine(i) + " has the same name as a previous operand!");
OperandList.push_back(OperandInfo(Rec, ArgName, PrintMethod, EncoderMethod, OperandList.push_back(OperandInfo(Rec, ArgName, PrintMethod, EncoderMethod,
OperandType, MIOperandNo, NumOps, OperandType, MIOperandNo, NumOps,
@ -133,8 +133,8 @@ CGIOperandList::CGIOperandList(Record *R) : TheDef(R) {
unsigned CGIOperandList::getOperandNamed(StringRef Name) const { unsigned CGIOperandList::getOperandNamed(StringRef Name) const {
unsigned OpIdx; unsigned OpIdx;
if (hasOperandNamed(Name, OpIdx)) return OpIdx; if (hasOperandNamed(Name, OpIdx)) return OpIdx;
PrintFatalError("'" + TheDef->getName() + "' does not have an operand named '$" + PrintFatalError("'" + TheDef->getName() +
Name.str() + "'!"); "' does not have an operand named '$" + Name + "'!");
} }
/// hasOperandNamed - Query whether the instruction has an operand of the /// hasOperandNamed - Query whether the instruction has an operand of the
@ -442,7 +442,7 @@ bool CodeGenInstAlias::tryAliasOpMatch(DagInit *Result, unsigned AliasOpNo,
// If the operand is a record, it must have a name, and the record type // If the operand is a record, it must have a name, and the record type
// must match up with the instruction's argument type. // must match up with the instruction's argument type.
if (Result->getArgName(AliasOpNo).empty()) if (Result->getArgName(AliasOpNo).empty())
PrintFatalError(Loc, "result argument #" + utostr(AliasOpNo) + PrintFatalError(Loc, "result argument #" + Twine(AliasOpNo) +
" must have a name!"); " must have a name!");
ResOp = ResultOperand(Result->getArgName(AliasOpNo), ResultRecord); ResOp = ResultOperand(Result->getArgName(AliasOpNo), ResultRecord);
return true; return true;
@ -514,7 +514,7 @@ bool CodeGenInstAlias::tryAliasOpMatch(DagInit *Result, unsigned AliasOpNo,
return false; return false;
// Integer arguments can't have names. // Integer arguments can't have names.
if (!Result->getArgName(AliasOpNo).empty()) if (!Result->getArgName(AliasOpNo).empty())
PrintFatalError(Loc, "result argument #" + utostr(AliasOpNo) + PrintFatalError(Loc, "result argument #" + Twine(AliasOpNo) +
" must not have a name!"); " must not have a name!");
ResOp = ResultOperand(II->getValue()); ResOp = ResultOperand(II->getValue());
return true; return true;
@ -627,14 +627,14 @@ CodeGenInstAlias::CodeGenInstAlias(Record *R, CodeGenTarget &T) : TheDef(R) {
ResultInstOperandIndex.push_back(std::make_pair(i, SubOp)); ResultInstOperandIndex.push_back(std::make_pair(i, SubOp));
++AliasOpNo; ++AliasOpNo;
} else { } else {
PrintFatalError(R->getLoc(), "result argument #" + utostr(AliasOpNo) + PrintFatalError(R->getLoc(), "result argument #" + Twine(AliasOpNo) +
" does not match instruction operand class " + " does not match instruction operand class " +
(SubOp == 0 ? InstOpRec->getName() :SubRec->getName())); (SubOp == 0 ? InstOpRec->getName() :SubRec->getName()));
} }
} }
continue; continue;
} }
PrintFatalError(R->getLoc(), "result argument #" + utostr(AliasOpNo) + PrintFatalError(R->getLoc(), "result argument #" + Twine(AliasOpNo) +
" does not match instruction operand class " + " does not match instruction operand class " +
InstOpRec->getName()); InstOpRec->getName());
} }

View File

@ -993,7 +993,7 @@ CodeGenRegBank::CodeGenRegBank(RecordKeeper &Records) {
// Read in register class definitions. // Read in register class definitions.
std::vector<Record*> RCs = Records.getAllDerivedDefinitions("RegisterClass"); std::vector<Record*> RCs = Records.getAllDerivedDefinitions("RegisterClass");
if (RCs.empty()) if (RCs.empty())
PrintFatalError(std::string("No 'RegisterClass' subclasses defined!")); PrintFatalError("No 'RegisterClass' subclasses defined!");
// Allocate user-defined register classes. // Allocate user-defined register classes.
RegClasses.reserve(RCs.size()); RegClasses.reserve(RCs.size());

View File

@ -173,7 +173,8 @@ Record *CodeGenTarget::getInstructionSet() const {
Record *CodeGenTarget::getAsmParser() const { Record *CodeGenTarget::getAsmParser() const {
std::vector<Record*> LI = TargetRec->getValueAsListOfDefs("AssemblyParsers"); std::vector<Record*> LI = TargetRec->getValueAsListOfDefs("AssemblyParsers");
if (AsmParserNum >= LI.size()) if (AsmParserNum >= LI.size())
PrintFatalError("Target does not have an AsmParser #" + utostr(AsmParserNum) + "!"); PrintFatalError("Target does not have an AsmParser #" +
Twine(AsmParserNum) + "!");
return LI[AsmParserNum]; return LI[AsmParserNum];
} }
@ -184,7 +185,8 @@ Record *CodeGenTarget::getAsmParserVariant(unsigned i) const {
std::vector<Record*> LI = std::vector<Record*> LI =
TargetRec->getValueAsListOfDefs("AssemblyParserVariants"); TargetRec->getValueAsListOfDefs("AssemblyParserVariants");
if (i >= LI.size()) if (i >= LI.size())
PrintFatalError("Target does not have an AsmParserVariant #" + utostr(i) + "!"); PrintFatalError("Target does not have an AsmParserVariant #" + Twine(i) +
"!");
return LI[i]; return LI[i];
} }
@ -202,7 +204,8 @@ unsigned CodeGenTarget::getAsmParserVariantCount() const {
Record *CodeGenTarget::getAsmWriter() const { Record *CodeGenTarget::getAsmWriter() const {
std::vector<Record*> LI = TargetRec->getValueAsListOfDefs("AssemblyWriters"); std::vector<Record*> LI = TargetRec->getValueAsListOfDefs("AssemblyWriters");
if (AsmWriterNum >= LI.size()) if (AsmWriterNum >= LI.size())
PrintFatalError("Target does not have an AsmWriter #" + utostr(AsmWriterNum) + "!"); PrintFatalError("Target does not have an AsmWriter #" +
Twine(AsmWriterNum) + "!");
return LI[AsmWriterNum]; return LI[AsmWriterNum];
} }
@ -285,7 +288,7 @@ GetInstByName(const char *Name,
DenseMap<const Record*, CodeGenInstruction*>::const_iterator DenseMap<const Record*, CodeGenInstruction*>::const_iterator
I = Insts.find(Rec); I = Insts.find(Rec);
if (Rec == 0 || I == Insts.end()) if (Rec == 0 || I == Insts.end())
PrintFatalError(std::string("Could not find '") + Name + "' instruction!"); PrintFatalError(Twine("Could not find '") + Name + "' instruction!");
return I->second; return I->second;
} }