LLVM 23.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"
19#include "llvm/MC/MCStreamer.h"
21
22namespace llvm {
23
25public:
26 static char ID;
27
28private:
29 const MCSubtargetInfo *STI;
30
31public:
33 std::unique_ptr<MCStreamer> Streamer)
34 : AsmPrinter(TM, std::move(Streamer), ID), STI(&TM.getMCSubtargetInfo()) {
35 }
36
37 StringRef getPassName() const override {
38 return "LoongArch Assembly Printer";
39 }
40
41 bool runOnMachineFunction(MachineFunction &MF) override;
42
43 void emitInstruction(const MachineInstr *MI) override;
44
45 bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
46 const char *ExtraCode, raw_ostream &OS) override;
47 bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
48 const char *ExtraCode, raw_ostream &OS) override;
49
50 void LowerSTATEPOINT(const MachineInstr &MI);
51 void LowerPATCHABLE_FUNCTION_ENTER(const MachineInstr &MI);
52 void LowerPATCHABLE_FUNCTION_EXIT(const MachineInstr &MI);
53 void LowerPATCHABLE_TAIL_CALL(const MachineInstr &MI);
54 void emitSled(const MachineInstr &MI, SledKind Kind);
55
56 // tblgen'erated function.
58
59 // Wrapper needed for tblgenned pseudo lowering.
60 bool lowerOperand(const MachineOperand &MO, MCOperand &MCOp) const {
61 return lowerLoongArchMachineOperandToMCOperand(MO, MCOp, *this);
62 }
63 void emitJumpTableInfo() override;
64};
65
66} // end namespace llvm
67
68#endif // LLVM_LIB_TARGET_LOONGARCH_LOONGARCHASMPRINTER_H
#define LLVM_LIBRARY_VISIBILITY
Definition Compiler.h:137
IRTranslator LLVM IR MI
TargetMachine & TM
Target machine description.
Definition AsmPrinter.h:94
AsmPrinter(TargetMachine &TM, std::unique_ptr< MCStreamer > Streamer, char &ID=AsmPrinter::ID)
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)
Instances of this class represent a single low-level machine instruction.
Definition MCInst.h:188
Instances of this class represent operands of the MCInst class.
Definition MCInst.h:40
Generic base class for all target subtargets.
Representation of each machine instruction.
MachineOperand class - Representation of each machine instruction operand.
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
Primary interface to the complete machine description for the target machine.
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)
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:1916
Implement std::hash so that hash_code can be used in STL containers.
Definition BitVector.h:874