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 "HexagonTargetMachine.h"
19 #include "llvm/CodeGen/AsmPrinter.h"
20 #include "llvm/Support/Compiler.h"
21 #include "llvm/Support/raw_ostream.h"
24 class HexagonAsmPrinter : public AsmPrinter {
25 const HexagonSubtarget *Subtarget;
28 explicit HexagonAsmPrinter(TargetMachine &TM,
29 std::unique_ptr<MCStreamer> Streamer);
31 bool runOnMachineFunction(MachineFunction &Fn) override {
32 Subtarget = &Fn.getSubtarget<HexagonSubtarget>();
33 return AsmPrinter::runOnMachineFunction(Fn);
36 const char *getPassName() const override {
37 return "Hexagon Assembly Printer";
40 bool isBlockOnlyReachableByFallthrough(
41 const MachineBasicBlock *MBB) const override;
43 void EmitInstruction(const MachineInstr *MI) override;
45 void printOperand(const MachineInstr *MI, unsigned OpNo, raw_ostream &O);
46 bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
47 unsigned AsmVariant, const char *ExtraCode,
48 raw_ostream &OS) override;
49 bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
50 unsigned AsmVariant, const char *ExtraCode,
51 raw_ostream &OS) override;
53 static const char *getRegisterName(unsigned RegNo);
56 } // end of llvm namespace