1 // AArch64AsmPrinter.h - Print machine code to an AArch64 .s file -*- C++ -*-=//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines the AArch64 assembly printer class.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_AARCH64ASMPRINTER_H
15 #define LLVM_AARCH64ASMPRINTER_H
18 #include "AArch64TargetMachine.h"
19 #include "llvm/CodeGen/AsmPrinter.h"
20 #include "llvm/MC/MCStreamer.h"
21 #include "llvm/Support/Compiler.h"
27 class LLVM_LIBRARY_VISIBILITY AArch64AsmPrinter : public AsmPrinter {
29 /// Subtarget - Keep a pointer to the AArch64Subtarget around so that we can
30 /// make the right decision when printing asm code for different targets.
31 const AArch64Subtarget *Subtarget;
33 // emitPseudoExpansionLowering - tblgen'erated.
34 bool emitPseudoExpansionLowering(MCStreamer &OutStreamer,
35 const MachineInstr *MI);
38 explicit AArch64AsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
39 : AsmPrinter(TM, Streamer) {
40 Subtarget = &TM.getSubtarget<AArch64Subtarget>();
43 bool lowerOperand(const MachineOperand &MO, MCOperand &MCOp) const;
45 MCOperand lowerSymbolOperand(const MachineOperand &MO,
46 const MCSymbol *Sym) const;
48 void EmitInstruction(const MachineInstr *MI);
49 void EmitEndOfAsmFile(Module &M);
51 bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNum,
52 unsigned AsmVariant, const char *ExtraCode,
54 bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNum,
55 unsigned AsmVariant, const char *ExtraCode,
58 /// printSymbolicAddress - Given some kind of reasonably bare symbolic
59 /// reference, print out the appropriate asm string to represent it. If
60 /// appropriate, a relocation-specifier will be produced, composed of a
61 /// general class derived from the MO parameter and an instruction-specific
62 /// suffix, provided in Suffix. E.g. ":got_lo12:" if a Suffix of "lo12" is
64 bool printSymbolicAddress(const MachineOperand &MO,
65 bool PrintImmediatePrefix,
66 StringRef Suffix, raw_ostream &O);
68 virtual const char *getPassName() const {
69 return "AArch64 Assembly Printer";
72 virtual bool runOnMachineFunction(MachineFunction &MF);
74 } // end namespace llvm