// SPDX-License-Identifier: GPL-3.0-or-later #include "rcc/CodeGen/MachineFunction.h" #include "rcc/CodeGen/MachineInstr.h" #include "rcc/CodeGen/TargetDescription.h" #include "rcc/Target/RISCV/RISCVCodeGen.h" #include #include namespace rcc::riscv { namespace { class RISCVMachineMemoryFoldingInfo final : public TargetMemoryFoldingInfo { public: [[nodiscard]] Expected canFoldMemoryOperand(const MachineInstr &, std::size_t, const MachineInstr &, const MachineFunction &, const TargetDescription &) const override { return false; } [[nodiscard]] Expected foldMemoryOperand(MachineInstr &, std::size_t, MachineInstr &, MachineFunction &, const TargetDescription &) const override { return makeUnexpected(ErrorCode::Unsupported, "RV64GC has no register instruction form with a folded memory operand"); } [[nodiscard]] Expected unfoldMemoryOperand(MachineInstr &, MachineFunction &, const TargetDescription &) const override { return false; } [[nodiscard]] Expected> getFoldedMemorySize(const MachineInstr &, const MachineFunction &, const TargetDescription &) const override { return std::optional{}; } }; } // namespace const TargetMemoryFoldingInfo &memoryFoldingInfo() noexcept { static const RISCVMachineMemoryFoldingInfo Value; return Value; } } // namespace rcc::riscv