]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - opencl/llvm.git/blob - lib/Target/ARM/ARMAsmPrinter.h
DebugInfo: remove target-specific Frame Index handling for DBG_VALUE MachineInstrs
[opencl/llvm.git] / lib / Target / ARM / ARMAsmPrinter.h
1 //===-- ARMAsmPrinter.h - ARM implementation of AsmPrinter ------*- 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 //===----------------------------------------------------------------------===//
10 #ifndef ARMASMPRINTER_H
11 #define ARMASMPRINTER_H
13 #include "ARM.h"
14 #include "ARMTargetMachine.h"
15 #include "llvm/CodeGen/AsmPrinter.h"
16 #include "llvm/Support/Compiler.h"
18 namespace llvm {
20 class MCOperand;
22 namespace ARM {
23   enum DW_ISA {
24     DW_ISA_ARM_thumb = 1,
25     DW_ISA_ARM_arm = 2
26   };
27 }
29 class LLVM_LIBRARY_VISIBILITY ARMAsmPrinter : public AsmPrinter {
31   /// Subtarget - Keep a pointer to the ARMSubtarget around so that we can
32   /// make the right decision when printing asm code for different targets.
33   const ARMSubtarget *Subtarget;
35   /// AFI - Keep a pointer to ARMFunctionInfo for the current
36   /// MachineFunction.
37   ARMFunctionInfo *AFI;
39   /// MCP - Keep a pointer to constantpool entries of the current
40   /// MachineFunction.
41   const MachineConstantPool *MCP;
43   /// InConstantPool - Maintain state when emitting a sequence of constant
44   /// pool entries so we can properly mark them as data regions.
45   bool InConstantPool;
46 public:
47   explicit ARMAsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
48     : AsmPrinter(TM, Streamer), AFI(NULL), MCP(NULL), InConstantPool(false) {
49       Subtarget = &TM.getSubtarget<ARMSubtarget>();
50     }
52   virtual const char *getPassName() const LLVM_OVERRIDE {
53     return "ARM Assembly / Object Emitter";
54   }
56   void printOperand(const MachineInstr *MI, int OpNum, raw_ostream &O,
57                     const char *Modifier = 0);
59   virtual bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNum,
60                                unsigned AsmVariant, const char *ExtraCode,
61                                raw_ostream &O) LLVM_OVERRIDE;
62   virtual bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNum,
63                                      unsigned AsmVariant, const char *ExtraCode,
64                                      raw_ostream &O) LLVM_OVERRIDE;
66   void EmitJumpTable(const MachineInstr *MI);
67   void EmitJump2Table(const MachineInstr *MI);
68   virtual void EmitInstruction(const MachineInstr *MI) LLVM_OVERRIDE;
69   virtual bool runOnMachineFunction(MachineFunction &F) LLVM_OVERRIDE;
71   virtual void EmitConstantPool() LLVM_OVERRIDE {
72     // we emit constant pools customly!
73   }
74   virtual void EmitFunctionBodyEnd() LLVM_OVERRIDE;
75   virtual void EmitFunctionEntryLabel() LLVM_OVERRIDE;
76   virtual void EmitStartOfAsmFile(Module &M) LLVM_OVERRIDE;
77   virtual void EmitEndOfAsmFile(Module &M) LLVM_OVERRIDE;
78   virtual void EmitXXStructor(const Constant *CV) LLVM_OVERRIDE;
80   // lowerOperand - Convert a MachineOperand into the equivalent MCOperand.
81   bool lowerOperand(const MachineOperand &MO, MCOperand &MCOp);
83 private:
84   // Helpers for EmitStartOfAsmFile() and EmitEndOfAsmFile()
85   void emitAttributes();
87   // Helper for ELF .o only
88   void emitARMAttributeSection();
90   // Generic helper used to emit e.g. ARMv5 mul pseudos
91   void EmitPatchedInstruction(const MachineInstr *MI, unsigned TargetOpc);
93   void EmitUnwindingInstruction(const MachineInstr *MI);
95   // emitPseudoExpansionLowering - tblgen'erated.
96   bool emitPseudoExpansionLowering(MCStreamer &OutStreamer,
97                                    const MachineInstr *MI);
99 public:
100   /// EmitDwarfRegOp - Emit dwarf register operation.
101   virtual void EmitDwarfRegOp(const MachineLocation &MLoc) const LLVM_OVERRIDE;
103   virtual unsigned getISAEncoding() LLVM_OVERRIDE {
104     // ARM/Darwin adds ISA to the DWARF info for each function.
105     if (!Subtarget->isTargetDarwin())
106       return 0;
107     return Subtarget->isThumb() ?
108       ARM::DW_ISA_ARM_thumb : ARM::DW_ISA_ARM_arm;
109   }
111 private:
112   MCOperand GetSymbolRef(const MachineOperand &MO, const MCSymbol *Symbol);
113   MCSymbol *GetARMJTIPICJumpTableLabel2(unsigned uid, unsigned uid2) const;
115   MCSymbol *GetARMSJLJEHLabel() const;
117   MCSymbol *GetARMGVSymbol(const GlobalValue *GV);
119 public:
120   /// EmitMachineConstantPoolValue - Print a machine constantpool value to
121   /// the .s file.
122   virtual void
123     EmitMachineConstantPoolValue(MachineConstantPoolValue *MCPV) LLVM_OVERRIDE;
124 };
125 } // end namespace llvm
127 #endif