LLVM 24.0.0git
LoongArchAsmPrinter.h
Go to the documentation of this file.
1//===- LoongArchAsmPrinter.h - LoongArch 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// LoongArch Assembly printer class.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_LIB_TARGET_LOONGARCH_LOONGARCHASMPRINTER_H
14#define LLVM_LIB_TARGET_LOONGARCH_LOONGARCHASMPRINTER_H
15
16#include "LoongArchSubtarget.h"
20#include "llvm/MC/MCStreamer.h"
22
23namespace llvm {
24
26public:
27 static char ID;
28
29private:
30 LoongArchTargetStreamer &getTargetStreamer() const;
31
32public:
34 std::unique_ptr<MCStreamer> Streamer)
36
37 StringRef getPassName() const override {
38 return "LoongArch Assembly Printer";
39 }
40
41 bool runOnMachineFunction(MachineFunction &MF) override;
42
43 void emitStartOfAsmFile(Module &M) override;
44
45 void emitInstruction(const MachineInstr *MI) override;
46
47 bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
48 const char *ExtraCode, raw_ostream &OS) override;
49 bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
50 const char *ExtraCode, raw_ostream &OS) override;
51
52 void LowerSTATEPOINT(const MachineInstr &MI);
53 void LowerPATCHABLE_FUNCTION_ENTER(const MachineInstr &MI);
54 void LowerPATCHABLE_FUNCTION_EXIT(const MachineInstr &MI);
55 void LowerPATCHABLE_TAIL_CALL(const MachineInstr &MI);
56 void emitSled(const MachineInstr &MI, SledKind Kind);
57
58 // tblgen'erated function.
60
61 // Wrapper needed for tblgenned pseudo lowering.
62 bool lowerOperand(const MachineOperand &MO, MCOperand &MCOp) const {
63 return lowerLoongArchMachineOperandToMCOperand(MO, MCOp, *this);
64 }
65 void emitJumpTableInfo() override;
66 void emitDebugValue(const MCExpr *Value, unsigned Size) const override;
67};
68
70 : public RequiredPassInfoMixin<LoongArchAsmPrinterBeginPass> {
71public:
73};
74
76 : public RequiredPassInfoMixin<LoongArchAsmPrinterPass> {
77public:
80};
81
83 : public RequiredPassInfoMixin<LoongArchAsmPrinterEndPass> {
84public:
86};
87
88} // end namespace llvm
89
90#endif // LLVM_LIB_TARGET_LOONGARCH_LOONGARCHASMPRINTER_H
#define LLVM_LIBRARY_VISIBILITY
Definition Compiler.h:137
IRTranslator LLVM IR MI
std::unique_ptr< MCStreamer > && Streamer
TargetMachine & TM
Target machine description.
Definition AsmPrinter.h:96
AsmPrinter(TargetMachine &TM, std::unique_ptr< MCStreamer > Streamer, char &ID=AsmPrinter::ID)
PreservedAnalyses run(Module &M, ModuleAnalysisManager &MFAM)
PreservedAnalyses run(Module &M, ModuleAnalysisManager &MFAM)
PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
LoongArchAsmPrinter(TargetMachine &TM, std::unique_ptr< MCStreamer > Streamer)
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
bool lowerOperand(const MachineOperand &MO, MCOperand &MCOp) const
bool lowerPseudoInstExpansion(const MachineInstr *MI, MCInst &Inst)
Base class for the full range of assembler expressions which are needed for parsing.
Definition MCExpr.h:31
Instances of this class represent a single low-level machine instruction.
Definition MCInst.h:187
Instances of this class represent operands of the MCInst class.
Definition MCInst.h:39
Representation of each machine instruction.
MachineOperand class - Representation of each machine instruction operand.
A Module instance is used to store all the information related to an LLVM module.
Definition Module.h:68
A set of analyses that are preserved following a run of a transformation pass.
Definition Analysis.h:112
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
Primary interface to the complete machine description for the target machine.
LLVM Value Representation.
Definition Value.h:75
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
This is an optimization pass for GlobalISel generic memory operations.
bool lowerLoongArchMachineOperandToMCOperand(const MachineOperand &MO, MCOperand &MCOp, const AsmPrinter &AP)
AnalysisManager< MachineFunction > MachineFunctionAnalysisManager
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:1933
AnalysisManager< Module > ModuleAnalysisManager
Convenience typedef for the Module analysis manager.
Definition MIRParser.h:39
Implement std::hash so that hash_code can be used in STL containers.
Definition BitVector.h:879
A CRTP mix-in for passes that should not be skipped.