LLVM  15.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"
15 #include "llvm/MC/MCDirectives.h"
16 
17 namespace 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 
34 public:
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.
44  bool emitPseudoExpansionLowering(MCStreamer &OutStreamer,
45  const MachineInstr *MI);
46 
47  void emitMachineConstantPoolValue(MachineConstantPoolValue *MCPV) override;
48 
49  void emitFunctionBodyEnd() override;
50 
51  void emitStartOfAsmFile(Module &M) override;
52 
53  void emitEndOfAsmFile(Module &M) override;
54 
55  void emitInstruction(const MachineInstr *MI) override;
56 
57  bool runOnMachineFunction(MachineFunction &MF) override;
58 
59  // we emit constant pools customly!
60  void emitConstantPool() override{};
61 
62  bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
63  const char *ExtraCode, raw_ostream &OS) override;
64 
65  bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
66  const char *ExtraCode, raw_ostream &OS) override;
67 };
68 } // end namespace llvm
69 
70 #endif // LLVM_LIB_TARGET_CSKY_CSKYASMPRINTER_H
AsmPrinter.h
MI
IRTranslator LLVM IR MI
Definition: IRTranslator.cpp:104
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
CSKYMCInstLower.h
MCDirectives.h
llvm::MachineConstantPoolValue
Abstract base class for all machine specific constantpool value subclasses.
Definition: MachineConstantPool.h:35
llvm::MCInst
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:184
llvm::MCStreamer
Streaming machine code generation interface.
Definition: MCStreamer.h:201
llvm::TargetInstrInfo
TargetInstrInfo - Interface to description of machine instruction set.
Definition: TargetInstrInfo.h:97
CSKYSubtarget.h
TII
const HexagonInstrInfo * TII
Definition: HexagonCopyToCombine.cpp:127
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:54
llvm::MachineInstr
Representation of each machine instruction.
Definition: MachineInstr.h:66
llvm::MachineConstantPool
The MachineConstantPool class keeps track of constants referenced by a function which must be spilled...
Definition: MachineConstantPool.h:117
llvm::CSKYAsmPrinter::emitConstantPool
void emitConstantPool() override
Print to the current output stream assembly representations of the constants in the constant pool MCP...
Definition: CSKYAsmPrinter.h:60
llvm::TargetMachine
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:77
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
llvm::MachineFunction
Definition: MachineFunction.h:241
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
LLVM_LIBRARY_VISIBILITY
#define LLVM_LIBRARY_VISIBILITY
LLVM_LIBRARY_VISIBILITY - If a class marked with this attribute is linked into a shared library,...
Definition: Compiler.h:125
S
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Definition: README.txt:210
llvm::CSKYMCInstLower
Definition: CSKYMCInstLower.h:21
llvm::AsmPrinter
This class is intended to be used as a driving class for all asm writers.
Definition: AsmPrinter.h:81
llvm::CSKYAsmPrinter::getPassName
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
Definition: CSKYAsmPrinter.h:38
TM
const char LLVMTargetMachineRef TM
Definition: PassBuilderBindings.cpp:47
llvm::CSKYAsmPrinter
Definition: CSKYAsmPrinter.h:18
llvm::MCSubtargetInfo
Generic base class for all target subtargets.
Definition: MCSubtargetInfo.h:76