LLVM 22.0.0git
CSKYAsmPrinter.h
Go to the documentation of this file.
1//===-- CSKYAsmPrinter.h - CSKY implementation of AsmPrinter ----*- 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#ifndef LLVM_LIB_TARGET_CSKY_CSKYASMPRINTER_H
10#define LLVM_LIB_TARGET_CSKY_CSKYASMPRINTER_H
11
12#include "CSKYMCInstLower.h"
13#include "CSKYSubtarget.h"
16
17namespace llvm {
19 CSKYMCInstLower MCInstLowering;
20
21 const MCSubtargetInfo *Subtarget;
22 const TargetInstrInfo *TII;
23
24 bool InConstantPool = false;
25
26 /// Keep a pointer to constantpool entries of the current
27 /// MachineFunction.
29
30 void expandTLSLA(const MachineInstr *MI);
31 void emitCustomConstantPool(const MachineInstr *MI);
32 void emitAttributes();
33
34public:
36 std::unique_ptr<MCStreamer> Streamer);
37
38 StringRef getPassName() const override { return "CSKY Assembly Printer"; }
39
40 void EmitToStreamer(MCStreamer &S, const MCInst &Inst);
41
42 /// tblgen'erated driver function for lowering simple MI->MC
43 /// pseudo instructions.
45
47
48 void emitFunctionBodyEnd() override;
49
50 void emitStartOfAsmFile(Module &M) override;
51
52 void emitEndOfAsmFile(Module &M) override;
53
54 void emitInstruction(const MachineInstr *MI) override;
55
57
58 // we emit constant pools customly!
59 void emitConstantPool() override {}
60
61 bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
62 const char *ExtraCode, raw_ostream &OS) override;
63
64 bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
65 const char *ExtraCode, raw_ostream &OS) override;
66};
67} // end namespace llvm
68
69#endif // LLVM_LIB_TARGET_CSKY_CSKYASMPRINTER_H
#define LLVM_LIBRARY_VISIBILITY
Definition Compiler.h:137
IRTranslator LLVM IR MI
TargetMachine & TM
Target machine description.
Definition AsmPrinter.h:93
MachineFunction * MF
The current machine function.
Definition AsmPrinter.h:108
AsmPrinter(TargetMachine &TM, std::unique_ptr< MCStreamer > Streamer, char &ID=AsmPrinter::ID)
void emitFunctionBodyEnd() override
Targets can override this to emit stuff after the last basic block in the function.
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
CSKYAsmPrinter(TargetMachine &TM, std::unique_ptr< MCStreamer > Streamer)
void emitConstantPool() override
Print to the current output stream assembly representations of the constants in the constant pool MCP...
bool lowerPseudoInstExpansion(const MachineInstr *MI, MCInst &Inst)
tblgen'erated driver function for lowering simple MI->MC pseudo instructions.
void emitMachineConstantPoolValue(MachineConstantPoolValue *MCPV) override
bool runOnMachineFunction(MachineFunction &MF) override
Emit the specified function out to the OutStreamer.
void emitEndOfAsmFile(Module &M) override
This virtual method can be overridden by targets that want to emit something at the end of their file...
void emitInstruction(const MachineInstr *MI) override
Targets should implement this to emit instructions.
void emitStartOfAsmFile(Module &M) override
This virtual method can be overridden by targets that want to emit something at the start of their fi...
Instances of this class represent a single low-level machine instruction.
Definition MCInst.h:188
Streaming machine code generation interface.
Definition MCStreamer.h:220
Generic base class for all target subtargets.
Abstract base class for all machine specific constantpool value subclasses.
The MachineConstantPool class keeps track of constants referenced by a function which must be spilled...
Representation of each machine instruction.
A Module instance is used to store all the information related to an LLVM module.
Definition Module.h:67
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
TargetInstrInfo - Interface to description of machine instruction set.
Primary interface to the complete machine description for the target machine.
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
This is an optimization pass for GlobalISel generic memory operations.