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