1//===-- SystemZAsmPrinter.h - SystemZ LLVM assembly printer ----*- C++ -*--===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZASMPRINTER_H
10#define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZASMPRINTER_H
11
12#include "SystemZTargetMachine.h"
13#include "SystemZMCInstLower.h"
14#include "llvm/CodeGen/AsmPrinter.h"
15#include "llvm/CodeGen/StackMaps.h"
16#include "llvm/Support/Compiler.h"
17
18namespace llvm {
19class MCStreamer;
20class MachineBasicBlock;
21class MachineInstr;
22class Module;
23class raw_ostream;
24
25class LLVM_LIBRARY_VISIBILITY SystemZAsmPrinter : public AsmPrinter {
26private:
27  StackMaps SM;
28
29public:
30  SystemZAsmPrinter(TargetMachine &TM, std::unique_ptr<MCStreamer> Streamer)
31      : AsmPrinter(TM, std::move(Streamer)), SM(*this) {}
32
33  // Override AsmPrinter.
34  StringRef getPassName() const override { return "SystemZ Assembly Printer"; }
35  void EmitInstruction(const MachineInstr *MI) override;
36  void EmitMachineConstantPoolValue(MachineConstantPoolValue *MCPV) override;
37  void EmitEndOfAsmFile(Module &M) override;
38  bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
39                       const char *ExtraCode, raw_ostream &OS) override;
40  bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
41                             const char *ExtraCode, raw_ostream &OS) override;
42
43  bool doInitialization(Module &M) override {
44    SM.reset();
45    return AsmPrinter::doInitialization(M);
46  }
47
48private:
49  void LowerFENTRY_CALL(const MachineInstr &MI, SystemZMCInstLower &MCIL);
50  void LowerSTACKMAP(const MachineInstr &MI);
51  void LowerPATCHPOINT(const MachineInstr &MI, SystemZMCInstLower &Lower);
52};
53} // end namespace llvm
54
55#endif
56