blob: 2cc5f249fb416fabd9e528602a69055502f1917d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
// 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 <cstddef>
#include <optional>
namespace rcc::riscv {
namespace {
class RISCVMachineMemoryFoldingInfo final : public TargetMemoryFoldingInfo {
public:
[[nodiscard]] Expected<bool> canFoldMemoryOperand(const MachineInstr &, std::size_t,
const MachineInstr &, const MachineFunction &,
const TargetDescription &) const override {
return false;
}
[[nodiscard]] Expected<MachineInstr *>
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<bool> unfoldMemoryOperand(MachineInstr &, MachineFunction &,
const TargetDescription &) const override {
return false;
}
[[nodiscard]] Expected<std::optional<MemorySize>>
getFoldedMemorySize(const MachineInstr &, const MachineFunction &,
const TargetDescription &) const override {
return std::optional<MemorySize>{};
}
};
} // namespace
const TargetMemoryFoldingInfo &memoryFoldingInfo() noexcept {
static const RISCVMachineMemoryFoldingInfo Value;
return Value;
}
} // namespace rcc::riscv
|