diff options
| author | Richard-Qin-X <richard.qin.001@gmail.com> | 2026-08-19 05:13:13 +0800 |
|---|---|---|
| committer | Richard-Qin-X <richard.qin.001@gmail.com> | 2026-08-19 05:13:13 +0800 |
| commit | df7095e67ea06f7d6a81d99e70c804ce54ef950d (patch) | |
| tree | b61459583ac9972b196d5e639f02593374eae41f /backend/include/rcc/CodeGen/GlobalISel/GIMatchTableExecutor.h | |
| parent | 307fc0961972ac5264d6f3459978fbec95cad3a9 (diff) | |
| download | rcc-project-df7095e67ea06f7d6a81d99e70c804ce54ef950d.tar.gz rcc-project-df7095e67ea06f7d6a81d99e70c804ce54ef950d.tar.xz | |
[GlobalISel] Generate prelegalizer combiner rules
Diffstat (limited to 'backend/include/rcc/CodeGen/GlobalISel/GIMatchTableExecutor.h')
| -rw-r--r-- | backend/include/rcc/CodeGen/GlobalISel/GIMatchTableExecutor.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/backend/include/rcc/CodeGen/GlobalISel/GIMatchTableExecutor.h b/backend/include/rcc/CodeGen/GlobalISel/GIMatchTableExecutor.h index 31966fe..d8bdc1a 100644 --- a/backend/include/rcc/CodeGen/GlobalISel/GIMatchTableExecutor.h +++ b/backend/include/rcc/CodeGen/GlobalISel/GIMatchTableExecutor.h @@ -34,6 +34,8 @@ enum class GIMatchImmediateTransform : std::uint8_t { enum class GIMatchTableOpcode : std::uint8_t { CheckOpcode, CheckOperandType, + CheckInstructionFlag, + ClearInstructionFlags, CheckOperandBank, CheckOperandClass, CheckIntegerPredicate, @@ -52,10 +54,12 @@ enum class GIMatchTableOpcode : std::uint8_t { RenderOperand, RenderComplexOperand, RenderCapturedOperand, + RenderCapturedTypeBits, RenderPhysicalRegister, RenderTemporary, RenderCapturedImmediate, RenderImmediate, + ReplaceRootWithCapturedOperand, EraseOperandDefinition, Complete, }; @@ -92,10 +96,16 @@ struct GIMatchTableRule final { std::uint32_t InstructionCount = 0; }; +enum class GIMatchTableKind : std::uint8_t { + Selection, + Combiner, +}; + struct GIMatchTable final { std::span<const GIMatchTableInstruction> Instructions; std::span<const GIMatchTableRule> Rules; std::span<const GIMatchTableConstantRange> ConstantRanges; + GIMatchTableKind Kind = GIMatchTableKind::Selection; }; class GIMatchTableExecutor { @@ -112,6 +122,11 @@ public: MachineFunction &Function, const TargetDescription &Target) const; + // Match and apply one generated GlobalISel combiner rule. + [[nodiscard]] Expected<bool> combine(const GIMatchTable &Table, MachineInstr &Instruction, + MachineFunction &Function, + const TargetDescription &Target) const; + protected: [[nodiscard]] virtual Expected<bool> matchesTargetPredicate(std::string_view Name, const MachineInstr &Instruction, |
