6f50f1198806a628cb4c41d75194cc515620b2be
[oota-llvm.git] / lib / Target / X86 / MCTargetDesc / X86MCTargetDesc.h
1 //===-- X86MCTargetDesc.h - X86 Target Descriptions -------------*- 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 // This file provides X86 specific target descriptions.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_LIB_TARGET_X86_MCTARGETDESC_X86MCTARGETDESC_H
15 #define LLVM_LIB_TARGET_X86_MCTARGETDESC_X86MCTARGETDESC_H
16
17 #include "llvm/Support/DataTypes.h"
18 #include <string>
19
20 namespace llvm {
21 class MCAsmBackend;
22 class MCCodeEmitter;
23 class MCContext;
24 class MCInstrInfo;
25 class MCObjectWriter;
26 class MCRegisterInfo;
27 class MCSubtargetInfo;
28 class MCRelocationInfo;
29 class MCStreamer;
30 class Target;
31 class Triple;
32 class StringRef;
33 class raw_ostream;
34
35 extern Target TheX86_32Target, TheX86_64Target;
36
37 /// DWARFFlavour - Flavour of dwarf regnumbers
38 ///
39 namespace DWARFFlavour {
40   enum {
41     X86_64 = 0, X86_32_DarwinEH = 1, X86_32_Generic = 2
42   };
43 }
44
45 /// N86 namespace - Native X86 register numbers
46 ///
47 namespace N86 {
48   enum {
49     EAX = 0, ECX = 1, EDX = 2, EBX = 3, ESP = 4, EBP = 5, ESI = 6, EDI = 7
50   };
51 }
52
53 namespace X86_MC {
54   std::string ParseX86Triple(StringRef TT);
55
56   unsigned getDwarfRegFlavour(Triple TT, bool isEH);
57
58   void InitLLVM2SEHRegisterMapping(MCRegisterInfo *MRI);
59
60   /// createX86MCSubtargetInfo - Create a X86 MCSubtargetInfo instance.
61   /// This is exposed so Asm parser, etc. do not need to go through
62   /// TargetRegistry.
63   MCSubtargetInfo *createX86MCSubtargetInfo(StringRef TT, StringRef CPU,
64                                             StringRef FS);
65 }
66
67 MCCodeEmitter *createX86MCCodeEmitter(const MCInstrInfo &MCII,
68                                       const MCRegisterInfo &MRI,
69                                       MCContext &Ctx);
70
71 MCAsmBackend *createX86_32AsmBackend(const Target &T, const MCRegisterInfo &MRI,
72                                      StringRef TT, StringRef CPU);
73 MCAsmBackend *createX86_64AsmBackend(const Target &T, const MCRegisterInfo &MRI,
74                                      StringRef TT, StringRef CPU);
75
76 /// Construct an X86 Windows COFF machine code streamer which will generate
77 /// PE/COFF format object files.
78 ///
79 /// Takes ownership of \p AB and \p CE.
80 MCStreamer *createX86WinCOFFStreamer(MCContext &C, MCAsmBackend &AB,
81                                      raw_ostream &OS, MCCodeEmitter *CE,
82                                      bool RelaxAll);
83
84 /// createX86MachObjectWriter - Construct an X86 Mach-O object writer.
85 MCObjectWriter *createX86MachObjectWriter(raw_ostream &OS,
86                                           bool Is64Bit,
87                                           uint32_t CPUType,
88                                           uint32_t CPUSubtype);
89
90 /// createX86ELFObjectWriter - Construct an X86 ELF object writer.
91 MCObjectWriter *createX86ELFObjectWriter(raw_ostream &OS,
92                                          bool IsELF64,
93                                          uint8_t OSABI,
94                                          uint16_t EMachine);
95 /// createX86WinCOFFObjectWriter - Construct an X86 Win COFF object writer.
96 MCObjectWriter *createX86WinCOFFObjectWriter(raw_ostream &OS, bool Is64Bit);
97
98 /// createX86_64MachORelocationInfo - Construct X86-64 Mach-O relocation info.
99 MCRelocationInfo *createX86_64MachORelocationInfo(MCContext &Ctx);
100
101 /// createX86_64ELFORelocationInfo - Construct X86-64 ELF relocation info.
102 MCRelocationInfo *createX86_64ELFRelocationInfo(MCContext &Ctx);
103 } // End llvm namespace
104
105
106 // Defines symbolic names for X86 registers.  This defines a mapping from
107 // register name to register number.
108 //
109 #define GET_REGINFO_ENUM
110 #include "X86GenRegisterInfo.inc"
111
112 // Defines symbolic names for the X86 instructions.
113 //
114 #define GET_INSTRINFO_ENUM
115 #include "X86GenInstrInfo.inc"
116
117 #define GET_SUBTARGETINFO_ENUM
118 #include "X86GenSubtargetInfo.inc"
119
120 #endif