diff options
| author | Richard-Qin-X <richard.qin.001@gmail.com> | 2026-08-13 06:19:30 +0800 |
|---|---|---|
| committer | Richard-Qin-X <richard.qin.001@gmail.com> | 2026-08-13 06:19:30 +0800 |
| commit | d62f022c92fcc3ebe2269273628943a0089683fd (patch) | |
| tree | 92d13e4888b095cca71a0ac8b9b9eb99cc845596 /backend/include/rcc/CodeGen/MIRPrinter.h | |
| parent | 236082a0fe4dcd0362c5c74923a93e3db6a01291 (diff) | |
| download | rcc-project-d62f022c92fcc3ebe2269273628943a0089683fd.tar.gz rcc-project-d62f022c92fcc3ebe2269273628943a0089683fd.tar.xz | |
[CodeGen] Align MIR parser and printer ownership
Diffstat (limited to 'backend/include/rcc/CodeGen/MIRPrinter.h')
| -rw-r--r-- | backend/include/rcc/CodeGen/MIRPrinter.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/backend/include/rcc/CodeGen/MIRPrinter.h b/backend/include/rcc/CodeGen/MIRPrinter.h new file mode 100644 index 0000000..bb87509 --- /dev/null +++ b/backend/include/rcc/CodeGen/MIRPrinter.h @@ -0,0 +1,45 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +#ifndef RCC_CODEGEN_MIRPRINTER_H +#define RCC_CODEGEN_MIRPRINTER_H + +#include "rcc/CodeGen/MIRParser/MIRParser.h" +#include "rcc/Support/Error.h" + +#include <string> + +namespace rcc { + +class MachineFunction; +class TargetDescription; + +namespace mir { + +enum class MIPrintMode : unsigned char { + Complete, + Readable, +}; + +struct MIPrinterOptions final { + MIPrintMode Mode = MIPrintMode::Complete; +}; + +[[nodiscard]] Expected<std::string> printMachineFunctionBody(const MachineFunction &Function, + const TargetDescription &Target, + const MIParserContext &Context = {}, + MIPrinterOptions Options = {}); + +struct MIRDocumentPrinterOptions final { + MIPrintMode Mode = MIPrintMode::Complete; + bool EmitEmbeddedIR = true; + std::string DataLayout; +}; + +[[nodiscard]] Expected<std::string> printMIRDocument(const MIRDocument &Document, + const TargetDescription &Target, + MIRDocumentPrinterOptions Options = {}); + +} // namespace mir +} // namespace rcc + +#endif // RCC_CODEGEN_MIRPRINTER_H |
