From 219b315373ef34ca20cc78b89bf3c3d19442ffbd Mon Sep 17 00:00:00 2001 From: Richard-Qin-X Date: Wed, 19 Aug 2026 03:41:05 +0800 Subject: [RISCV][GlobalISel] Generate integer load selection --- backend/utils/TableGen/Common/CodeGenSelection.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'backend/utils/TableGen/Common/CodeGenSelection.cpp') diff --git a/backend/utils/TableGen/Common/CodeGenSelection.cpp b/backend/utils/TableGen/Common/CodeGenSelection.cpp index defe98b..0d59d6b 100644 --- a/backend/utils/TableGen/Common/CodeGenSelection.cpp +++ b/backend/utils/TableGen/Common/CodeGenSelection.cpp @@ -297,6 +297,20 @@ bool CodeGenTarget::normalizeSelectionRules(NormalizedTargetModel &Result) { ++Normalized.Specificity; } + if (Rule.MemoryPredicate) { + if (Rule.MemoryPredicate->Bytes == 0 || + (MatchInstruction != nullptr && !MatchInstruction->RequiresMemoryOperands)) { + fail(Rule.MemoryPredicate->Range, + "selection memory predicate requires a nonzero size and a memory opcode"); + return false; + } + Normalized.MemoryPredicate = { + .MemoryOperandIndex = Rule.MemoryPredicate->MemoryOperandIndex, + .Bytes = Rule.MemoryPredicate->Bytes, + }; + ++Normalized.Specificity; + } + std::unordered_set TargetPredicateSymbols; for (const SourceSelectionTargetPredicate &Predicate : Rule.TargetPredicates) { if (!isIdentifier(Predicate.Symbol) || -- cgit v1.2.3