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 "MCTargetDesc/SystemZTargetStreamer.h"
13#include "SystemZMCInstLower.h"
14#include "SystemZTargetMachine.h"
15#include "llvm/CodeGen/AsmPrinter.h"
16#include "llvm/CodeGen/MachineFunction.h"
17#include "llvm/CodeGen/StackMaps.h"
18#include "llvm/MC/MCInstBuilder.h"
19#include "llvm/Support/Compiler.h"
20
21namespace llvm {
22class MCExpr;
23class MCStreamer;
24class MachineInstr;
25class Module;
26class raw_ostream;
27
28class LLVM_LIBRARY_VISIBILITY SystemZAsmPrinter : public AsmPrinter {
29 SystemZTargetStreamer *getTargetStreamer() {
30 MCTargetStreamer *TS = OutStreamer->getTargetStreamer();
31 assert(TS && "do not have a target streamer");
32 return static_cast<SystemZTargetStreamer *>(TS);
33 }
34
35public:
36 static char ID;
37
38 SystemZAsmPrinter(TargetMachine &TM, std::unique_ptr<MCStreamer> Streamer)
39 : AsmPrinter(TM, std::move(Streamer), ID) {}
40
41 // Override AsmPrinter.
42 StringRef getPassName() const override { return "SystemZ Assembly Printer"; }
43 void emitInstruction(const MachineInstr *MI) override;
44 bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
45 const char *ExtraCode, raw_ostream &OS) override;
46 bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
47 const char *ExtraCode, raw_ostream &OS) override;
48
49 bool runOnMachineFunction(MachineFunction &MF) override {
50 AsmPrinter::runOnMachineFunction(MF);
51
52 // Emit the XRay table for this function.
53 emitXRayTable();
54
55 return false;
56 }
57};
58} // end namespace llvm
59
60#endif
61