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 // 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;
32 const MachineConstantPool *MCP;
34 // emitPseudoExpansionLowering - tblgen'erated.
35 bool emitPseudoExpansionLowering(MCStreamer &OutStreamer,
36 const MachineInstr *MI);
39 explicit AArch64AsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
40 : AsmPrinter(TM, Streamer) {
41 Subtarget = &TM.getSubtarget<AArch64Subtarget>();
44 bool lowerOperand(const MachineOperand &MO, MCOperand &MCOp) const;
46 MCOperand lowerSymbolOperand(const MachineOperand &MO,
47 const MCSymbol *Sym) const;
49 void EmitInstruction(const MachineInstr *MI);
50 void EmitEndOfAsmFile(Module &M);
52 bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNum,
53 unsigned AsmVariant, const char *ExtraCode,
55 bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNum,
56 unsigned AsmVariant, const char *ExtraCode,
59 void PrintDebugValueComment(const MachineInstr *MI, raw_ostream &OS);
61 /// printSymbolicAddress - Given some kind of reasonably bare symbolic
62 /// reference, print out the appropriate asm string to represent it. If
63 /// appropriate, a relocation-specifier will be produced, composed of a
64 /// general class derived from the MO parameter and an instruction-specific
65 /// suffix, provided in Suffix. E.g. ":got_lo12:" if a Suffix of "lo12" is
67 bool printSymbolicAddress(const MachineOperand &MO,
68 bool PrintImmediatePrefix,
69 StringRef Suffix, raw_ostream &O);
71 MachineLocation getDebugValueLocation(const MachineInstr *MI) const;
73 virtual const char *getPassName() const {
74 return "AArch64 Assembly Printer";
77 /// A no-op on AArch64 because we emit our constant pool entries inline with
79 virtual void EmitConstantPool() {}
81 virtual bool runOnMachineFunction(MachineFunction &MF);
83 } // end namespace llvm