1 //===-- M68kAsmPrinter.h - M68k LLVM Assembly Printer -----------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
10 /// This file contains M68k assembler printer declarations.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_LIB_TARGET_M68K_M68KASMPRINTER_H
15 #define LLVM_LIB_TARGET_M68K_M68KASMPRINTER_H
17 #include "M68kMCInstLower.h"
18 #include "M68kTargetMachine.h"
19 #include "MCTargetDesc/M68kMemOperandPrinter.h"
21 #include "llvm/CodeGen/AsmPrinter.h"
22 #include "llvm/MC/MCStreamer.h"
23 #include "llvm/Support/Compiler.h"
24 #include "llvm/Target/TargetMachine.h"
31 class MachineBasicBlock
;
36 class M68kMachineFunctionInfo
;
38 class LLVM_LIBRARY_VISIBILITY M68kAsmPrinter
40 public M68kMemOperandPrinter
<M68kAsmPrinter
, MachineInstr
> {
42 friend class M68kMemOperandPrinter
;
44 void EmitInstrWithMacroNoAT(const MachineInstr
*MI
);
46 void printOperand(const MachineInstr
*MI
, int OpNum
, raw_ostream
&OS
);
48 void printDisp(const MachineInstr
*MI
, unsigned OpNum
, raw_ostream
&OS
);
49 void printAbsMem(const MachineInstr
*MI
, unsigned OpNum
, raw_ostream
&OS
);
52 const M68kSubtarget
*Subtarget
;
53 const M68kMachineFunctionInfo
*MMFI
;
54 std::unique_ptr
<M68kMCInstLower
> MCInstLowering
;
56 explicit M68kAsmPrinter(TargetMachine
&TM
,
57 std::unique_ptr
<MCStreamer
> Streamer
)
58 : AsmPrinter(TM
, std::move(Streamer
)) {
59 Subtarget
= static_cast<M68kTargetMachine
&>(TM
).getSubtargetImpl();
62 StringRef
getPassName() const override
{ return "M68k Assembly Printer"; }
64 virtual bool runOnMachineFunction(MachineFunction
&MF
) override
;
66 bool PrintAsmOperand(const MachineInstr
*MI
, unsigned OpNo
,
67 const char *ExtraCode
, raw_ostream
&OS
) override
;
68 bool PrintAsmMemoryOperand(const MachineInstr
*MI
, unsigned OpNo
,
69 const char *ExtraCode
, raw_ostream
&OS
) override
;
71 void emitInstruction(const MachineInstr
*MI
) override
;
72 void emitFunctionBodyStart() override
;
73 void emitFunctionBodyEnd() override
;
74 void emitStartOfAsmFile(Module
&M
) override
;
75 void emitEndOfAsmFile(Module
&M
) override
;
79 #endif // LLVM_LIB_TARGET_M68K_M68KASMPRINTER_H