diff options
| author | Richard-Qin-X <richard.qin.001@gmail.com> | 2026-08-16 17:28:49 +0800 |
|---|---|---|
| committer | Richard-Qin-X <richard.qin.001@gmail.com> | 2026-08-16 17:28:49 +0800 |
| commit | 864a29abbdce86353ec91c3587757711d3a42f10 (patch) | |
| tree | 772390cad70fe8e47044f5c921174b254bd8297a /backend/include/rcc/CodeGen/GlobalISel/GIMatchTableExecutor.h | |
| parent | ca25d25d4c5131491a50b1a94e63e9b2d3c34ed4 (diff) | |
| download | rcc-project-864a29abbdce86353ec91c3587757711d3a42f10.tar.gz rcc-project-864a29abbdce86353ec91c3587757711d3a42f10.tar.xz | |
[RISCV][GlobalISel] Generate integer comparisons
Diffstat (limited to 'backend/include/rcc/CodeGen/GlobalISel/GIMatchTableExecutor.h')
| -rw-r--r-- | backend/include/rcc/CodeGen/GlobalISel/GIMatchTableExecutor.h | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/backend/include/rcc/CodeGen/GlobalISel/GIMatchTableExecutor.h b/backend/include/rcc/CodeGen/GlobalISel/GIMatchTableExecutor.h index 7cceca3..afd0d70 100644 --- a/backend/include/rcc/CodeGen/GlobalISel/GIMatchTableExecutor.h +++ b/backend/include/rcc/CodeGen/GlobalISel/GIMatchTableExecutor.h @@ -22,17 +22,27 @@ enum class GIMatchTypeKind : std::uint8_t { Pointer, }; +enum class GIMatchImmediateTransform : std::uint8_t { + Identity, + Negate, + PlusOne, +}; + enum class GIMatchTableOpcode : std::uint8_t { CheckOpcode, CheckOperandType, CheckOperandBank, CheckOperandClass, CheckIntegerPredicate, - CheckOperandDefConstant, + CheckOperandDefConstantRanges, + CreateTemporary, MutateOpcode, + BuildInstruction, RenderOperand, RenderPhysicalRegister, - AppendImmediate, + RenderTemporary, + RenderCapturedImmediate, + RenderImmediate, EraseOperandDefinition, Complete, }; @@ -45,6 +55,11 @@ struct GIMatchTableInstruction final { std::int64_t Immediate = 0; }; +struct GIMatchTableConstantRange final { + std::int64_t Minimum = 0; + std::int64_t Maximum = 0; +}; + struct GIMatchTableRule final { std::string_view Name; std::uint32_t Priority = 0; @@ -55,10 +70,13 @@ struct GIMatchTableRule final { struct GIMatchTable final { std::span<const GIMatchTableInstruction> Instructions; std::span<const GIMatchTableRule> Rules; + std::span<const GIMatchTableConstantRange> ConstantRanges; }; class GIMatchTableExecutor { public: + virtual ~GIMatchTableExecutor() = default; + [[nodiscard]] Expected<bool> match(const GIMatchTable &Table, const MachineInstr &Instruction, const MachineFunction &Function, const TargetDescription &Target) const; @@ -68,6 +86,12 @@ public: [[nodiscard]] Expected<bool> select(const GIMatchTable &Table, MachineInstr &Instruction, MachineFunction &Function, const TargetDescription &Target) const; + +protected: + [[nodiscard]] virtual Expected<void> + finalizeGeneratedInstruction(MachineInstr &Output, MachineFunction &Function, + const TargetDescription &Target, MachineInstrFlags InputFlags, + bool InputMayRaiseFPException) const; }; } // namespace rcc |
