Revert " [LoongArch][ISel] Check the number of sign bits in `PatGprGpr_32` (#107432)"
[llvm-project.git] / llvm / lib / Target / Hexagon / HexagonAsmPrinter.h
blobb555c8859650361a123a3f77bdf92bb52e3da00c
1 //===- HexagonAsmPrinter.h - Print machine code -----------------*- 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 // Hexagon Assembly printer class.
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_LIB_TARGET_HEXAGON_HEXAGONASMPRINTER_H
14 #define LLVM_LIB_TARGET_HEXAGON_HEXAGONASMPRINTER_H
16 #include "HexagonSubtarget.h"
17 #include "llvm/CodeGen/AsmPrinter.h"
18 #include "llvm/CodeGen/MachineFunction.h"
19 #include "llvm/MC/MCStreamer.h"
20 #include <utility>
22 namespace llvm {
24 class MachineInstr;
25 class MCInst;
26 class raw_ostream;
27 class TargetMachine;
29 class HexagonAsmPrinter : public AsmPrinter {
30 const HexagonSubtarget *Subtarget = nullptr;
32 void emitAttributes();
34 public:
35 explicit HexagonAsmPrinter(TargetMachine &TM,
36 std::unique_ptr<MCStreamer> Streamer)
37 : AsmPrinter(TM, std::move(Streamer)) {}
39 bool runOnMachineFunction(MachineFunction &Fn) override {
40 Subtarget = &Fn.getSubtarget<HexagonSubtarget>();
41 const bool Modified = AsmPrinter::runOnMachineFunction(Fn);
42 // Emit the XRay table for this function.
43 emitXRayTable();
45 return Modified;
48 StringRef getPassName() const override {
49 return "Hexagon Assembly Printer";
52 bool isBlockOnlyReachableByFallthrough(const MachineBasicBlock *MBB)
53 const override;
55 void emitInstruction(const MachineInstr *MI) override;
57 //===------------------------------------------------------------------===//
58 // XRay implementation
59 //===------------------------------------------------------------------===//
60 // XRay-specific lowering for Hexagon.
61 void LowerPATCHABLE_FUNCTION_ENTER(const MachineInstr &MI);
62 void LowerPATCHABLE_FUNCTION_EXIT(const MachineInstr &MI);
63 void LowerPATCHABLE_TAIL_CALL(const MachineInstr &MI);
64 void EmitSled(const MachineInstr &MI, SledKind Kind);
66 void HexagonProcessInstruction(MCInst &Inst, const MachineInstr &MBB);
68 void printOperand(const MachineInstr *MI, unsigned OpNo, raw_ostream &O);
69 bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
70 const char *ExtraCode, raw_ostream &OS) override;
71 bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
72 const char *ExtraCode, raw_ostream &OS) override;
73 void emitStartOfAsmFile(Module &M) override;
74 void emitEndOfAsmFile(Module &M) override;
77 } // end namespace llvm
79 #endif // LLVM_LIB_TARGET_HEXAGON_HEXAGONASMPRINTER_H