Tim Northover | 72062f5 | 2013-01-31 12:12:40 +0000 | [diff] [blame] | 1 | // 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 Northover | 5bd6cb2 | 2013-02-14 16:17:01 +0000 | [diff] [blame] | 10 | // This file defines the AArch64 assembly printer class. |
Tim Northover | 72062f5 | 2013-01-31 12:12:40 +0000 | [diff] [blame] | 11 | // |
| 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 | |
| 23 | namespace llvm { |
| 24 | |
| 25 | class MCOperand; |
| 26 | |
| 27 | class 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 Northover | 72062f5 | 2013-01-31 12:12:40 +0000 | [diff] [blame] | 32 | |
| 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 Northover | 72062f5 | 2013-01-31 12:12:40 +0000 | [diff] [blame] | 76 | virtual bool runOnMachineFunction(MachineFunction &MF); |
| 77 | }; |
| 78 | } // end namespace llvm |
| 79 | |
| 80 | #endif |