From 4f7b41c3c711d6c6fa4e422f3eec8961c91eea7a Mon Sep 17 00:00:00 2001 From: Richard-Qin-X Date: Sun, 16 Aug 2026 15:39:45 +0800 Subject: tablegen: Generate GlobalISel match tables --- backend/include/rcc/TableGen/Record.h | 38 +++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'backend/include/rcc/TableGen/Record.h') diff --git a/backend/include/rcc/TableGen/Record.h b/backend/include/rcc/TableGen/Record.h index 50ac4c9..94308c7 100644 --- a/backend/include/rcc/TableGen/Record.h +++ b/backend/include/rcc/TableGen/Record.h @@ -205,6 +205,43 @@ struct SourceInstruction final { TextRange Range; }; +struct SourceSelectionTypePredicate final { + std::string Kind; + std::uint32_t Bits = 0; + TextRange Range; +}; + +struct SourceSelectionOperandTypePredicate final { + std::uint32_t OperandIndex = 0; + SourceSelectionTypePredicate Type; + TextRange Range; +}; + +struct SourceSelectionOperandBankPredicate final { + std::uint32_t OperandIndex = 0; + std::string BankSymbol; + TextRange Range; +}; + +struct SourceSelectionOperandClassPredicate final { + std::uint32_t OperandIndex = 0; + std::string ClassSymbol; + TextRange Range; +}; + +struct SourceSelectionRule final { + std::string Symbol; + std::uint32_t Priority = 0; + std::string MatchOpcodeSymbol; + std::optional ResultType; + std::vector OperandTypes; + std::vector OperandBanks; + std::vector OperandClasses; + std::string ResultOpcodeSymbol; + std::vector AppendedImmediates; + TextRange Range; +}; + struct DescriptionAST final { SourceTarget Target; std::vector RegisterUnits; @@ -220,6 +257,7 @@ struct DescriptionAST final { std::vector EncodingCategories; std::vector AssemblyFormats; std::vector Instructions; + std::vector SelectionRules; }; [[nodiscard]] std::string lowerASCII(std::string_view Value); -- cgit v1.2.3