diff options
| author | Richard-Qin-X <richard.qin.001@gmail.com> | 2026-08-09 18:31:49 +0800 |
|---|---|---|
| committer | Richard-Qin-X <richard.qin.001@gmail.com> | 2026-08-09 18:31:49 +0800 |
| commit | 379ff50dcc7ccf977379aee68fa9d10f69065d23 (patch) | |
| tree | e0fac3952d46d0bbcaea32bcfc6087c95fff2992 /backend/include/rcc/MC/MCInstPrinter.h | |
| parent | 495c675771f43cfa12ab7a426a538be72fec1805 (diff) | |
| download | rcc-project-379ff50dcc7ccf977379aee68fa9d10f69065d23.tar.gz rcc-project-379ff50dcc7ccf977379aee68fa9d10f69065d23.tar.xz | |
[MC] Implement RV64GC assembly emission
Diffstat (limited to 'backend/include/rcc/MC/MCInstPrinter.h')
| -rw-r--r-- | backend/include/rcc/MC/MCInstPrinter.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/backend/include/rcc/MC/MCInstPrinter.h b/backend/include/rcc/MC/MCInstPrinter.h new file mode 100644 index 0000000..6024ced --- /dev/null +++ b/backend/include/rcc/MC/MCInstPrinter.h @@ -0,0 +1,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 |
