aboutsummaryrefslogtreecommitdiff
path: root/backend/lib/TableGen/Parser.cpp
diff options
context:
space:
mode:
authorRichard-Qin-X <richard.qin.001@gmail.com>2026-08-27 17:13:36 +0800
committerRichard-Qin-X <richard.qin.001@gmail.com>2026-08-27 17:13:36 +0800
commit3b14bd4d5324b5a280c1ee5567b5526b59e60c5b (patch)
tree1881fc10785a8c195c9b1cdb2ddde6c310f63ab7 /backend/lib/TableGen/Parser.cpp
parentdd477bc887546b00144ea6c0a3e03ad366661636 (diff)
downloadrcc-project-3b14bd4d5324b5a280c1ee5567b5526b59e60c5b.tar.gz
rcc-project-3b14bd4d5324b5a280c1ee5567b5526b59e60c5b.tar.xz
[GlobalISel] Generate floating memory selection
Diffstat (limited to 'backend/lib/TableGen/Parser.cpp')
-rw-r--r--backend/lib/TableGen/Parser.cpp29
1 files changed, 22 insertions, 7 deletions
diff --git a/backend/lib/TableGen/Parser.cpp b/backend/lib/TableGen/Parser.cpp
index 67c7a43..a4e2dfe 100644
--- a/backend/lib/TableGen/Parser.cpp
+++ b/backend/lib/TableGen/Parser.cpp
@@ -1553,20 +1553,35 @@ private:
for (const yaml::NodeID ElementID : Node.sequence()) {
const yaml::Node *Element = Input.node(ElementID);
if (!requireMapping(Element, "selection temporary") ||
- !checkKeys(*Element, {"id", "type_from_operand"}, "selection temporary")) {
+ !checkKeys(*Element, {"id", "type_from_operand", "type"}, "selection temporary")) {
return false;
}
const auto Symbol = requiredScalar(*Element, "id", "selection temporary");
- const yaml::Node *TypeNode =
- requiredNode(*Element, "type_from_operand", "selection temporary");
- if (!Symbol || TypeNode == nullptr)
+ const yaml::Node *TypeFromOperandNode = optionalNode(*Element, "type_from_operand");
+ const yaml::Node *TypeNode = optionalNode(*Element, "type");
+ if (!Symbol)
return false;
- const auto TypeFromOperand = unsignedInteger32(*TypeNode, "selection temporary type operand");
- if (!TypeFromOperand)
+ if ((TypeFromOperandNode == nullptr) == (TypeNode == nullptr)) {
+ fail(Element->range(),
+ "selection temporary requires exactly one of type_from_operand and type");
return false;
+ }
+ std::optional<std::uint32_t> TypeFromOperand;
+ std::optional<SourceSelectionTypePredicate> Type;
+ if (TypeFromOperandNode != nullptr) {
+ TypeFromOperand =
+ unsignedInteger32(*TypeFromOperandNode, "selection temporary type operand");
+ if (!TypeFromOperand)
+ return false;
+ } else {
+ Type = parseSelectionTypePredicate(*TypeNode, "selection temporary type");
+ if (!Type)
+ return false;
+ }
Result.push_back({
.Symbol = *Symbol,
- .TypeFromOperand = *TypeFromOperand,
+ .TypeFromOperand = TypeFromOperand,
+ .Type = std::move(Type),
.Range = Element->range(),
});
}