aboutsummaryrefslogtreecommitdiff
path: root/backend/lib/TableGen
diff options
context:
space:
mode:
Diffstat (limited to 'backend/lib/TableGen')
-rw-r--r--backend/lib/TableGen/Parser.cpp32
1 files changed, 29 insertions, 3 deletions
diff --git a/backend/lib/TableGen/Parser.cpp b/backend/lib/TableGen/Parser.cpp
index 248e831..680104e 100644
--- a/backend/lib/TableGen/Parser.cpp
+++ b/backend/lib/TableGen/Parser.cpp
@@ -1182,6 +1182,28 @@ private:
}
[[nodiscard]] bool
+ parseSelectionFloatingPredicate(const yaml::Node &Node,
+ std::optional<SourceSelectionFloatingPredicate> &Result) {
+ if (!requireMapping(&Node, "selection floating predicate") ||
+ !checkKeys(Node, {"index", "value"}, "selection floating predicate")) {
+ return false;
+ }
+ const yaml::Node *IndexNode = requiredNode(Node, "index", "selection floating predicate");
+ const auto Value = requiredScalar(Node, "value", "selection floating predicate");
+ if (IndexNode == nullptr || !Value)
+ return false;
+ const auto Index = unsignedInteger32(*IndexNode, "selection floating predicate index");
+ if (!Index)
+ return false;
+ Result = SourceSelectionFloatingPredicate{
+ .OperandIndex = *Index,
+ .Predicate = *Value,
+ .Range = Node.range(),
+ };
+ return true;
+ }
+
+ [[nodiscard]] bool
parseSelectionTargetPredicates(const yaml::Node &Node,
std::vector<SourceSelectionTargetPredicate> &Result) {
if (!requireSequence(&Node, "selection target predicates"))
@@ -1552,9 +1574,9 @@ private:
[[nodiscard]] bool parseSelectionRuleMatch(const yaml::Node &Node, SourceSelectionRule &Result) {
if (!requireMapping(&Node, "selection rule match") ||
!checkKeys(Node,
- {"opcode", "result_type", "integer_predicate", "target_predicates",
- "operand_types", "operand_banks", "operand_classes", "operand_immediates",
- "operand_def_constants", "def_use"},
+ {"opcode", "result_type", "integer_predicate", "floating_predicate",
+ "target_predicates", "operand_types", "operand_banks", "operand_classes",
+ "operand_immediates", "operand_def_constants", "def_use"},
"selection rule match")) {
return false;
}
@@ -1572,6 +1594,10 @@ private:
if (!parseSelectionIntegerPredicate(*Predicate, Result.IntegerPredicate))
return false;
}
+ if (const yaml::Node *Predicate = optionalNode(Node, "floating_predicate")) {
+ if (!parseSelectionFloatingPredicate(*Predicate, Result.FloatingPredicate))
+ return false;
+ }
if (const yaml::Node *TargetPredicates = optionalNode(Node, "target_predicates")) {
if (!parseSelectionTargetPredicates(*TargetPredicates, Result.TargetPredicates))
return false;