blob: 3713bb59644fef587fccb6e225fdb5cc237cf8d3 (
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
|
// SPDX-License-Identifier: GPL-3.0-or-later
#ifndef RCC_TARGET_RISCV_RISCVMCTARGETLOWERING_H
#define RCC_TARGET_RISCV_RISCVMCTARGETLOWERING_H
#include "rcc/CodeGen/TargetMCInstLowering.h"
#include "rcc/Target/RISCV/RISCVInstPrinter.h"
namespace rcc::riscv {
class RISCVMCTargetLowering final : public TargetMCInstLowering {
public:
explicit RISCVMCTargetLowering(const TargetDescription &Target) noexcept
: Target(&Target), Printer(Target) {}
[[nodiscard]] const mc::MCInstPrinter &instructionPrinter() const noexcept override {
return Printer;
}
[[nodiscard]] Expected<mc::MCInst> lowerInstruction(const MachineInstr &Instruction,
MachineMCContext &Context) const override;
[[nodiscard]] Expected<mc::MCExprRef>
lowerSymbolExpression(mc::MCExprRef Expression, std::uint32_t TargetFlags) const override;
[[nodiscard]] Expected<void> emitTerminalInstruction(const MachineInstr &Instruction,
MachineMCContext &Context,
mc::MCStreamer &Streamer) const override;
private:
const TargetDescription *Target;
RISCVInstPrinter Printer;
};
} // namespace rcc::riscv
#endif // RCC_TARGET_RISCV_RISCVMCTARGETLOWERING_H
|