From bebaa1737200e4944be71bcab4137a3774c2d07e Mon Sep 17 00:00:00 2001 From: Richard-Qin-X Date: Sun, 16 Aug 2026 20:13:50 +0800 Subject: [RISCV][GlobalISel] Generate shift selections --- .../rcc/CodeGen/GlobalISel/GIMatchTableExecutor.h | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'backend/include/rcc/CodeGen/GlobalISel/GIMatchTableExecutor.h') diff --git a/backend/include/rcc/CodeGen/GlobalISel/GIMatchTableExecutor.h b/backend/include/rcc/CodeGen/GlobalISel/GIMatchTableExecutor.h index afd0d70..fbbf68f 100644 --- a/backend/include/rcc/CodeGen/GlobalISel/GIMatchTableExecutor.h +++ b/backend/include/rcc/CodeGen/GlobalISel/GIMatchTableExecutor.h @@ -4,11 +4,14 @@ #define RCC_CODEGEN_GLOBALISEL_GIMATCHTABLEEXECUTOR_H #include "rcc/CodeGen/MachineIRTypes.h" +#include "rcc/CodeGen/MachineOperand.h" #include "rcc/Support/Error.h" #include +#include #include #include +#include namespace rcc { @@ -35,10 +38,15 @@ enum class GIMatchTableOpcode : std::uint8_t { CheckOperandClass, CheckIntegerPredicate, CheckOperandDefConstantRanges, + CheckOperandDefOpcode, + CheckOperandDefOperandConstantRanges, + CaptureDefOperand, CreateTemporary, MutateOpcode, BuildInstruction, RenderOperand, + RenderComplexOperand, + RenderCapturedOperand, RenderPhysicalRegister, RenderTemporary, RenderCapturedImmediate, @@ -53,6 +61,18 @@ struct GIMatchTableInstruction final { std::uint32_t Value = 0; std::uint32_t Auxiliary = 0; std::int64_t Immediate = 0; + std::string_view Symbol; +}; + +struct GIMatchComplexInstruction final { + Opcode ResultOpcode; + LowLevelType ResultType; + std::vector Operands; +}; + +struct GIMatchComplexOperand final { + std::optional Operand; + std::optional Instruction; }; struct GIMatchTableConstantRange final { @@ -88,6 +108,11 @@ public: const TargetDescription &Target) const; protected: + [[nodiscard]] virtual Expected> + renderComplexOperand(std::string_view Name, const MachineInstr &Instruction, + const MachineFunction &Function, const TargetDescription &Target, + std::uint32_t OperandIndex) const; + [[nodiscard]] virtual Expected finalizeGeneratedInstruction(MachineInstr &Output, MachineFunction &Function, const TargetDescription &Target, MachineInstrFlags InputFlags, -- cgit v1.2.3