blob: af0c9fed066f437688f763b54679fcdd0e8023a1 [file] [log] [blame]
Tim Northover72062f52013-01-31 12:12:40 +00001// AArch64AsmPrinter.h - Print machine code to an AArch64 .s file -*- C++ -*-=//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
Tim Northover5bd6cb22013-02-14 16:17:01 +000010// This file defines the AArch64 assembly printer class.
Tim Northover72062f52013-01-31 12:12:40 +000011//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_AARCH64ASMPRINTER_H
15#define LLVM_AARCH64ASMPRINTER_H
16
17#include "AArch64.h"
18#include "AArch64TargetMachine.h"
19#include "llvm/CodeGen/AsmPrinter.h"
20#include "llvm/MC/MCStreamer.h"
21#include "llvm/Support/Compiler.h"
22
23namespace llvm {
24
25class MCOperand;
26
27class LLVM_LIBRARY_VISIBILITY AArch64AsmPrinter : public AsmPrinter {
28
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;
Tim Northover72062f52013-01-31 12:12:40 +000032
33 // emitPseudoExpansionLowering - tblgen'erated.
34 bool emitPseudoExpansionLowering(MCStreamer &OutStreamer,
35 const MachineInstr *MI);
36
37 public:
38 explicit AArch64AsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
39 : AsmPrinter(TM, Streamer) {
40 Subtarget = &TM.getSubtarget<AArch64Subtarget>();
41 }
42
43 bool lowerOperand(const MachineOperand &MO, MCOperand &MCOp) const;
44
45 MCOperand lowerSymbolOperand(const MachineOperand &MO,
46 const MCSymbol *Sym) const;
47
48 void EmitInstruction(const MachineInstr *MI);
49 void EmitEndOfAsmFile(Module &M);
50
51 bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNum,
52 unsigned AsmVariant, const char *ExtraCode,
53 raw_ostream &O);
54 bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNum,
55 unsigned AsmVariant, const char *ExtraCode,
56 raw_ostream &O);
57
58 void PrintDebugValueComment(const MachineInstr *MI, raw_ostream &OS);
59
60 /// printSymbolicAddress - Given some kind of reasonably bare symbolic
61 /// reference, print out the appropriate asm string to represent it. If
62 /// appropriate, a relocation-specifier will be produced, composed of a
63 /// general class derived from the MO parameter and an instruction-specific
64 /// suffix, provided in Suffix. E.g. ":got_lo12:" if a Suffix of "lo12" is
65 /// given.
66 bool printSymbolicAddress(const MachineOperand &MO,
67 bool PrintImmediatePrefix,
68 StringRef Suffix, raw_ostream &O);
69
70 MachineLocation getDebugValueLocation(const MachineInstr *MI) const;
71
72 virtual const char *getPassName() const {
73 return "AArch64 Assembly Printer";
74 }
75
Tim Northover72062f52013-01-31 12:12:40 +000076 virtual bool runOnMachineFunction(MachineFunction &MF);
77};
78} // end namespace llvm
79
80#endif