diff options
| author | Richard-Qin-X <richard.qin.001@gmail.com> | 2026-08-17 02:22:27 +0800 |
|---|---|---|
| committer | Richard-Qin-X <richard.qin.001@gmail.com> | 2026-08-17 02:22:27 +0800 |
| commit | f6a3a06de3d32eaeba1f3c8bbc5faa5ffaeb1128 (patch) | |
| tree | 709c80bac56fb9c18f795ab77185da6132d35ff8 /backend/include | |
| parent | fb5c47bd2cb9ba5b201dfaa8d4918d122c4a624d (diff) | |
| download | rcc-project-f6a3a06de3d32eaeba1f3c8bbc5faa5ffaeb1128.tar.gz rcc-project-f6a3a06de3d32eaeba1f3c8bbc5faa5ffaeb1128.tar.xz | |
[RISCV][GlobalISel] Generate integer extension selections
Diffstat (limited to 'backend/include')
| -rw-r--r-- | backend/include/rcc/CodeGen/GlobalISel/GIMatchTableExecutor.h | 6 | ||||
| -rw-r--r-- | backend/include/rcc/TableGen/Record.h | 27 | ||||
| -rw-r--r-- | backend/include/rcc/Target/RISCV/RISCVSubtarget.h | 1 |
3 files changed, 27 insertions, 7 deletions
diff --git a/backend/include/rcc/CodeGen/GlobalISel/GIMatchTableExecutor.h b/backend/include/rcc/CodeGen/GlobalISel/GIMatchTableExecutor.h index fbbf68f..098f9d6 100644 --- a/backend/include/rcc/CodeGen/GlobalISel/GIMatchTableExecutor.h +++ b/backend/include/rcc/CodeGen/GlobalISel/GIMatchTableExecutor.h @@ -37,6 +37,8 @@ enum class GIMatchTableOpcode : std::uint8_t { CheckOperandBank, CheckOperandClass, CheckIntegerPredicate, + CheckTargetPredicate, + CheckOperandImmediateRanges, CheckOperandDefConstantRanges, CheckOperandDefOpcode, CheckOperandDefOperandConstantRanges, @@ -108,6 +110,10 @@ public: const TargetDescription &Target) const; protected: + [[nodiscard]] virtual Expected<bool> + matchesTargetPredicate(std::string_view Name, const MachineInstr &Instruction, + const MachineFunction &Function, const TargetDescription &Target) const; + [[nodiscard]] virtual Expected<std::optional<GIMatchComplexOperand>> renderComplexOperand(std::string_view Name, const MachineInstr &Instruction, const MachineFunction &Function, const TargetDescription &Target, diff --git a/backend/include/rcc/TableGen/Record.h b/backend/include/rcc/TableGen/Record.h index 6575b82..1f9dea9 100644 --- a/backend/include/rcc/TableGen/Record.h +++ b/backend/include/rcc/TableGen/Record.h @@ -235,15 +235,26 @@ struct SourceSelectionIntegerPredicate final { TextRange Range; }; -struct SourceSelectionOperandDefConstantPredicate final { +struct SourceSelectionTargetPredicate final { + std::string Symbol; + TextRange Range; +}; + +struct SourceSelectionConstantRange final { + std::int64_t Minimum = 0; + std::int64_t Maximum = 0; + TextRange SourceRange; +}; + +struct SourceSelectionOperandImmediatePredicate final { std::uint32_t OperandIndex = 0; - struct ConstantRange final { - std::int64_t Minimum = 0; - std::int64_t Maximum = 0; - TextRange SourceRange; - }; + std::vector<SourceSelectionConstantRange> Ranges; + TextRange Range; +}; - std::vector<ConstantRange> Ranges; +struct SourceSelectionOperandDefConstantPredicate final { + std::uint32_t OperandIndex = 0; + std::vector<SourceSelectionConstantRange> Ranges; TextRange Range; }; @@ -294,9 +305,11 @@ struct SourceSelectionRule final { std::string MatchOpcodeSymbol; std::optional<SourceSelectionTypePredicate> ResultType; std::optional<SourceSelectionIntegerPredicate> IntegerPredicate; + std::vector<SourceSelectionTargetPredicate> TargetPredicates; std::vector<SourceSelectionOperandTypePredicate> OperandTypes; std::vector<SourceSelectionOperandBankPredicate> OperandBanks; std::vector<SourceSelectionOperandClassPredicate> OperandClasses; + std::vector<SourceSelectionOperandImmediatePredicate> OperandImmediates; std::vector<SourceSelectionOperandDefConstantPredicate> OperandDefConstants; std::vector<SourceSelectionDefUsePredicate> DefUsePredicates; std::vector<SourceSelectionTemporary> Temporaries; diff --git a/backend/include/rcc/Target/RISCV/RISCVSubtarget.h b/backend/include/rcc/Target/RISCV/RISCVSubtarget.h index 34ed4bd..c590be6 100644 --- a/backend/include/rcc/Target/RISCV/RISCVSubtarget.h +++ b/backend/include/rcc/Target/RISCV/RISCVSubtarget.h @@ -27,6 +27,7 @@ enum class RISCVExtension : std::uint8_t { F, D, C, + Zba, Zbb, Zicsr, Zifencei, |
