aboutsummaryrefslogtreecommitdiff
path: root/backend/include/rcc/MC/MCInstPrinter.h
blob: 6024ced1950d178347a47e099014ceaf1130c219 (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
// SPDX-License-Identifier: GPL-3.0-or-later

#ifndef RCC_MC_MCINSTPRINTER_H
#define RCC_MC_MCINSTPRINTER_H

#include "rcc/MC/MCInst.h"
#include "rcc/Support/Error.h"

#include <cstdint>
#include <string>
#include <string_view>

namespace rcc::mc {

class MCInstPrinter {
public:
  virtual ~MCInstPrinter() = default;

  [[nodiscard]] virtual Expected<std::string> printInstruction(const MCInst &Instruction) const = 0;

  [[nodiscard]] virtual Expected<std::string>
  printTargetExpression(std::uint32_t Kind, std::string_view Operand) const = 0;
};

[[nodiscard]] Expected<std::string> printMCExpression(const MCExpr &Expression,
                                                      const MCInstPrinter &Printer);
[[nodiscard]] Expected<std::string> printMCSymbolName(std::string_view Name);

} // namespace rcc::mc

#endif // RCC_MC_MCINSTPRINTER_H