Coverage Report

Created: 2024-01-17 10:31

/src/llvm-project/llvm/lib/Target/LoongArch/LoongArchAsmPrinter.h
Line
Count
Source (jump to first uncovered line)
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"
17
#include "llvm/CodeGen/AsmPrinter.h"
18
#include "llvm/MC/MCStreamer.h"
19
#include "llvm/Support/Compiler.h"
20
21
namespace llvm {
22
23
class LLVM_LIBRARY_VISIBILITY LoongArchAsmPrinter : public AsmPrinter {
24
  const MCSubtargetInfo *STI;
25
26
public:
27
  explicit LoongArchAsmPrinter(TargetMachine &TM,
28
                               std::unique_ptr<MCStreamer> Streamer)
29
0
      : AsmPrinter(TM, std::move(Streamer)), STI(TM.getMCSubtargetInfo()) {}
30
31
0
  StringRef getPassName() const override {
32
0
    return "LoongArch Assembly Printer";
33
0
  }
34
35
  bool runOnMachineFunction(MachineFunction &MF) override;
36
37
  void emitInstruction(const MachineInstr *MI) override;
38
39
  bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
40
                       const char *ExtraCode, raw_ostream &OS) override;
41
  bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
42
                             const char *ExtraCode, raw_ostream &OS) override;
43
44
  void LowerPATCHABLE_FUNCTION_ENTER(const MachineInstr &MI);
45
  void LowerPATCHABLE_FUNCTION_EXIT(const MachineInstr &MI);
46
  void LowerPATCHABLE_TAIL_CALL(const MachineInstr &MI);
47
  void emitSled(const MachineInstr &MI, SledKind Kind);
48
49
  // tblgen'erated function.
50
  bool emitPseudoExpansionLowering(MCStreamer &OutStreamer,
51
                                   const MachineInstr *MI);
52
  // Wrapper needed for tblgenned pseudo lowering.
53
0
  bool lowerOperand(const MachineOperand &MO, MCOperand &MCOp) const {
54
0
    return lowerLoongArchMachineOperandToMCOperand(MO, MCOp, *this);
55
0
  }
56
};
57
58
} // end namespace llvm
59
60
#endif // LLVM_LIB_TARGET_LOONGARCH_LOONGARCHASMPRINTER_H