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"
30 class HexagonAsmPrinter : public AsmPrinter {
31 const HexagonSubtarget *Subtarget = nullptr;
34 explicit HexagonAsmPrinter(TargetMachine &TM,
35 std::unique_ptr<MCStreamer> Streamer);
37 bool runOnMachineFunction(MachineFunction &Fn) override {
38 Subtarget = &Fn.getSubtarget<HexagonSubtarget>();
39 return AsmPrinter::runOnMachineFunction(Fn);
42 StringRef getPassName() const override {
43 return "Hexagon Assembly Printer";
46 bool isBlockOnlyReachableByFallthrough(
47 const MachineBasicBlock *MBB) const override;
49 void EmitInstruction(const MachineInstr *MI) override;
51 void HexagonProcessInstruction(MCInst &Inst,
52 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;
62 static const char *getRegisterName(unsigned RegNo);
65 } // end namespace llvm
67 #endif // LLVM_LIB_TARGET_HEXAGON_HEXAGONASMPRINTER_H