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