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 18 namespace llvm { 19 class MCStreamer; 20 class MachineBasicBlock; 21 class MachineInstr; 22 class Module; 23 class raw_ostream; 24 25 class LLVM_LIBRARY_VISIBILITY SystemZAsmPrinter : public AsmPrinter { 26 private: 27 StackMaps SM; 28 29 public: 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 48 private: 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