]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/lib/Target/Hexagon/HexagonAsmPrinter.h
MFV r333779: xz 5.2.4.
[FreeBSD/FreeBSD.git] / contrib / llvm / lib / Target / Hexagon / HexagonAsmPrinter.h
1 //===- HexagonAsmPrinter.h - Print machine code to an Hexagon .s file -----===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // Hexagon Assembly printer class.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_LIB_TARGET_HEXAGON_HEXAGONASMPRINTER_H
15 #define LLVM_LIB_TARGET_HEXAGON_HEXAGONASMPRINTER_H
16
17 #include "Hexagon.h"
18 #include "HexagonSubtarget.h"
19 #include "llvm/CodeGen/AsmPrinter.h"
20 #include "llvm/CodeGen/MachineFunction.h"
21 #include <memory>
22
23 namespace llvm {
24
25 class MachineInstr;
26 class MCInst;
27 class raw_ostream;
28 class TargetMachine;
29
30   class HexagonAsmPrinter : public AsmPrinter {
31     const HexagonSubtarget *Subtarget = nullptr;
32
33   public:
34     explicit HexagonAsmPrinter(TargetMachine &TM,
35                                std::unique_ptr<MCStreamer> Streamer);
36
37     bool runOnMachineFunction(MachineFunction &Fn) override {
38       Subtarget = &Fn.getSubtarget<HexagonSubtarget>();
39       return AsmPrinter::runOnMachineFunction(Fn);
40     }
41
42     StringRef getPassName() const override {
43       return "Hexagon Assembly Printer";
44     }
45
46     bool isBlockOnlyReachableByFallthrough(
47                                    const MachineBasicBlock *MBB) const override;
48
49     void EmitInstruction(const MachineInstr *MI) override;
50
51     void HexagonProcessInstruction(MCInst &Inst,
52                                    const MachineInstr &MBB);
53
54     void printOperand(const MachineInstr *MI, unsigned OpNo, raw_ostream &O);
55     bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
56                          unsigned AsmVariant, const char *ExtraCode,
57                          raw_ostream &OS) override;
58     bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
59                                unsigned AsmVariant, const char *ExtraCode,
60                                raw_ostream &OS) override;
61
62     static const char *getRegisterName(unsigned RegNo);
63   };
64
65 } // end namespace llvm
66
67 #endif // LLVM_LIB_TARGET_HEXAGON_HEXAGONASMPRINTER_H