1 //===- HexagonAsmPrinter.h - Print machine code to an Hexagon .s file -----===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // Hexagon Assembly printer class.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_LIB_TARGET_HEXAGON_HEXAGONASMPRINTER_H
15 #define LLVM_LIB_TARGET_HEXAGON_HEXAGONASMPRINTER_H
18 #include "HexagonSubtarget.h"
19 #include "llvm/CodeGen/AsmPrinter.h"
20 #include "llvm/CodeGen/MachineFunction.h"
21 #include "llvm/MC/MCStreamer.h"
31 class HexagonAsmPrinter : public AsmPrinter {
32 const HexagonSubtarget *Subtarget = nullptr;
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 return AsmPrinter::runOnMachineFunction(Fn);
44 StringRef getPassName() const override {
45 return "Hexagon Assembly Printer";
48 bool isBlockOnlyReachableByFallthrough(const MachineBasicBlock *MBB)
51 void EmitInstruction(const MachineInstr *MI) override;
52 void HexagonProcessInstruction(MCInst &Inst, const MachineInstr &MBB);
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;
63 } // end namespace llvm
65 #endif // LLVM_LIB_TARGET_HEXAGON_HEXAGONASMPRINTER_H