Add a target hook to encode the compact unwind information.
[oota-llvm.git] / include / llvm / Target / TargetAsmInfo.h
1 //===-- llvm/Target/TargetAsmInfo.h -----------------------------*- 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 //
10 // Interface to provide the information necessary for producing assembly files.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_TARGET_TARGETASMINFO_H
15 #define LLVM_TARGET_TARGETASMINFO_H
16
17 #include "llvm/CodeGen/MachineLocation.h"
18 #include "llvm/Target/TargetLoweringObjectFile.h"
19 #include "llvm/Target/TargetFrameLowering.h"
20 #include "llvm/Target/TargetRegisterInfo.h"
21
22 namespace llvm {
23   class MCSection;
24   class MCContext;
25   class MachineFunction;
26   class TargetMachine;
27   class TargetLoweringObjectFile;
28
29 class TargetAsmInfo {
30   unsigned PointerSize;
31   bool IsLittleEndian;
32   TargetFrameLowering::StackDirection StackDir;
33   std::vector<MachineMove> InitialFrameState;
34   const TargetRegisterInfo *TRI;
35   const TargetFrameLowering *TFI;
36   const TargetLoweringObjectFile *TLOF;
37
38 public:
39   explicit TargetAsmInfo(const TargetMachine &TM);
40
41   /// getPointerSize - Get the pointer size in bytes.
42   unsigned getPointerSize() const {
43     return PointerSize;
44   }
45
46   /// islittleendian - True if the target is little endian.
47   bool isLittleEndian() const {
48     return IsLittleEndian;
49   }
50
51   TargetFrameLowering::StackDirection getStackGrowthDirection() const {
52     return StackDir;
53   }
54
55   const MCSection *getDwarfLineSection() const {
56     return TLOF->getDwarfLineSection();
57   }
58
59   const MCSection *getEHFrameSection() const {
60     return TLOF->getEHFrameSection();
61   }
62
63   const MCSection *getCompactUnwindSection() const {
64     return TLOF->getCompactUnwindSection();
65   }
66
67   const MCSection *getDwarfFrameSection() const {
68     return TLOF->getDwarfFrameSection();
69   }
70
71   const MCSection *getWin64EHFuncTableSection(StringRef Suffix) const {
72     return TLOF->getWin64EHFuncTableSection(Suffix);
73   }
74
75   const MCSection *getWin64EHTableSection(StringRef Suffix) const {
76     return TLOF->getWin64EHTableSection(Suffix);
77   }
78
79   unsigned getFDEEncoding(bool CFI) const {
80     return TLOF->getFDEEncoding(CFI);
81   }
82
83   bool isFunctionEHFrameSymbolPrivate() const {
84     return TLOF->isFunctionEHFrameSymbolPrivate();
85   }
86
87   int getCompactUnwindEncoding(const std::vector<MCCFIInstruction> &Instrs,
88                                int DataAlignmentFactor, bool IsEH) const {
89     return TFI->getCompactUnwindEncoding(Instrs, DataAlignmentFactor, IsEH);
90   }
91
92   const unsigned *getCalleeSavedRegs(MachineFunction *MF = 0) const {
93     return TRI->getCalleeSavedRegs(MF);
94   }
95
96   unsigned getDwarfRARegNum(bool isEH) const {
97     return TRI->getDwarfRegNum(TRI->getRARegister(), isEH);
98   }
99
100   const std::vector<MachineMove> &getInitialFrameState() const {
101     return InitialFrameState;
102   }
103
104   int getDwarfRegNum(unsigned RegNum, bool isEH) const {
105     return TRI->getDwarfRegNum(RegNum, isEH);
106   }
107
108   int getLLVMRegNum(unsigned DwarfRegNum, bool isEH) const {
109     return TRI->getLLVMRegNum(DwarfRegNum, isEH);
110   }
111
112   int getSEHRegNum(unsigned RegNum) const {
113     return TRI->getSEHRegNum(RegNum);
114   }
115 };
116
117 }
118 #endif