LLVM 17.0.0git
SystemZAsmPrinter.h
Go to the documentation of this file.
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 "SystemZMCInstLower.h"
19
20namespace llvm {
21class MCStreamer;
22class MachineInstr;
23class Module;
24class raw_ostream;
25
27private:
28 MCSymbol *CurrentFnPPA1Sym; // PPA1 Symbol.
29 MCSymbol *CurrentFnEPMarkerSym; // Entry Point Marker.
30
31 SystemZTargetStreamer *getTargetStreamer() {
32 MCTargetStreamer *TS = OutStreamer->getTargetStreamer();
33 assert(TS && "do not have a target streamer");
34 return static_cast<SystemZTargetStreamer *>(TS);
35 }
36
37 /// Call type information for XPLINK.
38 enum class CallType {
39 BASR76 = 0, // b'x000' == BASR r7,r6
40 BRAS7 = 1, // b'x001' == BRAS r7,ep
41 RESVD_2 = 2, // b'x010'
42 BRASL7 = 3, // b'x011' == BRASL r7,ep
43 RESVD_4 = 4, // b'x100'
44 RESVD_5 = 5, // b'x101'
45 BALR1415 = 6, // b'x110' == BALR r14,r15
46 BASR33 = 7, // b'x111' == BASR r3,r3
47 };
48
49 void emitPPA1(MCSymbol *FnEndSym);
50
51public:
52 SystemZAsmPrinter(TargetMachine &TM, std::unique_ptr<MCStreamer> Streamer)
53 : AsmPrinter(TM, std::move(Streamer)), CurrentFnPPA1Sym(nullptr),
54 CurrentFnEPMarkerSym(nullptr) {}
55
56 // Override AsmPrinter.
57 StringRef getPassName() const override { return "SystemZ Assembly Printer"; }
58 void emitInstruction(const MachineInstr *MI) override;
59 void emitMachineConstantPoolValue(MachineConstantPoolValue *MCPV) override;
60 void emitEndOfAsmFile(Module &M) override;
61 bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
62 const char *ExtraCode, raw_ostream &OS) override;
63 bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
64 const char *ExtraCode, raw_ostream &OS) override;
65
66 bool doInitialization(Module &M) override {
67 SM.reset();
69 }
70 void emitFunctionEntryLabel() override;
71 void emitFunctionBodyEnd() override;
72
73private:
74 void emitCallInformation(CallType CT);
75 void LowerFENTRY_CALL(const MachineInstr &MI, SystemZMCInstLower &MCIL);
76 void LowerSTACKMAP(const MachineInstr &MI);
77 void LowerPATCHPOINT(const MachineInstr &MI, SystemZMCInstLower &Lower);
78 void emitAttributes(Module &M);
79};
80} // end namespace llvm
81
82#endif
#define LLVM_LIBRARY_VISIBILITY
LLVM_LIBRARY_VISIBILITY - If a class marked with this attribute is linked into a shared library,...
Definition: Compiler.h:126
IRTranslator LLVM IR MI
Machine Check Debug Module
const char LLVMTargetMachineRef TM
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
raw_pwrite_stream & OS
This class is intended to be used as a driving class for all asm writers.
Definition: AsmPrinter.h:84
bool doInitialization(Module &M) override
Set up the AsmPrinter when we are working on a new module.
Definition: AsmPrinter.cpp:429
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
Target specific streamer interface.
Definition: MCStreamer.h:93
Abstract base class for all machine specific constantpool value subclasses.
Representation of each machine instruction.
Definition: MachineInstr.h:68
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
SystemZAsmPrinter(TargetMachine &TM, std::unique_ptr< MCStreamer > Streamer)
bool doInitialization(Module &M) override
Set up the AsmPrinter when we are working on a new module.
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:78
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1946
Definition: BitVector.h:858