diff options
| author | Richard-Qin-X <richard.qin.001@gmail.com> | 2026-08-16 20:13:50 +0800 |
|---|---|---|
| committer | Richard-Qin-X <richard.qin.001@gmail.com> | 2026-08-16 20:13:50 +0800 |
| commit | bebaa1737200e4944be71bcab4137a3774c2d07e (patch) | |
| tree | 16a4c1307722f0e894385bc90736abec31b6b511 /backend/include/rcc/CodeGen | |
| parent | 2d05768bedb7f4209038330bebab270a7f1b558d (diff) | |
| download | rcc-project-bebaa1737200e4944be71bcab4137a3774c2d07e.tar.gz rcc-project-bebaa1737200e4944be71bcab4137a3774c2d07e.tar.xz | |
[RISCV][GlobalISel] Generate shift selections
Diffstat (limited to 'backend/include/rcc/CodeGen')
| -rw-r--r-- | backend/include/rcc/CodeGen/GlobalISel/GIMatchTableExecutor.h | 25 | ||||
| -rw-r--r-- | backend/include/rcc/CodeGen/GlobalISel/GISelValueTracking.h | 6 |
2 files changed, 28 insertions, 3 deletions
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 <cstdint> +#include <optional> #include <span> #include <string_view> +#include <vector> 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<MachineOperand> Operands; +}; + +struct GIMatchComplexOperand final { + std::optional<MachineOperand> Operand; + std::optional<GIMatchComplexInstruction> Instruction; }; struct GIMatchTableConstantRange final { @@ -88,6 +108,11 @@ public: const TargetDescription &Target) const; protected: + [[nodiscard]] virtual Expected<std::optional<GIMatchComplexOperand>> + renderComplexOperand(std::string_view Name, const MachineInstr &Instruction, + const MachineFunction &Function, const TargetDescription &Target, + std::uint32_t OperandIndex) const; + [[nodiscard]] virtual Expected<void> finalizeGeneratedInstruction(MachineInstr &Output, MachineFunction &Function, const TargetDescription &Target, MachineInstrFlags InputFlags, diff --git a/backend/include/rcc/CodeGen/GlobalISel/GISelValueTracking.h b/backend/include/rcc/CodeGen/GlobalISel/GISelValueTracking.h index aa02fe3..e51f8c1 100644 --- a/backend/include/rcc/CodeGen/GlobalISel/GISelValueTracking.h +++ b/backend/include/rcc/CodeGen/GlobalISel/GISelValueTracking.h @@ -18,7 +18,7 @@ class TargetDescription; class GISelValueTracking final : public GISelChangeObserver { public: - GISelValueTracking(MachineFunction &Function, const TargetDescription &Target, + GISelValueTracking(const MachineFunction &Function, const TargetDescription &Target, unsigned MaxDepth = 6) noexcept; [[nodiscard]] const MachineFunction &getMachineFunction() const noexcept { @@ -42,8 +42,8 @@ private: [[nodiscard]] Expected<KnownBits> makeUnknown(std::uint32_t BitWidth) const; [[nodiscard]] Expected<KnownBits> getKnownBits(Register Reg, unsigned Depth = 0) const; - MachineFunction &Function; - MachineRegisterInfo &MRI; + const MachineFunction &Function; + const MachineRegisterInfo &MRI; const TargetDescription &Target; unsigned MaxDepth; }; |
