1 | //===- XtensaAsmPrinter.h - Xtensa 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 | // Xtensa Assembly printer class. |
10 | // |
11 | //===----------------------------------------------------------------------===// |
12 | |
13 | #ifndef LLVM_LIB_TARGET_XTENSA_XTENSAASMPRINTER_H |
14 | #define LLVM_LIB_TARGET_XTENSA_XTENSAASMPRINTER_H |
15 | |
16 | #include "XtensaTargetMachine.h" |
17 | #include "llvm/CodeGen/AsmPrinter.h" |
18 | #include "llvm/CodeGen/MachineConstantPool.h" |
19 | #include "llvm/Support/Compiler.h" |
20 | |
21 | namespace llvm { |
22 | class MCStreamer; |
23 | class MachineBasicBlock; |
24 | class MachineInstr; |
25 | class Module; |
26 | class raw_ostream; |
27 | |
28 | class LLVM_LIBRARY_VISIBILITY XtensaAsmPrinter : public AsmPrinter { |
29 | const MCSubtargetInfo *STI; |
30 | |
31 | public: |
32 | explicit XtensaAsmPrinter(TargetMachine &TM, |
33 | std::unique_ptr<MCStreamer> Streamer) |
34 | : AsmPrinter(TM, std::move(Streamer)), STI(TM.getMCSubtargetInfo()) {} |
35 | |
36 | StringRef getPassName() const override { return "Xtensa Assembly Printer"; } |
37 | void emitInstruction(const MachineInstr *MI) override; |
38 | |
39 | void emitConstantPool() override; |
40 | |
41 | void emitMachineConstantPoolEntry(const MachineConstantPoolEntry &CPE, int i); |
42 | |
43 | void emitMachineConstantPoolValue(MachineConstantPoolValue *MCPV) override; |
44 | |
45 | MCSymbol *GetConstantPoolIndexSymbol(const MachineOperand &MO) const; |
46 | |
47 | MCOperand LowerSymbolOperand(const MachineOperand &MO, |
48 | MachineOperand::MachineOperandType MOTy, |
49 | unsigned Offset) const; |
50 | |
51 | // Lower MachineInstr MI to MCInst OutMI. |
52 | void lowerToMCInst(const MachineInstr *MI, MCInst &OutMI) const; |
53 | |
54 | // Return an MCOperand for MO. Return an empty operand if MO is implicit. |
55 | MCOperand lowerOperand(const MachineOperand &MO, unsigned Offset = 0) const; |
56 | }; |
57 | } // end namespace llvm |
58 | |
59 | #endif /* LLVM_LIB_TARGET_XTENSA_XTENSAASMPRINTER_H */ |
60 |