From 9f7cd14951ed9b7e04176f68f5c454aa7018b3e3 Mon Sep 17 00:00:00 2001 From: Richard-Qin-X Date: Thu, 13 Aug 2026 13:21:44 +0800 Subject: [RISCV] Use the generated opcode conversion --- backend/lib/Target/RISCV/RISCVMachineCombiner.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'backend/lib/Target/RISCV/RISCVMachineCombiner.cpp') 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(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(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}, -- cgit v1.2.3