From ca25d25d4c5131491a50b1a94e63e9b2d3c34ed4 Mon Sep 17 00:00:00 2001 From: Richard-Qin-X Date: Sun, 16 Aug 2026 16:13:12 +0800 Subject: [RISCV][GlobalISel] Select comparisons against zero --- .../rcc/CodeGen/GlobalISel/GIMatchTableExecutor.h | 5 +++++ backend/include/rcc/TableGen/Record.h | 23 ++++++++++++++++++++++ 2 files changed, 28 insertions(+) (limited to 'backend/include') diff --git a/backend/include/rcc/CodeGen/GlobalISel/GIMatchTableExecutor.h b/backend/include/rcc/CodeGen/GlobalISel/GIMatchTableExecutor.h index 807cb4a..7cceca3 100644 --- a/backend/include/rcc/CodeGen/GlobalISel/GIMatchTableExecutor.h +++ b/backend/include/rcc/CodeGen/GlobalISel/GIMatchTableExecutor.h @@ -27,8 +27,13 @@ enum class GIMatchTableOpcode : std::uint8_t { CheckOperandType, CheckOperandBank, CheckOperandClass, + CheckIntegerPredicate, + CheckOperandDefConstant, MutateOpcode, + RenderOperand, + RenderPhysicalRegister, AppendImmediate, + EraseOperandDefinition, Complete, }; diff --git a/backend/include/rcc/TableGen/Record.h b/backend/include/rcc/TableGen/Record.h index 94308c7..4378af8 100644 --- a/backend/include/rcc/TableGen/Record.h +++ b/backend/include/rcc/TableGen/Record.h @@ -229,16 +229,39 @@ struct SourceSelectionOperandClassPredicate final { TextRange Range; }; +struct SourceSelectionIntegerPredicate final { + std::uint32_t OperandIndex = 0; + std::string Predicate; + TextRange Range; +}; + +struct SourceSelectionOperandDefConstantPredicate final { + std::uint32_t OperandIndex = 0; + std::int64_t Value = 0; + TextRange Range; +}; + +struct SourceSelectionOperandRenderer final { + std::optional OperandIndex; + std::string PhysicalRegisterSymbol; + std::vector Flags; + TextRange Range; +}; + struct SourceSelectionRule final { std::string Symbol; std::uint32_t Priority = 0; std::string MatchOpcodeSymbol; std::optional ResultType; + std::optional IntegerPredicate; std::vector OperandTypes; std::vector OperandBanks; std::vector OperandClasses; + std::vector OperandDefConstants; std::string ResultOpcodeSymbol; + std::optional> OperandRenderers; std::vector AppendedImmediates; + std::vector EraseOperandDefinitions; TextRange Range; }; -- cgit v1.2.3