LLVM 20.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
25 const MCSubtargetInfo *STI;
26
27public:
29 std::unique_ptr<MCStreamer> Streamer)
30 : AsmPrinter(TM, std::move(Streamer)), STI(TM.getMCSubtargetInfo()) {}
31
32 StringRef getPassName() const override {
33 return "LoongArch Assembly Printer";
34 }
35
36 bool runOnMachineFunction(MachineFunction &MF) override;
37
38 void emitInstruction(const MachineInstr *MI) override;
39
40 bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
41 const char *ExtraCode, raw_ostream &OS) override;
42 bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
43 const char *ExtraCode, raw_ostream &OS) override;
44
45 void LowerSTATEPOINT(const MachineInstr &MI);
46 void LowerPATCHABLE_FUNCTION_ENTER(const MachineInstr &MI);
47 void LowerPATCHABLE_FUNCTION_EXIT(const MachineInstr &MI);
48 void LowerPATCHABLE_TAIL_CALL(const MachineInstr &MI);
49 void emitSled(const MachineInstr &MI, SledKind Kind);
50
51 // tblgen'erated function.
53
54 // Wrapper needed for tblgenned pseudo lowering.
55 bool lowerOperand(const MachineOperand &MO, MCOperand &MCOp) const {
56 return lowerLoongArchMachineOperandToMCOperand(MO, MCOp, *this);
57 }
58 void emitJumpTableInfo() override;
59};
60
61} // end namespace llvm
62
63#endif // LLVM_LIB_TARGET_LOONGARCH_LOONGARCHASMPRINTER_H
#define LLVM_LIBRARY_VISIBILITY
Definition: Compiler.h:133
IRTranslator LLVM IR MI
raw_pwrite_stream & OS
This class is intended to be used as a driving class for all asm writers.
Definition: AsmPrinter.h:86
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:185
Instances of this class represent operands of the MCInst class.
Definition: MCInst.h:37
Generic base class for all target subtargets.
Representation of each machine instruction.
Definition: MachineInstr.h:69
MachineOperand class - Representation of each machine instruction operand.
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:51
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:77
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
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:1873
Implement std::hash so that hash_code can be used in STL containers.
Definition: BitVector.h:858