blob: 1b80218a1a0bc684a6c2b38c9164958decb6d053 (
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
|
// SPDX-License-Identifier: GPL-3.0-or-later
#ifndef RCC_TARGET_RISCV_RISCVINSTPRINTER_H
#define RCC_TARGET_RISCV_RISCVINSTPRINTER_H
#include "rcc/CodeGen/TargetDescription.h"
#include "rcc/MC/MCInstPrinter.h"
#include <cstdint>
#include <string>
#include <string_view>
namespace rcc::riscv {
enum class RISCVMCExprKind : std::uint32_t {
CallPLT = 1,
PCRelativeHigh = 2,
PCRelativeLow = 3,
AbsoluteHigh = 4,
AbsoluteLow = 5,
};
class RISCVInstPrinter final : public mc::MCInstPrinter {
public:
explicit RISCVInstPrinter(const TargetDescription &Target) noexcept : Target(&Target) {}
[[nodiscard]] Expected<std::string>
printInstruction(const mc::MCInst &Instruction) const override;
[[nodiscard]] Expected<std::string>
printTargetExpression(std::uint32_t Kind, std::string_view Operand) const override;
private:
const TargetDescription *Target;
};
} // namespace rcc::riscv
#endif // RCC_TARGET_RISCV_RISCVINSTPRINTER_H
|