133388ae8SLu Weining //===- LoongArchAsmPrinter.h - LoongArch LLVM Assembly Printer -*- C++ -*--===// 233388ae8SLu Weining // 333388ae8SLu Weining // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 433388ae8SLu Weining // See https://llvm.org/LICENSE.txt for license information. 533388ae8SLu Weining // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 633388ae8SLu Weining // 733388ae8SLu Weining //===----------------------------------------------------------------------===// 833388ae8SLu Weining // 933388ae8SLu Weining // LoongArch Assembly printer class. 1033388ae8SLu Weining // 1133388ae8SLu Weining //===----------------------------------------------------------------------===// 1233388ae8SLu Weining 1333388ae8SLu Weining #ifndef LLVM_LIB_TARGET_LOONGARCH_LOONGARCHASMPRINTER_H 1433388ae8SLu Weining #define LLVM_LIB_TARGET_LOONGARCH_LOONGARCHASMPRINTER_H 1533388ae8SLu Weining 1633388ae8SLu Weining #include "LoongArchSubtarget.h" 1733388ae8SLu Weining #include "llvm/CodeGen/AsmPrinter.h" 18ffcebcdbSLu Weining #include "llvm/CodeGen/StackMaps.h" 1933388ae8SLu Weining #include "llvm/MC/MCStreamer.h" 2033388ae8SLu Weining #include "llvm/Support/Compiler.h" 2133388ae8SLu Weining 2233388ae8SLu Weining namespace llvm { 2333388ae8SLu Weining 2433388ae8SLu Weining class LLVM_LIBRARY_VISIBILITY LoongArchAsmPrinter : public AsmPrinter { 2533388ae8SLu Weining const MCSubtargetInfo *STI; 2633388ae8SLu Weining 2733388ae8SLu Weining public: 2833388ae8SLu Weining explicit LoongArchAsmPrinter(TargetMachine &TM, 2933388ae8SLu Weining std::unique_ptr<MCStreamer> Streamer) 3033388ae8SLu Weining : AsmPrinter(TM, std::move(Streamer)), STI(TM.getMCSubtargetInfo()) {} 3133388ae8SLu Weining 3233388ae8SLu Weining StringRef getPassName() const override { 3333388ae8SLu Weining return "LoongArch Assembly Printer"; 3433388ae8SLu Weining } 3533388ae8SLu Weining 3633388ae8SLu Weining bool runOnMachineFunction(MachineFunction &MF) override; 3733388ae8SLu Weining 3833388ae8SLu Weining void emitInstruction(const MachineInstr *MI) override; 3933388ae8SLu Weining 40394f3091SWeining Lu bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, 41394f3091SWeining Lu const char *ExtraCode, raw_ostream &OS) override; 4242b70793SWeining Lu bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo, 4342b70793SWeining Lu const char *ExtraCode, raw_ostream &OS) override; 44394f3091SWeining Lu 45ffcebcdbSLu Weining void LowerSTATEPOINT(const MachineInstr &MI); 46db5dfec9SWANG Xuerui void LowerPATCHABLE_FUNCTION_ENTER(const MachineInstr &MI); 47ef33d6cbSWeining Lu void LowerPATCHABLE_FUNCTION_EXIT(const MachineInstr &MI); 48ef33d6cbSWeining Lu void LowerPATCHABLE_TAIL_CALL(const MachineInstr &MI); 49ef33d6cbSWeining Lu void emitSled(const MachineInstr &MI, SledKind Kind); 50db5dfec9SWANG Xuerui 5133388ae8SLu Weining // tblgen'erated function. 527a2a36f9SSergei Barannikov bool lowerPseudoInstExpansion(const MachineInstr *MI, MCInst &Inst); 537a2a36f9SSergei Barannikov 54b940fe6fSwanglei // Wrapper needed for tblgenned pseudo lowering. 55b940fe6fSwanglei bool lowerOperand(const MachineOperand &MO, MCOperand &MCOp) const { 56b940fe6fSwanglei return lowerLoongArchMachineOperandToMCOperand(MO, MCOp, *this); 57b940fe6fSwanglei } 58*4c2c1775Swanglei void emitJumpTableInfo() override; 5933388ae8SLu Weining }; 6033388ae8SLu Weining 6133388ae8SLu Weining } // end namespace llvm 6233388ae8SLu Weining 6333388ae8SLu Weining #endif // LLVM_LIB_TARGET_LOONGARCH_LOONGARCHASMPRINTER_H 64