LLVM 19.0.0git
M68kAsmPrinter.h
Go to the documentation of this file.
1//===-- M68kAsmPrinter.h - M68k LLVM Assembly Printer -----------*- C++ -*-===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8///
9/// \file
10/// This file contains M68k assembler printer declarations.
11///
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_LIB_TARGET_M68K_M68KASMPRINTER_H
15#define LLVM_LIB_TARGET_M68K_M68KASMPRINTER_H
16
17#include "M68kMCInstLower.h"
18#include "M68kTargetMachine.h"
20
22#include "llvm/MC/MCStreamer.h"
25#include <memory>
26#include <utility>
27
28namespace llvm {
29class MCStreamer;
30class MachineInstr;
31class MachineBasicBlock;
32class Module;
33class raw_ostream;
34
35class M68kSubtarget;
36class M68kMachineFunctionInfo;
37
39 : public AsmPrinter,
40 public M68kMemOperandPrinter<M68kAsmPrinter, MachineInstr> {
41
43
44 void EmitInstrWithMacroNoAT(const MachineInstr *MI);
45
46 void printOperand(const MachineInstr *MI, int OpNum, raw_ostream &OS);
47
48 void printDisp(const MachineInstr *MI, unsigned OpNum, raw_ostream &OS);
49 void printAbsMem(const MachineInstr *MI, unsigned OpNum, raw_ostream &OS);
50
51public:
54 std::unique_ptr<M68kMCInstLower> MCInstLowering;
55
57 std::unique_ptr<MCStreamer> Streamer)
58 : AsmPrinter(TM, std::move(Streamer)) {
59 Subtarget = static_cast<M68kTargetMachine &>(TM).getSubtargetImpl();
60 }
61
62 StringRef getPassName() const override { return "M68k Assembly Printer"; }
63
64 virtual bool runOnMachineFunction(MachineFunction &MF) override;
65
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;
70
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;
76};
77} // namespace llvm
78
79#endif // LLVM_LIB_TARGET_M68K_M68KASMPRINTER_H
#define LLVM_LIBRARY_VISIBILITY
Definition: Compiler.h:131
IRTranslator LLVM IR MI
This file contains code to lower M68k MachineInstrs to their corresponding MCInst records.
This file contains memory operand printing logics shared between AsmPrinter.
This file declares the M68k specific subclass of TargetMachine.
Machine Check Debug Module
const char LLVMTargetMachineRef TM
raw_pwrite_stream & OS
static bool printOperand(raw_ostream &OS, const SelectionDAG *G, const SDValue Value)
This class is intended to be used as a driving class for all asm writers.
Definition: AsmPrinter.h:85
M68kAsmPrinter(TargetMachine &TM, std::unique_ptr< MCStreamer > Streamer)
std::unique_ptr< M68kMCInstLower > MCInstLowering
const M68kSubtarget * Subtarget
const M68kMachineFunctionInfo * MMFI
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
Representation of each machine instruction.
Definition: MachineInstr.h:69
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:77
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1849
Implement std::hash so that hash_code can be used in STL containers.
Definition: BitVector.h:858