1 //===-- ARMAsmPrinter.h - Print machine code to an ARM .s file ------------===//
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 // ARM Assembly printer class.
12 //===----------------------------------------------------------------------===//
14 #ifndef ARMASMPRINTER_H
15 #define ARMASMPRINTER_H
18 #include "ARMTargetMachine.h"
19 #include "llvm/CodeGen/AsmPrinter.h"
20 #include "llvm/Support/Compiler.h"
31 class LLVM_LIBRARY_VISIBILITY ARMAsmPrinter : public AsmPrinter {
33 /// Subtarget - Keep a pointer to the ARMSubtarget around so that we can
34 /// make the right decision when printing asm code for different targets.
35 const ARMSubtarget *Subtarget;
37 /// AFI - Keep a pointer to ARMFunctionInfo for the current
41 /// MCP - Keep a pointer to constantpool entries of the current
43 const MachineConstantPool *MCP;
46 explicit ARMAsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
47 : AsmPrinter(TM, Streamer), AFI(NULL), MCP(NULL) {
48 Subtarget = &TM.getSubtarget<ARMSubtarget>();
51 virtual const char *getPassName() const {
52 return "ARM Assembly Printer";
55 void printOperand(const MachineInstr *MI, int OpNum, raw_ostream &O,
56 const char *Modifier = 0);
58 virtual bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNum,
59 unsigned AsmVariant, const char *ExtraCode,
61 virtual bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNum,
63 const char *ExtraCode, raw_ostream &O);
65 void EmitJumpTable(const MachineInstr *MI);
66 void EmitJump2Table(const MachineInstr *MI);
67 virtual void EmitInstruction(const MachineInstr *MI);
68 bool runOnMachineFunction(MachineFunction &F);
70 virtual void EmitConstantPool() {} // we emit constant pools customly!
71 virtual void EmitFunctionEntryLabel();
72 void EmitStartOfAsmFile(Module &M);
73 void EmitEndOfAsmFile(Module &M);
76 // Helpers for EmitStartOfAsmFile() and EmitEndOfAsmFile()
77 void emitAttributes();
79 // Helper for ELF .o only
80 void emitARMAttributeSection();
83 void PrintDebugValueComment(const MachineInstr *MI, raw_ostream &OS);
85 MachineLocation getDebugValueLocation(const MachineInstr *MI) const;
87 virtual unsigned getISAEncoding() {
88 // ARM/Darwin adds ISA to the DWARF info for each function.
89 if (!Subtarget->isTargetDarwin())
91 return Subtarget->isThumb() ?
92 llvm::ARM::DW_ISA_ARM_thumb : llvm::ARM::DW_ISA_ARM_arm;
95 MCSymbol *GetARMSetPICJumpTableLabel2(unsigned uid, unsigned uid2,
96 const MachineBasicBlock *MBB) const;
97 MCSymbol *GetARMJTIPICJumpTableLabel2(unsigned uid, unsigned uid2) const;
99 MCSymbol *GetARMSJLJEHLabel(void) const;
101 /// EmitMachineConstantPoolValue - Print a machine constantpool value to
103 virtual void EmitMachineConstantPoolValue(MachineConstantPoolValue *MCPV);
105 } // end namespace llvm