diff options
| author | Richard-Qin-X <richard.qin.001@gmail.com> | 2026-08-13 13:21:44 +0800 |
|---|---|---|
| committer | Richard-Qin-X <richard.qin.001@gmail.com> | 2026-08-13 13:21:44 +0800 |
| commit | 9f7cd14951ed9b7e04176f68f5c454aa7018b3e3 (patch) | |
| tree | dba38b5a5f75203d10972ff81754ef76c9bb8857 /backend/lib/Target/RISCV/RISCVMachineCombiner.cpp | |
| parent | 8558f80b4077536d6aa46b97328d6df1210e261f (diff) | |
| download | rcc-project-9f7cd14951ed9b7e04176f68f5c454aa7018b3e3.tar.gz rcc-project-9f7cd14951ed9b7e04176f68f5c454aa7018b3e3.tar.xz | |
[RISCV] Use the generated opcode conversion
Diffstat (limited to 'backend/lib/Target/RISCV/RISCVMachineCombiner.cpp')
| -rw-r--r-- | backend/lib/Target/RISCV/RISCVMachineCombiner.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/backend/lib/Target/RISCV/RISCVMachineCombiner.cpp b/backend/lib/Target/RISCV/RISCVMachineCombiner.cpp index f41e77a..78c764c 100644 --- a/backend/lib/Target/RISCV/RISCVMachineCombiner.cpp +++ b/backend/lib/Target/RISCV/RISCVMachineCombiner.cpp @@ -12,10 +12,6 @@ namespace rcc::riscv { namespace { -[[nodiscard]] constexpr Opcode targetOpcode(InstructionOpcode Value) noexcept { - return Opcode::fromValue(static_cast<std::uint32_t>(Value)); -} - [[nodiscard]] constexpr MachineCombinerStageMask allOptimizationStages() noexcept { return machineCombinerStageMask(MachineCombinerStage::SelectedSSA) | machineCombinerStageMask(MachineCombinerStage::PreRegisterAllocation) | @@ -27,7 +23,7 @@ namespace { std::string Name, std::int64_t Immediate) { return { .Name = std::move(Name), - .RootOpcode = targetOpcode(OpcodeValue), + .RootOpcode = instructionOpcode(OpcodeValue), .Stages = allOptimizationStages(), .Predicates = {{MachineCombinerPredicateKind::ImmediateEquals, 2, 0, Immediate}}, .Action = {MachineCombinerActionKind::ReplaceDefWithOperandAndErase, 0, 1}, @@ -39,7 +35,7 @@ namespace { std::size_t SourceOperand) { return { .Name = std::move(Name), - .RootOpcode = targetOpcode(OpcodeValue), + .RootOpcode = instructionOpcode(OpcodeValue), .Stages = allOptimizationStages(), .Predicates = {{MachineCombinerPredicateKind::PhysicalRegisterEquals, ZeroOperand, 0, static_cast<std::int64_t>(PhysicalRegisterID::X0)}}, @@ -51,7 +47,7 @@ namespace { std::string Name) { return { .Name = std::move(Name), - .RootOpcode = targetOpcode(OpcodeValue), + .RootOpcode = instructionOpcode(OpcodeValue), .Stages = allOptimizationStages(), .Predicates = {{MachineCombinerPredicateKind::RegisterEquals, 1, 2, 0}}, .Action = {MachineCombinerActionKind::ReplaceDefWithOperandAndErase, 0, 1}, |
