Don't repeat name in comment. NFC.
[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 /// 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 ///  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   /// Create a X86 MCSubtargetInfo instance. This is exposed so Asm parser, etc.
61   /// do not need to go through TargetRegistry.
62   MCSubtargetInfo *createX86MCSubtargetInfo(StringRef TT, StringRef CPU,
63                                             StringRef FS);
64 }
65
66 MCCodeEmitter *createX86MCCodeEmitter(const MCInstrInfo &MCII,
67                                       const MCRegisterInfo &MRI,
68                                       MCContext &Ctx);
69
70 MCAsmBackend *createX86_32AsmBackend(const Target &T, const MCRegisterInfo &MRI,
71                                      StringRef TT, StringRef CPU);
72 MCAsmBackend *createX86_64AsmBackend(const Target &T, const MCRegisterInfo &MRI,
73                                      StringRef TT, StringRef CPU);
74
75 /// Construct an X86 Windows COFF machine code streamer which will generate
76 /// PE/COFF format object files.
77 ///
78 /// Takes ownership of \p AB and \p CE.
79 MCStreamer *createX86WinCOFFStreamer(MCContext &C, MCAsmBackend &AB,
80                                      raw_ostream &OS, MCCodeEmitter *CE,
81                                      bool RelaxAll);
82
83 /// Construct an X86 Mach-O object writer.
84 MCObjectWriter *createX86MachObjectWriter(raw_ostream &OS,
85                                           bool Is64Bit,
86                                           uint32_t CPUType,
87                                           uint32_t CPUSubtype);
88
89 /// Construct an X86 ELF object writer.
90 MCObjectWriter *createX86ELFObjectWriter(raw_ostream &OS,
91                                          bool IsELF64,
92                                          uint8_t OSABI,
93                                          uint16_t EMachine);
94 /// Construct an X86 Win COFF object writer.
95 MCObjectWriter *createX86WinCOFFObjectWriter(raw_ostream &OS, bool Is64Bit);
96
97 /// Construct X86-64 Mach-O relocation info.
98 MCRelocationInfo *createX86_64MachORelocationInfo(MCContext &Ctx);
99
100 /// Construct X86-64 ELF relocation info.
101 MCRelocationInfo *createX86_64ELFRelocationInfo(MCContext &Ctx);
102 } // End llvm namespace
103
104
105 // Defines symbolic names for X86 registers.  This defines a mapping from
106 // register name to register number.
107 //
108 #define GET_REGINFO_ENUM
109 #include "X86GenRegisterInfo.inc"
110
111 // Defines symbolic names for the X86 instructions.
112 //
113 #define GET_INSTRINFO_ENUM
114 #include "X86GenInstrInfo.inc"
115
116 #define GET_SUBTARGETINFO_ENUM
117 #include "X86GenSubtargetInfo.inc"
118
119 #endif