aboutsummaryrefslogtreecommitdiff
path: root/backend/lib/Target/RISCV/RISCVMachineCombiner.cpp
diff options
context:
space:
mode:
authorRichard-Qin-X <richard.qin.001@gmail.com>2026-08-13 13:21:44 +0800
committerRichard-Qin-X <richard.qin.001@gmail.com>2026-08-13 13:21:44 +0800
commit9f7cd14951ed9b7e04176f68f5c454aa7018b3e3 (patch)
treedba38b5a5f75203d10972ff81754ef76c9bb8857 /backend/lib/Target/RISCV/RISCVMachineCombiner.cpp
parent8558f80b4077536d6aa46b97328d6df1210e261f (diff)
downloadrcc-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.cpp10
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},