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"
20 #include "llvm/CodeGen/AsmPrinter.h"
21 #include "llvm/MC/MCStreamer.h"
22 #include "llvm/Support/Compiler.h"
23 #include "llvm/Target/TargetMachine.h"
30 class MachineBasicBlock
;
35 class M68kMachineFunctionInfo
;
37 class LLVM_LIBRARY_VISIBILITY M68kAsmPrinter
: public AsmPrinter
{
39 void EmitInstrWithMacroNoAT(const MachineInstr
*MI
);
41 void printOperand(const MachineInstr
*MI
, int OpNum
, raw_ostream
&OS
);
44 const M68kSubtarget
*Subtarget
;
45 const M68kMachineFunctionInfo
*MMFI
;
46 std::unique_ptr
<M68kMCInstLower
> MCInstLowering
;
48 explicit M68kAsmPrinter(TargetMachine
&TM
,
49 std::unique_ptr
<MCStreamer
> Streamer
)
50 : AsmPrinter(TM
, std::move(Streamer
)) {
51 Subtarget
= static_cast<M68kTargetMachine
&>(TM
).getSubtargetImpl();
54 StringRef
getPassName() const override
{ return "M68k Assembly Printer"; }
56 virtual bool runOnMachineFunction(MachineFunction
&MF
) override
;
58 bool PrintAsmOperand(const MachineInstr
*MI
, unsigned OpNo
,
59 const char *ExtraCode
, raw_ostream
&OS
) override
;
61 void emitInstruction(const MachineInstr
*MI
) override
;
62 void emitFunctionBodyStart() override
;
63 void emitFunctionBodyEnd() override
;
64 void emitStartOfAsmFile(Module
&M
) override
;
65 void emitEndOfAsmFile(Module
&M
) override
;