summaryrefslogtreecommitdiffstats
path: root/llvm/utils/TableGen/CodeGenSchedule.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/utils/TableGen/CodeGenSchedule.cpp')
-rw-r--r--llvm/utils/TableGen/CodeGenSchedule.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/llvm/utils/TableGen/CodeGenSchedule.cpp b/llvm/utils/TableGen/CodeGenSchedule.cpp
index 9f9b32b424e..7791f4ac965 100644
--- a/llvm/utils/TableGen/CodeGenSchedule.cpp
+++ b/llvm/utils/TableGen/CodeGenSchedule.cpp
@@ -106,6 +106,8 @@ struct InstRegexOp : public SetTheory::Operator {
Regexpr = Regex(pat);
}
+ int NumMatches = 0;
+
unsigned NumGeneric = Target.getNumFixedInstructions();
ArrayRef<const CodeGenInstruction *> Generics =
Target.getInstructionsByEnumValue().slice(0, NumGeneric + 1);
@@ -114,8 +116,10 @@ struct InstRegexOp : public SetTheory::Operator {
for (auto *Inst : Generics) {
StringRef InstName = Inst->TheDef->getName();
if (InstName.startswith(Prefix) &&
- (!Regexpr || Regexpr->match(InstName.substr(Prefix.size()))))
+ (!Regexpr || Regexpr->match(InstName.substr(Prefix.size())))) {
Elts.insert(Inst->TheDef);
+ NumMatches++;
+ }
}
ArrayRef<const CodeGenInstruction *> Instructions =
@@ -139,9 +143,14 @@ struct InstRegexOp : public SetTheory::Operator {
// a regex that needs to be checked.
for (auto *Inst : make_range(Range)) {
StringRef InstName = Inst->TheDef->getName();
- if (!Regexpr || Regexpr->match(InstName.substr(Prefix.size())))
+ if (!Regexpr || Regexpr->match(InstName.substr(Prefix.size()))) {
Elts.insert(Inst->TheDef);
+ NumMatches++;
+ }
}
+
+ if (0 == NumMatches)
+ PrintFatalError(Loc, "instregex has no matches: " + Original);
}
}
};
OpenPOWER on IntegriCloud