]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/lib/Target/Hexagon/HexagonAsmPrinter.h
Merge clang release_80 branch r351543, and resolve conflicts.
[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 "llvm/MC/MCStreamer.h"
22 #include <utility>
23
24 namespace llvm {
25
26 class MachineInstr;
27 class MCInst;
28 class raw_ostream;
29 class TargetMachine;
30
31   class HexagonAsmPrinter : public AsmPrinter {
32     const HexagonSubtarget *Subtarget = nullptr;
33
34   public:
35     explicit HexagonAsmPrinter(TargetMachine &TM,
36                                std::unique_ptr<MCStreamer> Streamer)
37       : AsmPrinter(TM, std::move(Streamer)) {}
38
39     bool runOnMachineFunction(MachineFunction &Fn) override {
40       Subtarget = &Fn.getSubtarget<HexagonSubtarget>();
41       return AsmPrinter::runOnMachineFunction(Fn);
42     }
43
44     StringRef getPassName() const override {
45       return "Hexagon Assembly Printer";
46     }
47
48     bool isBlockOnlyReachableByFallthrough(const MachineBasicBlock *MBB)
49           const override;
50
51     void EmitInstruction(const MachineInstr *MI) override;
52     void HexagonProcessInstruction(MCInst &Inst, 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
63 } // end namespace llvm
64
65 #endif // LLVM_LIB_TARGET_HEXAGON_HEXAGONASMPRINTER_H