aboutsummaryrefslogtreecommitdiff
path: root/backend/include/rcc/Target/RISCV/RISCVAssemblyPrinter.h
blob: 5c8dca51fecc90476fd400bfbd6a673b41a288be (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_RISCVASSEMBLYPRINTER_H
#define RCC_TARGET_RISCV_RISCVASSEMBLYPRINTER_H

#include "rcc/CodeGen/AsmPrinter.h"
#include "rcc/CodeGen/TargetDescription.h"
#include "rcc/Support/Error.h"

#include <string>

namespace rcc {
class CompilationUnit;
class MachineFunction;
} // namespace rcc

namespace rcc::riscv {

struct AssemblyEmissionOptions final {
  bool EmitFunctionDirectives = true;
  bool EmitCFI = true;
  bool EmitBlockLabels = true;
  bool VerifyInput = true;
};

[[nodiscard]] Expected<std::string> emitAssembly(const CompilationUnit &Unit,
                                                 const TargetDescription &Target,
                                                 AssemblyEmissionOptions Options = {});
[[nodiscard]] Expected<std::string> emitAssembly(const MachineFunction &Function,
                                                 const TargetDescription &Target,
                                                 AssemblyEmissionOptions Options = {});

} // namespace rcc::riscv

#endif // RCC_TARGET_RISCV_RISCVASSEMBLYPRINTER_H