mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 02:33:06 +01:00
[tablegen] Add locations to many PrintFatalError() calls
Summary: While working on the GISel Combiner, I noticed I was producing location-less error messages fairly often and set about fixing this. In the process, I noticed quite a few places elsewhere in TableGen that also neglected to include a relevant location. This patch adds locations to errors that relate to a specific record (or a field within it) and also have easy access to the relevant location. This is particularly useful when multiclasses are involved as many of these errors refer to the full name of a record and it's difficult to guess which substring is grep-able. Unfortunately, tablegen currently only supports Record granularity so it's not currently possible to point at a specific Init so these sometimes point at the record that caused the error rather than the precise origin of the error. Reviewers: bogner, aditya_nandakumar, volkan, aemerson, paquette, nhaehnle Reviewed By: nhaehnle Subscribers: jdoerfert, nhaehnle, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D58077 llvm-svn: 353862
This commit is contained in:
parent
bc25529f39
commit
cb73b0150f
@ -1159,8 +1159,9 @@ AsmMatcherInfo::getOperandClass(Record *Rec, int SubOpIdx) {
|
|||||||
// use it, else just fall back to the underlying register class.
|
// use it, else just fall back to the underlying register class.
|
||||||
const RecordVal *R = Rec->getValue("ParserMatchClass");
|
const RecordVal *R = Rec->getValue("ParserMatchClass");
|
||||||
if (!R || !R->getValue())
|
if (!R || !R->getValue())
|
||||||
PrintFatalError("Record `" + Rec->getName() +
|
PrintFatalError(Rec->getLoc(),
|
||||||
"' does not have a ParserMatchClass!\n");
|
"Record `" + Rec->getName() +
|
||||||
|
"' does not have a ParserMatchClass!\n");
|
||||||
|
|
||||||
if (DefInit *DI= dyn_cast<DefInit>(R->getValue())) {
|
if (DefInit *DI= dyn_cast<DefInit>(R->getValue())) {
|
||||||
Record *MatchClass = DI->getDef();
|
Record *MatchClass = DI->getDef();
|
||||||
|
@ -93,8 +93,10 @@ AsmWriterInst::AsmWriterInst(const CodeGenInstruction &CGI, unsigned CGIIndex,
|
|||||||
!= std::string::npos) {
|
!= std::string::npos) {
|
||||||
AddLiteralString(std::string(1, AsmString[DollarPos+1]));
|
AddLiteralString(std::string(1, AsmString[DollarPos+1]));
|
||||||
} else {
|
} else {
|
||||||
PrintFatalError("Non-supported escaped character found in instruction '" +
|
PrintFatalError(
|
||||||
CGI.TheDef->getName() + "'!");
|
CGI.TheDef->getLoc(),
|
||||||
|
"Non-supported escaped character found in instruction '" +
|
||||||
|
CGI.TheDef->getName() + "'!");
|
||||||
}
|
}
|
||||||
LastEmitted = DollarPos+2;
|
LastEmitted = DollarPos+2;
|
||||||
continue;
|
continue;
|
||||||
@ -131,15 +133,19 @@ AsmWriterInst::AsmWriterInst(const CodeGenInstruction &CGI, unsigned CGIIndex,
|
|||||||
// brace.
|
// brace.
|
||||||
if (hasCurlyBraces) {
|
if (hasCurlyBraces) {
|
||||||
if (VarEnd >= AsmString.size())
|
if (VarEnd >= AsmString.size())
|
||||||
PrintFatalError("Reached end of string before terminating curly brace in '"
|
PrintFatalError(
|
||||||
+ CGI.TheDef->getName() + "'");
|
CGI.TheDef->getLoc(),
|
||||||
|
"Reached end of string before terminating curly brace in '" +
|
||||||
|
CGI.TheDef->getName() + "'");
|
||||||
|
|
||||||
// Look for a modifier string.
|
// Look for a modifier string.
|
||||||
if (AsmString[VarEnd] == ':') {
|
if (AsmString[VarEnd] == ':') {
|
||||||
++VarEnd;
|
++VarEnd;
|
||||||
if (VarEnd >= AsmString.size())
|
if (VarEnd >= AsmString.size())
|
||||||
PrintFatalError("Reached end of string before terminating curly brace in '"
|
PrintFatalError(
|
||||||
+ CGI.TheDef->getName() + "'");
|
CGI.TheDef->getLoc(),
|
||||||
|
"Reached end of string before terminating curly brace in '" +
|
||||||
|
CGI.TheDef->getName() + "'");
|
||||||
|
|
||||||
std::string::size_type ModifierStart = VarEnd;
|
std::string::size_type ModifierStart = VarEnd;
|
||||||
while (VarEnd < AsmString.size() && isIdentChar(AsmString[VarEnd]))
|
while (VarEnd < AsmString.size() && isIdentChar(AsmString[VarEnd]))
|
||||||
@ -147,17 +153,22 @@ AsmWriterInst::AsmWriterInst(const CodeGenInstruction &CGI, unsigned CGIIndex,
|
|||||||
Modifier = std::string(AsmString.begin()+ModifierStart,
|
Modifier = std::string(AsmString.begin()+ModifierStart,
|
||||||
AsmString.begin()+VarEnd);
|
AsmString.begin()+VarEnd);
|
||||||
if (Modifier.empty())
|
if (Modifier.empty())
|
||||||
PrintFatalError("Bad operand modifier name in '"+ CGI.TheDef->getName() + "'");
|
PrintFatalError(CGI.TheDef->getLoc(),
|
||||||
|
"Bad operand modifier name in '" +
|
||||||
|
CGI.TheDef->getName() + "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AsmString[VarEnd] != '}')
|
if (AsmString[VarEnd] != '}')
|
||||||
PrintFatalError("Variable name beginning with '{' did not end with '}' in '"
|
PrintFatalError(
|
||||||
+ CGI.TheDef->getName() + "'");
|
CGI.TheDef->getLoc(),
|
||||||
|
"Variable name beginning with '{' did not end with '}' in '" +
|
||||||
|
CGI.TheDef->getName() + "'");
|
||||||
++VarEnd;
|
++VarEnd;
|
||||||
}
|
}
|
||||||
if (VarName.empty() && Modifier.empty())
|
if (VarName.empty() && Modifier.empty())
|
||||||
PrintFatalError("Stray '$' in '" + CGI.TheDef->getName() +
|
PrintFatalError(CGI.TheDef->getLoc(),
|
||||||
"' asm string, maybe you want $$?");
|
"Stray '$' in '" + CGI.TheDef->getName() +
|
||||||
|
"' asm string, maybe you want $$?");
|
||||||
|
|
||||||
if (VarName.empty()) {
|
if (VarName.empty()) {
|
||||||
// Just a modifier, pass this into PrintSpecial.
|
// Just a modifier, pass this into PrintSpecial.
|
||||||
|
@ -108,7 +108,7 @@ void CallingConvEmitter::EmitAction(Record *Action,
|
|||||||
O << Action->getValueAsString("Predicate");
|
O << Action->getValueAsString("Predicate");
|
||||||
} else {
|
} else {
|
||||||
errs() << *Action;
|
errs() << *Action;
|
||||||
PrintFatalError("Unknown CCPredicateAction!");
|
PrintFatalError(Action->getLoc(), "Unknown CCPredicateAction!");
|
||||||
}
|
}
|
||||||
|
|
||||||
O << ") {\n";
|
O << ") {\n";
|
||||||
@ -145,7 +145,8 @@ void CallingConvEmitter::EmitAction(Record *Action,
|
|||||||
ListInit *RegList = Action->getValueAsListInit("RegList");
|
ListInit *RegList = Action->getValueAsListInit("RegList");
|
||||||
ListInit *ShadowRegList = Action->getValueAsListInit("ShadowRegList");
|
ListInit *ShadowRegList = Action->getValueAsListInit("ShadowRegList");
|
||||||
if (!ShadowRegList->empty() && ShadowRegList->size() != RegList->size())
|
if (!ShadowRegList->empty() && ShadowRegList->size() != RegList->size())
|
||||||
PrintFatalError("Invalid length of list of shadowed registers");
|
PrintFatalError(Action->getLoc(),
|
||||||
|
"Invalid length of list of shadowed registers");
|
||||||
|
|
||||||
if (RegList->size() == 1) {
|
if (RegList->size() == 1) {
|
||||||
O << IndentStr << "if (unsigned Reg = State.AllocateReg(";
|
O << IndentStr << "if (unsigned Reg = State.AllocateReg(";
|
||||||
@ -248,7 +249,8 @@ void CallingConvEmitter::EmitAction(Record *Action,
|
|||||||
MVT::SimpleValueType DestVT = getValueType(DestTy);
|
MVT::SimpleValueType DestVT = getValueType(DestTy);
|
||||||
O << IndentStr << "LocVT = " << getEnumName(DestVT) << ";\n";
|
O << IndentStr << "LocVT = " << getEnumName(DestVT) << ";\n";
|
||||||
if (MVT(DestVT).isFloatingPoint()) {
|
if (MVT(DestVT).isFloatingPoint()) {
|
||||||
PrintFatalError("CCPromoteToUpperBitsInType does not handle floating "
|
PrintFatalError(Action->getLoc(),
|
||||||
|
"CCPromoteToUpperBitsInType does not handle floating "
|
||||||
"point");
|
"point");
|
||||||
} else {
|
} else {
|
||||||
O << IndentStr << "if (ArgFlags.isSExt())\n"
|
O << IndentStr << "if (ArgFlags.isSExt())\n"
|
||||||
@ -280,7 +282,7 @@ void CallingConvEmitter::EmitAction(Record *Action,
|
|||||||
O << IndentStr << IndentStr << "return false;\n";
|
O << IndentStr << IndentStr << "return false;\n";
|
||||||
} else {
|
} else {
|
||||||
errs() << *Action;
|
errs() << *Action;
|
||||||
PrintFatalError("Unknown CCAction!");
|
PrintFatalError(Action->getLoc(), "Unknown CCAction!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1407,7 +1407,8 @@ SDTypeConstraint::SDTypeConstraint(Record *R, const CodeGenHwModes &CGH) {
|
|||||||
x.SDTCisSameSizeAs_Info.OtherOperandNum =
|
x.SDTCisSameSizeAs_Info.OtherOperandNum =
|
||||||
R->getValueAsInt("OtherOperandNum");
|
R->getValueAsInt("OtherOperandNum");
|
||||||
} else {
|
} else {
|
||||||
PrintFatalError("Unrecognized SDTypeConstraint '" + R->getName() + "'!\n");
|
PrintFatalError(R->getLoc(),
|
||||||
|
"Unrecognized SDTypeConstraint '" + R->getName() + "'!\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,18 +33,24 @@ CGIOperandList::CGIOperandList(Record *R) : TheDef(R) {
|
|||||||
|
|
||||||
if (DefInit *Init = dyn_cast<DefInit>(OutDI->getOperator())) {
|
if (DefInit *Init = dyn_cast<DefInit>(OutDI->getOperator())) {
|
||||||
if (Init->getDef()->getName() != "outs")
|
if (Init->getDef()->getName() != "outs")
|
||||||
PrintFatalError(R->getName() + ": invalid def name for output list: use 'outs'");
|
PrintFatalError(R->getLoc(),
|
||||||
|
R->getName() +
|
||||||
|
": invalid def name for output list: use 'outs'");
|
||||||
} else
|
} else
|
||||||
PrintFatalError(R->getName() + ": invalid output list: use 'outs'");
|
PrintFatalError(R->getLoc(),
|
||||||
|
R->getName() + ": invalid output list: use 'outs'");
|
||||||
|
|
||||||
NumDefs = OutDI->getNumArgs();
|
NumDefs = OutDI->getNumArgs();
|
||||||
|
|
||||||
DagInit *InDI = R->getValueAsDag("InOperandList");
|
DagInit *InDI = R->getValueAsDag("InOperandList");
|
||||||
if (DefInit *Init = dyn_cast<DefInit>(InDI->getOperator())) {
|
if (DefInit *Init = dyn_cast<DefInit>(InDI->getOperator())) {
|
||||||
if (Init->getDef()->getName() != "ins")
|
if (Init->getDef()->getName() != "ins")
|
||||||
PrintFatalError(R->getName() + ": invalid def name for input list: use 'ins'");
|
PrintFatalError(R->getLoc(),
|
||||||
|
R->getName() +
|
||||||
|
": invalid def name for input list: use 'ins'");
|
||||||
} else
|
} else
|
||||||
PrintFatalError(R->getName() + ": invalid input list: use 'ins'");
|
PrintFatalError(R->getLoc(),
|
||||||
|
R->getName() + ": invalid input list: use 'ins'");
|
||||||
|
|
||||||
unsigned MIOperandNo = 0;
|
unsigned MIOperandNo = 0;
|
||||||
std::set<std::string> OperandNames;
|
std::set<std::string> OperandNames;
|
||||||
@ -63,7 +69,8 @@ CGIOperandList::CGIOperandList(Record *R) : TheDef(R) {
|
|||||||
|
|
||||||
DefInit *Arg = dyn_cast<DefInit>(ArgInit);
|
DefInit *Arg = dyn_cast<DefInit>(ArgInit);
|
||||||
if (!Arg)
|
if (!Arg)
|
||||||
PrintFatalError("Illegal operand for the '" + R->getName() + "' instruction!");
|
PrintFatalError(R->getLoc(), "Illegal operand for the '" + R->getName() +
|
||||||
|
"' instruction!");
|
||||||
|
|
||||||
Record *Rec = Arg->getDef();
|
Record *Rec = Arg->getDef();
|
||||||
std::string PrintMethod = "printOperand";
|
std::string PrintMethod = "printOperand";
|
||||||
@ -88,8 +95,9 @@ CGIOperandList::CGIOperandList(Record *R) : TheDef(R) {
|
|||||||
// Verify that MIOpInfo has an 'ops' root value.
|
// Verify that MIOpInfo has an 'ops' root value.
|
||||||
if (!isa<DefInit>(MIOpInfo->getOperator()) ||
|
if (!isa<DefInit>(MIOpInfo->getOperator()) ||
|
||||||
cast<DefInit>(MIOpInfo->getOperator())->getDef()->getName() != "ops")
|
cast<DefInit>(MIOpInfo->getOperator())->getDef()->getName() != "ops")
|
||||||
PrintFatalError("Bad value for MIOperandInfo in operand '" + Rec->getName() +
|
PrintFatalError(R->getLoc(),
|
||||||
"'\n");
|
"Bad value for MIOperandInfo in operand '" +
|
||||||
|
Rec->getName() + "'\n");
|
||||||
|
|
||||||
// If we have MIOpInfo, then we have #operands equal to number of entries
|
// If we have MIOpInfo, then we have #operands equal to number of entries
|
||||||
// in MIOperandInfo.
|
// in MIOperandInfo.
|
||||||
@ -107,16 +115,20 @@ CGIOperandList::CGIOperandList(Record *R) : TheDef(R) {
|
|||||||
OperandType = "OPERAND_REGISTER";
|
OperandType = "OPERAND_REGISTER";
|
||||||
} else if (!Rec->isSubClassOf("PointerLikeRegClass") &&
|
} else if (!Rec->isSubClassOf("PointerLikeRegClass") &&
|
||||||
!Rec->isSubClassOf("unknown_class"))
|
!Rec->isSubClassOf("unknown_class"))
|
||||||
PrintFatalError("Unknown operand class '" + Rec->getName() +
|
PrintFatalError(R->getLoc(), "Unknown operand class '" + Rec->getName() +
|
||||||
"' in '" + R->getName() + "' instruction!");
|
"' in '" + R->getName() +
|
||||||
|
"' instruction!");
|
||||||
|
|
||||||
// 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 #" +
|
PrintFatalError(R->getLoc(), "In instruction '" + R->getName() +
|
||||||
Twine(i) + " has no name!");
|
"', operand #" + Twine(i) +
|
||||||
|
" has no name!");
|
||||||
if (!OperandNames.insert(ArgName).second)
|
if (!OperandNames.insert(ArgName).second)
|
||||||
PrintFatalError("In instruction '" + R->getName() + "', operand #" +
|
PrintFatalError(R->getLoc(),
|
||||||
Twine(i) + " has the same name as a previous operand!");
|
"In instruction '" + R->getName() + "', operand #" +
|
||||||
|
Twine(i) +
|
||||||
|
" has the same name as a previous operand!");
|
||||||
|
|
||||||
OperandList.emplace_back(Rec, ArgName, PrintMethod, EncoderMethod,
|
OperandList.emplace_back(Rec, ArgName, PrintMethod, EncoderMethod,
|
||||||
OperandNamespace + "::" + OperandType, MIOperandNo,
|
OperandNamespace + "::" + OperandType, MIOperandNo,
|
||||||
@ -138,9 +150,11 @@ 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))
|
||||||
PrintFatalError("'" + TheDef->getName() +
|
return OpIdx;
|
||||||
"' does not have an operand named '$" + Name + "'!");
|
PrintFatalError(TheDef->getLoc(), "'" + TheDef->getName() +
|
||||||
|
"' 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
|
||||||
@ -159,7 +173,8 @@ bool CGIOperandList::hasOperandNamed(StringRef Name, unsigned &OpIdx) const {
|
|||||||
std::pair<unsigned,unsigned>
|
std::pair<unsigned,unsigned>
|
||||||
CGIOperandList::ParseOperandName(const std::string &Op, bool AllowWholeOp) {
|
CGIOperandList::ParseOperandName(const std::string &Op, bool AllowWholeOp) {
|
||||||
if (Op.empty() || Op[0] != '$')
|
if (Op.empty() || Op[0] != '$')
|
||||||
PrintFatalError(TheDef->getName() + ": Illegal operand name: '" + Op + "'");
|
PrintFatalError(TheDef->getLoc(),
|
||||||
|
TheDef->getName() + ": Illegal operand name: '" + Op + "'");
|
||||||
|
|
||||||
std::string OpName = Op.substr(1);
|
std::string OpName = Op.substr(1);
|
||||||
std::string SubOpName;
|
std::string SubOpName;
|
||||||
@ -169,7 +184,9 @@ CGIOperandList::ParseOperandName(const std::string &Op, bool AllowWholeOp) {
|
|||||||
if (DotIdx != std::string::npos) {
|
if (DotIdx != std::string::npos) {
|
||||||
SubOpName = OpName.substr(DotIdx+1);
|
SubOpName = OpName.substr(DotIdx+1);
|
||||||
if (SubOpName.empty())
|
if (SubOpName.empty())
|
||||||
PrintFatalError(TheDef->getName() + ": illegal empty suboperand name in '" +Op +"'");
|
PrintFatalError(TheDef->getLoc(),
|
||||||
|
TheDef->getName() +
|
||||||
|
": illegal empty suboperand name in '" + Op + "'");
|
||||||
OpName = OpName.substr(0, DotIdx);
|
OpName = OpName.substr(0, DotIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,8 +196,11 @@ CGIOperandList::ParseOperandName(const std::string &Op, bool AllowWholeOp) {
|
|||||||
// If one was needed, throw.
|
// If one was needed, throw.
|
||||||
if (OperandList[OpIdx].MINumOperands > 1 && !AllowWholeOp &&
|
if (OperandList[OpIdx].MINumOperands > 1 && !AllowWholeOp &&
|
||||||
SubOpName.empty())
|
SubOpName.empty())
|
||||||
PrintFatalError(TheDef->getName() + ": Illegal to refer to"
|
PrintFatalError(TheDef->getLoc(),
|
||||||
" whole operand part of complex operand '" + Op + "'");
|
TheDef->getName() +
|
||||||
|
": Illegal to refer to"
|
||||||
|
" whole operand part of complex operand '" +
|
||||||
|
Op + "'");
|
||||||
|
|
||||||
// Otherwise, return the operand.
|
// Otherwise, return the operand.
|
||||||
return std::make_pair(OpIdx, 0U);
|
return std::make_pair(OpIdx, 0U);
|
||||||
@ -189,7 +209,9 @@ CGIOperandList::ParseOperandName(const std::string &Op, bool AllowWholeOp) {
|
|||||||
// Find the suboperand number involved.
|
// Find the suboperand number involved.
|
||||||
DagInit *MIOpInfo = OperandList[OpIdx].MIOperandInfo;
|
DagInit *MIOpInfo = OperandList[OpIdx].MIOperandInfo;
|
||||||
if (!MIOpInfo)
|
if (!MIOpInfo)
|
||||||
PrintFatalError(TheDef->getName() + ": unknown suboperand name in '" + Op + "'");
|
PrintFatalError(TheDef->getLoc(), TheDef->getName() +
|
||||||
|
": unknown suboperand name in '" +
|
||||||
|
Op + "'");
|
||||||
|
|
||||||
// Find the operand with the right name.
|
// Find the operand with the right name.
|
||||||
for (unsigned i = 0, e = MIOpInfo->getNumArgs(); i != e; ++i)
|
for (unsigned i = 0, e = MIOpInfo->getNumArgs(); i != e; ++i)
|
||||||
@ -197,7 +219,9 @@ CGIOperandList::ParseOperandName(const std::string &Op, bool AllowWholeOp) {
|
|||||||
return std::make_pair(OpIdx, i);
|
return std::make_pair(OpIdx, i);
|
||||||
|
|
||||||
// Otherwise, didn't find it!
|
// Otherwise, didn't find it!
|
||||||
PrintFatalError(TheDef->getName() + ": unknown suboperand name in '" + Op + "'");
|
PrintFatalError(TheDef->getLoc(), TheDef->getName() +
|
||||||
|
": unknown suboperand name in '" + Op +
|
||||||
|
"'");
|
||||||
return std::make_pair(0U, 0U);
|
return std::make_pair(0U, 0U);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -739,8 +739,9 @@ CodeGenRegisterClass::CodeGenRegisterClass(CodeGenRegBank &RegBank, Record *R)
|
|||||||
for (unsigned i = 0, e = TypeList.size(); i != e; ++i) {
|
for (unsigned i = 0, e = TypeList.size(); i != e; ++i) {
|
||||||
Record *Type = TypeList[i];
|
Record *Type = TypeList[i];
|
||||||
if (!Type->isSubClassOf("ValueType"))
|
if (!Type->isSubClassOf("ValueType"))
|
||||||
PrintFatalError("RegTypes list member '" + Type->getName() +
|
PrintFatalError(R->getLoc(),
|
||||||
"' does not derive from the ValueType class!");
|
"RegTypes list member '" + Type->getName() +
|
||||||
|
"' does not derive from the ValueType class!");
|
||||||
VTs.push_back(getValueTypeByHwMode(Type, RegBank.getHwModes()));
|
VTs.push_back(getValueTypeByHwMode(Type, RegBank.getHwModes()));
|
||||||
}
|
}
|
||||||
assert(!VTs.empty() && "RegisterClass must contain at least one ValueType!");
|
assert(!VTs.empty() && "RegisterClass must contain at least one ValueType!");
|
||||||
|
@ -1935,8 +1935,9 @@ void CodeGenSchedModels::checkCompleteness() {
|
|||||||
unsigned SCIdx = getSchedClassIdx(*Inst);
|
unsigned SCIdx = getSchedClassIdx(*Inst);
|
||||||
if (!SCIdx) {
|
if (!SCIdx) {
|
||||||
if (Inst->TheDef->isValueUnset("SchedRW") && !HadCompleteModel) {
|
if (Inst->TheDef->isValueUnset("SchedRW") && !HadCompleteModel) {
|
||||||
PrintError("No schedule information for instruction '"
|
PrintError(Inst->TheDef->getLoc(),
|
||||||
+ Inst->TheDef->getName() + "'");
|
"No schedule information for instruction '" +
|
||||||
|
Inst->TheDef->getName() + "'");
|
||||||
Complete = false;
|
Complete = false;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
@ -1954,8 +1955,9 @@ void CodeGenSchedModels::checkCompleteness() {
|
|||||||
return R->getValueAsDef("SchedModel") == ProcModel.ModelDef;
|
return R->getValueAsDef("SchedModel") == ProcModel.ModelDef;
|
||||||
});
|
});
|
||||||
if (I == InstRWs.end()) {
|
if (I == InstRWs.end()) {
|
||||||
PrintError("'" + ProcModel.ModelName + "' lacks information for '" +
|
PrintError(Inst->TheDef->getLoc(), "'" + ProcModel.ModelName +
|
||||||
Inst->TheDef->getName() + "'");
|
"' lacks information for '" +
|
||||||
|
Inst->TheDef->getName() + "'");
|
||||||
Complete = false;
|
Complete = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -495,9 +495,10 @@ ComplexPattern::ComplexPattern(Record *R) {
|
|||||||
} else if (PropList[i]->getName() == "SDNPWantParent") {
|
} else if (PropList[i]->getName() == "SDNPWantParent") {
|
||||||
Properties |= 1 << SDNPWantParent;
|
Properties |= 1 << SDNPWantParent;
|
||||||
} else {
|
} else {
|
||||||
PrintFatalError("Unsupported SD Node property '" +
|
PrintFatalError(R->getLoc(), "Unsupported SD Node property '" +
|
||||||
PropList[i]->getName() + "' on ComplexPattern '" +
|
PropList[i]->getName() +
|
||||||
R->getName() + "'!");
|
"' on ComplexPattern '" + R->getName() +
|
||||||
|
"'!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -533,6 +534,7 @@ CodeGenIntrinsicTable::CodeGenIntrinsicTable(const RecordKeeper &RC,
|
|||||||
CodeGenIntrinsic::CodeGenIntrinsic(Record *R) {
|
CodeGenIntrinsic::CodeGenIntrinsic(Record *R) {
|
||||||
TheDef = R;
|
TheDef = R;
|
||||||
std::string DefName = R->getName();
|
std::string DefName = R->getName();
|
||||||
|
ArrayRef<SMLoc> DefLoc = R->getLoc();
|
||||||
ModRef = ReadWriteMem;
|
ModRef = ReadWriteMem;
|
||||||
Properties = 0;
|
Properties = 0;
|
||||||
isOverloaded = false;
|
isOverloaded = false;
|
||||||
@ -547,7 +549,8 @@ CodeGenIntrinsic::CodeGenIntrinsic(Record *R) {
|
|||||||
|
|
||||||
if (DefName.size() <= 4 ||
|
if (DefName.size() <= 4 ||
|
||||||
std::string(DefName.begin(), DefName.begin() + 4) != "int_")
|
std::string(DefName.begin(), DefName.begin() + 4) != "int_")
|
||||||
PrintFatalError("Intrinsic '" + DefName + "' does not start with 'int_'!");
|
PrintFatalError(DefLoc,
|
||||||
|
"Intrinsic '" + DefName + "' does not start with 'int_'!");
|
||||||
|
|
||||||
EnumName = std::string(DefName.begin()+4, DefName.end());
|
EnumName = std::string(DefName.begin()+4, DefName.end());
|
||||||
|
|
||||||
@ -569,7 +572,8 @@ CodeGenIntrinsic::CodeGenIntrinsic(Record *R) {
|
|||||||
// Verify it starts with "llvm.".
|
// Verify it starts with "llvm.".
|
||||||
if (Name.size() <= 5 ||
|
if (Name.size() <= 5 ||
|
||||||
std::string(Name.begin(), Name.begin() + 5) != "llvm.")
|
std::string(Name.begin(), Name.begin() + 5) != "llvm.")
|
||||||
PrintFatalError("Intrinsic '" + DefName + "'s name does not start with 'llvm.'!");
|
PrintFatalError(DefLoc, "Intrinsic '" + DefName +
|
||||||
|
"'s name does not start with 'llvm.'!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// If TargetPrefix is specified, make sure that Name starts with
|
// If TargetPrefix is specified, make sure that Name starts with
|
||||||
@ -578,8 +582,9 @@ CodeGenIntrinsic::CodeGenIntrinsic(Record *R) {
|
|||||||
if (Name.size() < 6+TargetPrefix.size() ||
|
if (Name.size() < 6+TargetPrefix.size() ||
|
||||||
std::string(Name.begin() + 5, Name.begin() + 6 + TargetPrefix.size())
|
std::string(Name.begin() + 5, Name.begin() + 6 + TargetPrefix.size())
|
||||||
!= (TargetPrefix + "."))
|
!= (TargetPrefix + "."))
|
||||||
PrintFatalError("Intrinsic '" + DefName + "' does not start with 'llvm." +
|
PrintFatalError(DefLoc, "Intrinsic '" + DefName +
|
||||||
TargetPrefix + ".'!");
|
"' does not start with 'llvm." +
|
||||||
|
TargetPrefix + ".'!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse the list of return types.
|
// Parse the list of return types.
|
||||||
@ -611,7 +616,8 @@ CodeGenIntrinsic::CodeGenIntrinsic(Record *R) {
|
|||||||
|
|
||||||
// Reject invalid types.
|
// Reject invalid types.
|
||||||
if (VT == MVT::isVoid)
|
if (VT == MVT::isVoid)
|
||||||
PrintFatalError("Intrinsic '" + DefName + " has void in result type list!");
|
PrintFatalError(DefLoc, "Intrinsic '" + DefName +
|
||||||
|
" has void in result type list!");
|
||||||
|
|
||||||
IS.RetVTs.push_back(VT);
|
IS.RetVTs.push_back(VT);
|
||||||
IS.RetTypeDefs.push_back(TyEl);
|
IS.RetTypeDefs.push_back(TyEl);
|
||||||
@ -629,7 +635,8 @@ CodeGenIntrinsic::CodeGenIntrinsic(Record *R) {
|
|||||||
PrintError(R->getLoc(),
|
PrintError(R->getLoc(),
|
||||||
"Parameter #" + Twine(i) + " has out of bounds matching "
|
"Parameter #" + Twine(i) + " has out of bounds matching "
|
||||||
"number " + Twine(MatchTy));
|
"number " + Twine(MatchTy));
|
||||||
PrintFatalError(Twine("ParamTypes is ") + TypeList->getAsString());
|
PrintFatalError(DefLoc,
|
||||||
|
Twine("ParamTypes is ") + TypeList->getAsString());
|
||||||
}
|
}
|
||||||
VT = OverloadedVTs[MatchTy];
|
VT = OverloadedVTs[MatchTy];
|
||||||
// It only makes sense to use the extended and truncated vector element
|
// It only makes sense to use the extended and truncated vector element
|
||||||
@ -650,7 +657,8 @@ CodeGenIntrinsic::CodeGenIntrinsic(Record *R) {
|
|||||||
|
|
||||||
// Reject invalid types.
|
// Reject invalid types.
|
||||||
if (VT == MVT::isVoid && i != e-1 /*void at end means varargs*/)
|
if (VT == MVT::isVoid && i != e-1 /*void at end means varargs*/)
|
||||||
PrintFatalError("Intrinsic '" + DefName + " has void in result type list!");
|
PrintFatalError(DefLoc, "Intrinsic '" + DefName +
|
||||||
|
" has void in result type list!");
|
||||||
|
|
||||||
IS.ParamVTs.push_back(VT);
|
IS.ParamVTs.push_back(VT);
|
||||||
IS.ParamTypeDefs.push_back(TyEl);
|
IS.ParamTypeDefs.push_back(TyEl);
|
||||||
|
@ -628,13 +628,14 @@ void InstrInfoEmitter::emitRecord(const CodeGenInstruction &Inst, unsigned Num,
|
|||||||
// Emit all of the target-specific flags...
|
// Emit all of the target-specific flags...
|
||||||
BitsInit *TSF = Inst.TheDef->getValueAsBitsInit("TSFlags");
|
BitsInit *TSF = Inst.TheDef->getValueAsBitsInit("TSFlags");
|
||||||
if (!TSF)
|
if (!TSF)
|
||||||
PrintFatalError("no TSFlags?");
|
PrintFatalError(Inst.TheDef->getLoc(), "no TSFlags?");
|
||||||
uint64_t Value = 0;
|
uint64_t Value = 0;
|
||||||
for (unsigned i = 0, e = TSF->getNumBits(); i != e; ++i) {
|
for (unsigned i = 0, e = TSF->getNumBits(); i != e; ++i) {
|
||||||
if (const auto *Bit = dyn_cast<BitInit>(TSF->getBit(i)))
|
if (const auto *Bit = dyn_cast<BitInit>(TSF->getBit(i)))
|
||||||
Value |= uint64_t(Bit->getValue()) << i;
|
Value |= uint64_t(Bit->getValue()) << i;
|
||||||
else
|
else
|
||||||
PrintFatalError("Invalid TSFlags bit in " + Inst.TheDef->getName());
|
PrintFatalError(Inst.TheDef->getLoc(),
|
||||||
|
"Invalid TSFlags bit in " + Inst.TheDef->getName());
|
||||||
}
|
}
|
||||||
OS << ", 0x";
|
OS << ", 0x";
|
||||||
OS.write_hex(Value);
|
OS.write_hex(Value);
|
||||||
|
@ -770,8 +770,9 @@ void IntrinsicEmitter::EmitIntrinsicToBuiltinMap(
|
|||||||
BuiltinMap[Ints[i].TargetPrefix];
|
BuiltinMap[Ints[i].TargetPrefix];
|
||||||
|
|
||||||
if (!BIM.insert(std::make_pair(BuiltinName, Ints[i].EnumName)).second)
|
if (!BIM.insert(std::make_pair(BuiltinName, Ints[i].EnumName)).second)
|
||||||
PrintFatalError("Intrinsic '" + Ints[i].TheDef->getName() +
|
PrintFatalError(Ints[i].TheDef->getLoc(),
|
||||||
"': duplicate " + CompilerName + " builtin name!");
|
"Intrinsic '" + Ints[i].TheDef->getName() +
|
||||||
|
"': duplicate " + CompilerName + " builtin name!");
|
||||||
Table.GetOrAddStringOffset(BuiltinName);
|
Table.GetOrAddStringOffset(BuiltinName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -252,12 +252,14 @@ static bool verifyDagOpCount(CodeGenInstruction &Inst, DagInit *Dag,
|
|||||||
// Source instructions are non compressed instructions and don't have tied
|
// Source instructions are non compressed instructions and don't have tied
|
||||||
// operands.
|
// operands.
|
||||||
if (IsSource)
|
if (IsSource)
|
||||||
PrintFatalError("Input operands for Inst '" + Inst.TheDef->getName() +
|
PrintFatalError(Inst.TheDef->getLoc(),
|
||||||
"' and input Dag operand count mismatch");
|
"Input operands for Inst '" + Inst.TheDef->getName() +
|
||||||
|
"' and input Dag operand count mismatch");
|
||||||
// The Dag can't have more arguments than the Instruction.
|
// The Dag can't have more arguments than the Instruction.
|
||||||
if (Dag->getNumArgs() > Inst.Operands.size())
|
if (Dag->getNumArgs() > Inst.Operands.size())
|
||||||
PrintFatalError("Inst '" + Inst.TheDef->getName() +
|
PrintFatalError(Inst.TheDef->getLoc(),
|
||||||
"' and Dag operand count mismatch");
|
"Inst '" + Inst.TheDef->getName() +
|
||||||
|
"' and Dag operand count mismatch");
|
||||||
|
|
||||||
// The Instruction might have tied operands so the Dag might have
|
// The Instruction might have tied operands so the Dag might have
|
||||||
// a fewer operand count.
|
// a fewer operand count.
|
||||||
@ -267,8 +269,9 @@ static bool verifyDagOpCount(CodeGenInstruction &Inst, DagInit *Dag,
|
|||||||
--RealCount;
|
--RealCount;
|
||||||
|
|
||||||
if (Dag->getNumArgs() != RealCount)
|
if (Dag->getNumArgs() != RealCount)
|
||||||
PrintFatalError("Inst '" + Inst.TheDef->getName() +
|
PrintFatalError(Inst.TheDef->getLoc(),
|
||||||
"' and Dag operand count mismatch");
|
"Inst '" + Inst.TheDef->getName() +
|
||||||
|
"' and Dag operand count mismatch");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -529,7 +532,8 @@ void RISCVCompressInstEmitter::emitCompressInstEmitter(raw_ostream &o,
|
|||||||
bool Compress) {
|
bool Compress) {
|
||||||
Record *AsmWriter = Target.getAsmWriter();
|
Record *AsmWriter = Target.getAsmWriter();
|
||||||
if (!AsmWriter->getValueAsInt("PassSubtarget"))
|
if (!AsmWriter->getValueAsInt("PassSubtarget"))
|
||||||
PrintFatalError("'PassSubtarget' is false. SubTargetInfo object is needed "
|
PrintFatalError(AsmWriter->getLoc(),
|
||||||
|
"'PassSubtarget' is false. SubTargetInfo object is needed "
|
||||||
"for target features.\n");
|
"for target features.\n");
|
||||||
|
|
||||||
std::string Namespace = Target.getName();
|
std::string Namespace = Target.getName();
|
||||||
|
@ -38,9 +38,9 @@ unsigned llvm::parseSDPatternOperatorProperties(Record *R) {
|
|||||||
} else if (Property->getName() == "SDNPVariadic") {
|
} else if (Property->getName() == "SDNPVariadic") {
|
||||||
Properties |= 1 << SDNPVariadic;
|
Properties |= 1 << SDNPVariadic;
|
||||||
} else {
|
} else {
|
||||||
PrintFatalError("Unknown SD Node property '" +
|
PrintFatalError(R->getLoc(), "Unknown SD Node property '" +
|
||||||
Property->getName() + "' on node '" +
|
Property->getName() + "' on node '" +
|
||||||
R->getName() + "'!");
|
R->getName() + "'!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -599,9 +599,10 @@ void SearchableTableEmitter::collectTableEntries(
|
|||||||
for (auto &Field : Table.Fields) {
|
for (auto &Field : Table.Fields) {
|
||||||
auto TI = dyn_cast<TypedInit>(EntryRec->getValueInit(Field.Name));
|
auto TI = dyn_cast<TypedInit>(EntryRec->getValueInit(Field.Name));
|
||||||
if (!TI) {
|
if (!TI) {
|
||||||
PrintFatalError(Twine("Record '") + EntryRec->getName() +
|
PrintFatalError(EntryRec->getLoc(),
|
||||||
"' in table '" + Table.Name + "' is missing field '" +
|
Twine("Record '") + EntryRec->getName() +
|
||||||
Field.Name + "'");
|
"' in table '" + Table.Name +
|
||||||
|
"' is missing field '" + Field.Name + "'");
|
||||||
}
|
}
|
||||||
if (!Field.RecType) {
|
if (!Field.RecType) {
|
||||||
Field.RecType = TI->getType();
|
Field.RecType = TI->getType();
|
||||||
@ -653,8 +654,8 @@ void SearchableTableEmitter::run(raw_ostream &OS) {
|
|||||||
StringRef FilterClass = EnumRec->getValueAsString("FilterClass");
|
StringRef FilterClass = EnumRec->getValueAsString("FilterClass");
|
||||||
Enum->Class = Records.getClass(FilterClass);
|
Enum->Class = Records.getClass(FilterClass);
|
||||||
if (!Enum->Class)
|
if (!Enum->Class)
|
||||||
PrintFatalError(Twine("Enum FilterClass '") + FilterClass +
|
PrintFatalError(EnumRec->getLoc(), Twine("Enum FilterClass '") +
|
||||||
"' does not exist");
|
FilterClass + "' does not exist");
|
||||||
|
|
||||||
collectEnumEntries(*Enum, NameField, ValueField,
|
collectEnumEntries(*Enum, NameField, ValueField,
|
||||||
Records.getAllDerivedDefinitions(FilterClass));
|
Records.getAllDerivedDefinitions(FilterClass));
|
||||||
@ -674,9 +675,10 @@ void SearchableTableEmitter::run(raw_ostream &OS) {
|
|||||||
|
|
||||||
if (auto TypeOfVal = TableRec->getValue(("TypeOf_" + FieldName).str())) {
|
if (auto TypeOfVal = TableRec->getValue(("TypeOf_" + FieldName).str())) {
|
||||||
if (!parseFieldType(Table->Fields.back(), TypeOfVal->getValue())) {
|
if (!parseFieldType(Table->Fields.back(), TypeOfVal->getValue())) {
|
||||||
PrintFatalError(Twine("Table '") + Table->Name +
|
PrintFatalError(TableRec->getLoc(),
|
||||||
"' has bad 'TypeOf_" + FieldName + "': " +
|
Twine("Table '") + Table->Name +
|
||||||
TypeOfVal->getValue()->getAsString());
|
"' has bad 'TypeOf_" + FieldName +
|
||||||
|
"': " + TypeOfVal->getValue()->getAsString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -704,8 +706,10 @@ void SearchableTableEmitter::run(raw_ostream &OS) {
|
|||||||
Record *TableRec = IndexRec->getValueAsDef("Table");
|
Record *TableRec = IndexRec->getValueAsDef("Table");
|
||||||
auto It = TableMap.find(TableRec);
|
auto It = TableMap.find(TableRec);
|
||||||
if (It == TableMap.end())
|
if (It == TableMap.end())
|
||||||
PrintFatalError(Twine("SearchIndex '") + IndexRec->getName() +
|
PrintFatalError(IndexRec->getLoc(),
|
||||||
"' refers to non-existing table '" + TableRec->getName());
|
Twine("SearchIndex '") + IndexRec->getName() +
|
||||||
|
"' refers to non-existing table '" +
|
||||||
|
TableRec->getName());
|
||||||
|
|
||||||
GenericTable &Table = *It->second;
|
GenericTable &Table = *It->second;
|
||||||
Table.Indices.push_back(parseSearchIndex(
|
Table.Indices.push_back(parseSearchIndex(
|
||||||
|
Loading…
Reference in New Issue
Block a user