1234353Sdim//===-- X86.td - Target definition file for the Intel X86 --*- tablegen -*-===//
2221345Sdim//
3193323Sed//                     The LLVM Compiler Infrastructure
4193323Sed//
5193323Sed// This file is distributed under the University of Illinois Open Source
6193323Sed// License. See LICENSE.TXT for details.
7221345Sdim//
8193323Sed//===----------------------------------------------------------------------===//
9193323Sed//
10226633Sdim// This is a target description file for the Intel i386 architecture, referred
11226633Sdim// to here as the "X86" architecture.
12193323Sed//
13193323Sed//===----------------------------------------------------------------------===//
14193323Sed
15193323Sed// Get the target-independent interfaces which we are implementing...
16193323Sed//
17193323Sedinclude "llvm/Target/Target.td"
18193323Sed
19193323Sed//===----------------------------------------------------------------------===//
20239462Sdim// X86 Subtarget state
21224145Sdim//
22224145Sdim
23224145Sdimdef Mode64Bit : SubtargetFeature<"64bit-mode", "In64BitMode", "true",
24224145Sdim                                  "64-bit mode (x86_64)">;
25224145Sdim
26224145Sdim//===----------------------------------------------------------------------===//
27239462Sdim// X86 Subtarget features
28193323Sed//===----------------------------------------------------------------------===//
29198090Srdivacky
30198090Srdivackydef FeatureCMOV    : SubtargetFeature<"cmov","HasCMov", "true",
31198090Srdivacky                                      "Enable conditional move instructions">;
32198090Srdivacky
33218893Sdimdef FeaturePOPCNT   : SubtargetFeature<"popcnt", "HasPOPCNT", "true",
34218893Sdim                                       "Support POPCNT instruction">;
35202375Srdivacky
36218893Sdim
37193323Seddef FeatureMMX     : SubtargetFeature<"mmx","X86SSELevel", "MMX",
38193323Sed                                      "Enable MMX instructions">;
39193323Seddef FeatureSSE1    : SubtargetFeature<"sse", "X86SSELevel", "SSE1",
40193323Sed                                      "Enable SSE instructions",
41198090Srdivacky                                      // SSE codegen depends on cmovs, and all
42221345Sdim                                      // SSE1+ processors support them.
43198090Srdivacky                                      [FeatureMMX, FeatureCMOV]>;
44193323Seddef FeatureSSE2    : SubtargetFeature<"sse2", "X86SSELevel", "SSE2",
45193323Sed                                      "Enable SSE2 instructions",
46193323Sed                                      [FeatureSSE1]>;
47193323Seddef FeatureSSE3    : SubtargetFeature<"sse3", "X86SSELevel", "SSE3",
48193323Sed                                      "Enable SSE3 instructions",
49193323Sed                                      [FeatureSSE2]>;
50193323Seddef FeatureSSSE3   : SubtargetFeature<"ssse3", "X86SSELevel", "SSSE3",
51193323Sed                                      "Enable SSSE3 instructions",
52193323Sed                                      [FeatureSSE3]>;
53263508Sdimdef FeatureSSE41   : SubtargetFeature<"sse4.1", "X86SSELevel", "SSE41",
54193323Sed                                      "Enable SSE 4.1 instructions",
55193323Sed                                      [FeatureSSSE3]>;
56263508Sdimdef FeatureSSE42   : SubtargetFeature<"sse4.2", "X86SSELevel", "SSE42",
57193323Sed                                      "Enable SSE 4.2 instructions",
58234353Sdim                                      [FeatureSSE41]>;
59193323Seddef Feature3DNow   : SubtargetFeature<"3dnow", "X863DNowLevel", "ThreeDNow",
60221345Sdim                                      "Enable 3DNow! instructions",
61221345Sdim                                      [FeatureMMX]>;
62193323Seddef Feature3DNowA  : SubtargetFeature<"3dnowa", "X863DNowLevel", "ThreeDNowA",
63193323Sed                                      "Enable 3DNow! Athlon instructions",
64193323Sed                                      [Feature3DNow]>;
65193323Sed// All x86-64 hardware has SSE2, but we don't mark SSE2 as an implied
66193323Sed// feature, because SSE2 can be disabled (e.g. for compiling OS kernels)
67193323Sed// without disabling 64-bit mode.
68193323Seddef Feature64Bit   : SubtargetFeature<"64bit", "HasX86_64", "true",
69205218Srdivacky                                      "Support 64-bit instructions",
70205218Srdivacky                                      [FeatureCMOV]>;
71263508Sdimdef FeatureCMPXCHG16B : SubtargetFeature<"cx16", "HasCmpxchg16b", "true",
72226633Sdim                                      "64-bit with cmpxchg16b",
73226633Sdim                                      [Feature64Bit]>;
74193323Seddef FeatureSlowBTMem : SubtargetFeature<"slow-bt-mem", "IsBTMemSlow", "true",
75193323Sed                                       "Bit testing of memory is slow">;
76206083Srdivackydef FeatureFastUAMem : SubtargetFeature<"fast-unaligned-mem",
77206083Srdivacky                                        "IsUAMemFast", "true",
78206083Srdivacky                                        "Fast unaligned memory access">;
79193323Seddef FeatureSSE4A   : SubtargetFeature<"sse4a", "HasSSE4A", "true",
80218893Sdim                                      "Support SSE 4a instructions",
81234353Sdim                                      [FeatureSSE3]>;
82193323Sed
83234353Sdimdef FeatureAVX     : SubtargetFeature<"avx", "X86SSELevel", "AVX",
84234353Sdim                                      "Enable AVX instructions",
85234353Sdim                                      [FeatureSSE42]>;
86234353Sdimdef FeatureAVX2    : SubtargetFeature<"avx2", "X86SSELevel", "AVX2",
87234353Sdim                                      "Enable AVX2 instructions",
88234353Sdim                                      [FeatureAVX]>;
89263508Sdimdef FeatureAVX512   : SubtargetFeature<"avx512f", "X86SSELevel", "AVX512F",
90263508Sdim                                      "Enable AVX-512 instructions",
91263508Sdim                                      [FeatureAVX2]>;
92263508Sdimdef FeatureERI      : SubtargetFeature<"avx512er", "HasERI", "true",
93263508Sdim                      "Enable AVX-512 Exponential and Reciprocal Instructions",
94263508Sdim                                      [FeatureAVX512]>;
95263508Sdimdef FeatureCDI      : SubtargetFeature<"avx512cd", "HasCDI", "true",
96263508Sdim                      "Enable AVX-512 Conflict Detection Instructions",
97263508Sdim                                      [FeatureAVX512]>;
98263508Sdimdef FeaturePFI      : SubtargetFeature<"avx512pf", "HasPFI", "true",
99263508Sdim                      "Enable AVX-512 PreFetch Instructions",
100263508Sdim                                      [FeatureAVX512]>;
101263508Sdim
102239462Sdimdef FeaturePCLMUL  : SubtargetFeature<"pclmul", "HasPCLMUL", "true",
103239462Sdim                         "Enable packed carry-less multiplication instructions",
104239462Sdim                               [FeatureSSE2]>;
105239462Sdimdef FeatureFMA     : SubtargetFeature<"fma", "HasFMA", "true",
106234353Sdim                                      "Enable three-operand fused multiple-add",
107234353Sdim                                      [FeatureAVX]>;
108195098Seddef FeatureFMA4    : SubtargetFeature<"fma4", "HasFMA4", "true",
109234353Sdim                                      "Enable four-operand fused multiple-add",
110239462Sdim                                      [FeatureAVX, FeatureSSE4A]>;
111234353Sdimdef FeatureXOP     : SubtargetFeature<"xop", "HasXOP", "true",
112239462Sdim                                      "Enable XOP instructions",
113239462Sdim                                      [FeatureFMA4]>;
114202375Srdivackydef FeatureVectorUAMem : SubtargetFeature<"vector-unaligned-mem",
115202375Srdivacky                                          "HasVectorUAMem", "true",
116202375Srdivacky                 "Allow unaligned memory operands on vector/SIMD instructions">;
117206124Srdivackydef FeatureAES     : SubtargetFeature<"aes", "HasAES", "true",
118239462Sdim                                      "Enable AES instructions",
119239462Sdim                                      [FeatureSSE2]>;
120263508Sdimdef FeatureTBM     : SubtargetFeature<"tbm", "HasTBM", "true",
121263508Sdim                                      "Enable TBM instructions">;
122226633Sdimdef FeatureMOVBE   : SubtargetFeature<"movbe", "HasMOVBE", "true",
123226633Sdim                                      "Support MOVBE instruction">;
124263508Sdimdef FeatureRDRAND  : SubtargetFeature<"rdrnd", "HasRDRAND", "true",
125226633Sdim                                      "Support RDRAND instruction">;
126226633Sdimdef FeatureF16C    : SubtargetFeature<"f16c", "HasF16C", "true",
127263508Sdim                       "Support 16-bit floating point conversion instructions",
128263508Sdim                       [FeatureAVX]>;
129234353Sdimdef FeatureFSGSBase : SubtargetFeature<"fsgsbase", "HasFSGSBase", "true",
130234353Sdim                                       "Support FS/GS Base instructions">;
131226633Sdimdef FeatureLZCNT   : SubtargetFeature<"lzcnt", "HasLZCNT", "true",
132226633Sdim                                      "Support LZCNT instruction">;
133226633Sdimdef FeatureBMI     : SubtargetFeature<"bmi", "HasBMI", "true",
134226633Sdim                                      "Support BMI instructions">;
135234353Sdimdef FeatureBMI2    : SubtargetFeature<"bmi2", "HasBMI2", "true",
136234353Sdim                                      "Support BMI2 instructions">;
137243830Sdimdef FeatureRTM     : SubtargetFeature<"rtm", "HasRTM", "true",
138243830Sdim                                      "Support RTM instructions">;
139249423Sdimdef FeatureHLE     : SubtargetFeature<"hle", "HasHLE", "true",
140249423Sdim                                      "Support HLE">;
141249423Sdimdef FeatureADX     : SubtargetFeature<"adx", "HasADX", "true",
142249423Sdim                                      "Support ADX instructions">;
143263508Sdimdef FeatureSHA     : SubtargetFeature<"sha", "HasSHA", "true",
144263508Sdim                                      "Enable SHA instructions",
145263508Sdim                                      [FeatureSSE2]>;
146249423Sdimdef FeaturePRFCHW  : SubtargetFeature<"prfchw", "HasPRFCHW", "true",
147249423Sdim                                      "Support PRFCHW instructions">;
148249423Sdimdef FeatureRDSEED  : SubtargetFeature<"rdseed", "HasRDSEED", "true",
149249423Sdim                                      "Support RDSEED instruction">;
150234353Sdimdef FeatureLeaForSP : SubtargetFeature<"lea-sp", "UseLeaForSP", "true",
151234353Sdim                                     "Use LEA for adjusting the stack pointer">;
152243830Sdimdef FeatureSlowDivide : SubtargetFeature<"idiv-to-divb",
153249423Sdim                                     "HasSlowDivide", "true",
154249423Sdim                                     "Use small divide for positive values less than 256">;
155249423Sdimdef FeaturePadShortFunctions : SubtargetFeature<"pad-short-functions",
156249423Sdim                                     "PadShortFunctions", "true",
157249423Sdim                                     "Pad short functions">;
158249423Sdimdef FeatureCallRegIndirect : SubtargetFeature<"call-reg-indirect",
159249423Sdim                                     "CallRegIndirect", "true",
160249423Sdim                                     "Call register indirect">;
161251662Sdimdef FeatureLEAUsesAG : SubtargetFeature<"lea-uses-ag", "LEAUsesAG", "true",
162251662Sdim                                   "LEA instruction needs inputs at AG stage">;
163195098Sed
164193323Sed//===----------------------------------------------------------------------===//
165193323Sed// X86 processors supported.
166193323Sed//===----------------------------------------------------------------------===//
167193323Sed
168234353Sdiminclude "X86Schedule.td"
169234353Sdim
170234353Sdimdef ProcIntelAtom : SubtargetFeature<"atom", "X86ProcFamily", "IntelAtom",
171234353Sdim                    "Intel Atom processors">;
172263508Sdimdef ProcIntelSLM  : SubtargetFeature<"slm", "X86ProcFamily", "IntelSLM",
173263508Sdim                    "Intel Silvermont processors">;
174234353Sdim
175193323Sedclass Proc<string Name, list<SubtargetFeature> Features>
176239462Sdim : ProcessorModel<Name, GenericModel, Features>;
177193323Sed
178193323Seddef : Proc<"generic",         []>;
179193323Seddef : Proc<"i386",            []>;
180193323Seddef : Proc<"i486",            []>;
181193323Seddef : Proc<"i586",            []>;
182193323Seddef : Proc<"pentium",         []>;
183193323Seddef : Proc<"pentium-mmx",     [FeatureMMX]>;
184193323Seddef : Proc<"i686",            []>;
185198090Srdivackydef : Proc<"pentiumpro",      [FeatureCMOV]>;
186198090Srdivackydef : Proc<"pentium2",        [FeatureMMX, FeatureCMOV]>;
187193323Seddef : Proc<"pentium3",        [FeatureSSE1]>;
188223017Sdimdef : Proc<"pentium3m",       [FeatureSSE1, FeatureSlowBTMem]>;
189193323Seddef : Proc<"pentium-m",       [FeatureSSE2, FeatureSlowBTMem]>;
190193323Seddef : Proc<"pentium4",        [FeatureSSE2]>;
191223017Sdimdef : Proc<"pentium4m",       [FeatureSSE2, FeatureSlowBTMem]>;
192249423Sdimdef : Proc<"x86-64",          [FeatureSSE2, Feature64Bit, FeatureSlowBTMem,
193249423Sdim                               FeatureFastUAMem]>;
194249423Sdim// Intel Core Duo.
195249423Sdimdef : ProcessorModel<"yonah", SandyBridgeModel,
196249423Sdim                     [FeatureSSE3, FeatureSlowBTMem]>;
197249423Sdim
198249423Sdim// NetBurst.
199249423Sdimdef : Proc<"prescott", [FeatureSSE3, FeatureSlowBTMem]>;
200249423Sdimdef : Proc<"nocona",   [FeatureSSE3, FeatureCMPXCHG16B, FeatureSlowBTMem]>;
201249423Sdim
202249423Sdim// Intel Core 2 Solo/Duo.
203249423Sdimdef : ProcessorModel<"core2", SandyBridgeModel,
204249423Sdim                     [FeatureSSSE3, FeatureCMPXCHG16B, FeatureSlowBTMem]>;
205249423Sdimdef : ProcessorModel<"penryn", SandyBridgeModel,
206249423Sdim                     [FeatureSSE41, FeatureCMPXCHG16B, FeatureSlowBTMem]>;
207249423Sdim
208249423Sdim// Atom.
209249423Sdimdef : ProcessorModel<"atom", AtomModel,
210249423Sdim                     [ProcIntelAtom, FeatureSSSE3, FeatureCMPXCHG16B,
211249423Sdim                      FeatureMOVBE, FeatureSlowBTMem, FeatureLeaForSP,
212249423Sdim                      FeatureSlowDivide,
213249423Sdim                      FeatureCallRegIndirect,
214251662Sdim                      FeatureLEAUsesAG,
215249423Sdim                      FeaturePadShortFunctions]>;
216249423Sdim
217263508Sdim// Atom Silvermont.
218263508Sdimdef : ProcessorModel<"slm",  SLMModel, [ProcIntelSLM,
219263508Sdim                               FeatureSSE42, FeatureCMPXCHG16B,
220263508Sdim                               FeatureMOVBE, FeaturePOPCNT,
221263508Sdim                               FeaturePCLMUL, FeatureAES,
222263508Sdim                               FeatureCallRegIndirect,
223263508Sdim                               FeaturePRFCHW,
224263508Sdim                               FeatureSlowBTMem]>;
225206124Srdivacky// "Arrandale" along with corei3 and corei5
226249423Sdimdef : ProcessorModel<"corei7", SandyBridgeModel,
227249423Sdim                     [FeatureSSE42, FeatureCMPXCHG16B, FeatureSlowBTMem,
228249423Sdim                      FeatureFastUAMem, FeaturePOPCNT, FeatureAES]>;
229249423Sdim
230249423Sdimdef : ProcessorModel<"nehalem", SandyBridgeModel,
231249423Sdim                     [FeatureSSE42,  FeatureCMPXCHG16B, FeatureSlowBTMem,
232249423Sdim                      FeatureFastUAMem, FeaturePOPCNT]>;
233206124Srdivacky// Westmere is a similar machine to nehalem with some additional features.
234206124Srdivacky// Westmere is the corei3/i5/i7 path from nehalem to sandybridge
235249423Sdimdef : ProcessorModel<"westmere", SandyBridgeModel,
236249423Sdim                     [FeatureSSE42, FeatureCMPXCHG16B, FeatureSlowBTMem,
237249423Sdim                      FeatureFastUAMem, FeaturePOPCNT, FeatureAES,
238249423Sdim                      FeaturePCLMUL]>;
239226633Sdim// Sandy Bridge
240218893Sdim// SSE is not listed here since llvm treats AVX as a reimplementation of SSE,
241218893Sdim// rather than a superset.
242249423Sdimdef : ProcessorModel<"corei7-avx", SandyBridgeModel,
243249423Sdim                     [FeatureAVX, FeatureCMPXCHG16B, FeatureFastUAMem,
244249423Sdim                      FeaturePOPCNT, FeatureAES, FeaturePCLMUL]>;
245226633Sdim// Ivy Bridge
246249423Sdimdef : ProcessorModel<"core-avx-i", SandyBridgeModel,
247249423Sdim                     [FeatureAVX, FeatureCMPXCHG16B, FeatureFastUAMem,
248249423Sdim                      FeaturePOPCNT, FeatureAES, FeaturePCLMUL, FeatureRDRAND,
249249423Sdim                      FeatureF16C, FeatureFSGSBase]>;
250193323Sed
251226633Sdim// Haswell
252249423Sdimdef : ProcessorModel<"core-avx2", HaswellModel,
253249423Sdim                     [FeatureAVX2, FeatureCMPXCHG16B, FeatureFastUAMem,
254249423Sdim                      FeaturePOPCNT, FeatureAES, FeaturePCLMUL, FeatureRDRAND,
255249423Sdim                      FeatureF16C, FeatureFSGSBase, FeatureMOVBE, FeatureLZCNT,
256249423Sdim                      FeatureBMI, FeatureBMI2, FeatureFMA, FeatureRTM,
257249423Sdim                      FeatureHLE]>;
258226633Sdim
259263508Sdim// KNL
260263508Sdim// FIXME: define KNL model
261263508Sdimdef : ProcessorModel<"knl", HaswellModel,
262263508Sdim                     [FeatureAVX512, FeatureERI, FeatureCDI, FeaturePFI,
263263508Sdim                      FeatureCMPXCHG16B, FeatureFastUAMem, FeaturePOPCNT,
264263508Sdim                      FeatureAES, FeaturePCLMUL, FeatureRDRAND, FeatureF16C,
265263508Sdim                      FeatureFSGSBase, FeatureMOVBE, FeatureLZCNT, FeatureBMI,
266263508Sdim                      FeatureBMI2, FeatureFMA, FeatureRTM, FeatureHLE]>;
267263508Sdim
268193323Seddef : Proc<"k6",              [FeatureMMX]>;
269221345Sdimdef : Proc<"k6-2",            [Feature3DNow]>;
270221345Sdimdef : Proc<"k6-3",            [Feature3DNow]>;
271221345Sdimdef : Proc<"athlon",          [Feature3DNowA, FeatureSlowBTMem]>;
272221345Sdimdef : Proc<"athlon-tbird",    [Feature3DNowA, FeatureSlowBTMem]>;
273193323Seddef : Proc<"athlon-4",        [FeatureSSE1,   Feature3DNowA, FeatureSlowBTMem]>;
274193323Seddef : Proc<"athlon-xp",       [FeatureSSE1,   Feature3DNowA, FeatureSlowBTMem]>;
275193323Seddef : Proc<"athlon-mp",       [FeatureSSE1,   Feature3DNowA, FeatureSlowBTMem]>;
276193323Seddef : Proc<"k8",              [FeatureSSE2,   Feature3DNowA, Feature64Bit,
277193323Sed                               FeatureSlowBTMem]>;
278193323Seddef : Proc<"opteron",         [FeatureSSE2,   Feature3DNowA, Feature64Bit,
279193323Sed                               FeatureSlowBTMem]>;
280193323Seddef : Proc<"athlon64",        [FeatureSSE2,   Feature3DNowA, Feature64Bit,
281193323Sed                               FeatureSlowBTMem]>;
282193323Seddef : Proc<"athlon-fx",       [FeatureSSE2,   Feature3DNowA, Feature64Bit,
283193323Sed                               FeatureSlowBTMem]>;
284226633Sdimdef : Proc<"k8-sse3",         [FeatureSSE3,   Feature3DNowA, FeatureCMPXCHG16B,
285193323Sed                               FeatureSlowBTMem]>;
286226633Sdimdef : Proc<"opteron-sse3",    [FeatureSSE3,   Feature3DNowA, FeatureCMPXCHG16B,
287193323Sed                               FeatureSlowBTMem]>;
288226633Sdimdef : Proc<"athlon64-sse3",   [FeatureSSE3,   Feature3DNowA, FeatureCMPXCHG16B,
289193323Sed                               FeatureSlowBTMem]>;
290239462Sdimdef : Proc<"amdfam10",        [FeatureSSE4A,
291234353Sdim                               Feature3DNowA, FeatureCMPXCHG16B, FeatureLZCNT,
292234353Sdim                               FeaturePOPCNT, FeatureSlowBTMem]>;
293234353Sdim// Bobcat
294234353Sdimdef : Proc<"btver1",          [FeatureSSSE3, FeatureSSE4A, FeatureCMPXCHG16B,
295263508Sdim                               FeaturePRFCHW, FeatureLZCNT, FeaturePOPCNT]>;
296251662Sdim// Jaguar
297251662Sdimdef : Proc<"btver2",          [FeatureAVX, FeatureSSE4A, FeatureCMPXCHG16B,
298263508Sdim                               FeaturePRFCHW, FeatureAES, FeaturePCLMUL,
299263508Sdim                               FeatureBMI, FeatureF16C, FeatureMOVBE,
300263508Sdim                               FeatureLZCNT, FeaturePOPCNT]>;
301234353Sdim// Bulldozer
302239462Sdimdef : Proc<"bdver1",          [FeatureXOP, FeatureFMA4, FeatureCMPXCHG16B,
303263508Sdim                               FeatureAES, FeaturePRFCHW, FeaturePCLMUL,
304239462Sdim                               FeatureLZCNT, FeaturePOPCNT]>;
305251662Sdim// Piledriver
306239462Sdimdef : Proc<"bdver2",          [FeatureXOP, FeatureFMA4, FeatureCMPXCHG16B,
307263508Sdim                               FeatureAES, FeaturePRFCHW, FeaturePCLMUL,
308239462Sdim                               FeatureF16C, FeatureLZCNT,
309263508Sdim                               FeaturePOPCNT, FeatureBMI,  FeatureTBM,
310263508Sdim                               FeatureFMA]>;
311263508Sdim
312263508Sdim// Steamroller
313263508Sdimdef : Proc<"bdver3",          [FeatureXOP, FeatureFMA4, FeatureCMPXCHG16B,
314263508Sdim                               FeatureAES, FeaturePRFCHW, FeaturePCLMUL,
315263508Sdim                               FeatureF16C, FeatureLZCNT,
316263508Sdim                               FeaturePOPCNT, FeatureBMI,  FeatureTBM,
317263508Sdim                               FeatureFMA, FeatureFSGSBase]>;
318263508Sdim
319241427Sdimdef : Proc<"geode",           [Feature3DNowA]>;
320193323Sed
321193323Seddef : Proc<"winchip-c6",      [FeatureMMX]>;
322221345Sdimdef : Proc<"winchip2",        [Feature3DNow]>;
323221345Sdimdef : Proc<"c3",              [Feature3DNow]>;
324193323Seddef : Proc<"c3-2",            [FeatureSSE1]>;
325193323Sed
326193323Sed//===----------------------------------------------------------------------===//
327193323Sed// Register File Description
328193323Sed//===----------------------------------------------------------------------===//
329193323Sed
330193323Sedinclude "X86RegisterInfo.td"
331193323Sed
332193323Sed//===----------------------------------------------------------------------===//
333193323Sed// Instruction Descriptions
334193323Sed//===----------------------------------------------------------------------===//
335193323Sed
336193323Sedinclude "X86InstrInfo.td"
337193323Sed
338206274Srdivackydef X86InstrInfo : InstrInfo;
339193323Sed
340193323Sed//===----------------------------------------------------------------------===//
341193323Sed// Calling Conventions
342193323Sed//===----------------------------------------------------------------------===//
343193323Sed
344193323Sedinclude "X86CallingConv.td"
345193323Sed
346193323Sed
347193323Sed//===----------------------------------------------------------------------===//
348218893Sdim// Assembly Parser
349193323Sed//===----------------------------------------------------------------------===//
350193323Sed
351198090Srdivackydef ATTAsmParser : AsmParser {
352234353Sdim  string AsmParserClassName = "AsmParser";
353234353Sdim}
354234353Sdim
355234353Sdimdef ATTAsmParserVariant : AsmParserVariant {
356198090Srdivacky  int Variant = 0;
357198090Srdivacky
358251662Sdim  // Variant name.
359251662Sdim  string Name = "att";
360251662Sdim
361198090Srdivacky  // Discard comments in assembly strings.
362198090Srdivacky  string CommentDelimiter = "#";
363198090Srdivacky
364198090Srdivacky  // Recognize hard coded registers.
365198090Srdivacky  string RegisterPrefix = "%";
366198090Srdivacky}
367198090Srdivacky
368234353Sdimdef IntelAsmParserVariant : AsmParserVariant {
369234353Sdim  int Variant = 1;
370234353Sdim
371251662Sdim  // Variant name.
372251662Sdim  string Name = "intel";
373251662Sdim
374234353Sdim  // Discard comments in assembly strings.
375234353Sdim  string CommentDelimiter = ";";
376234353Sdim
377234353Sdim  // Recognize hard coded registers.
378234353Sdim  string RegisterPrefix = "";
379234353Sdim}
380234353Sdim
381218893Sdim//===----------------------------------------------------------------------===//
382218893Sdim// Assembly Printers
383218893Sdim//===----------------------------------------------------------------------===//
384218893Sdim
385193323Sed// The X86 target supports two different syntaxes for emitting machine code.
386193323Sed// This is controlled by the -x86-asm-syntax={att|intel}
387193323Seddef ATTAsmWriter : AsmWriter {
388198090Srdivacky  string AsmWriterClassName  = "ATTInstPrinter";
389193323Sed  int Variant = 0;
390218893Sdim  bit isMCAsmWriter = 1;
391193323Sed}
392193323Seddef IntelAsmWriter : AsmWriter {
393198090Srdivacky  string AsmWriterClassName  = "IntelInstPrinter";
394193323Sed  int Variant = 1;
395218893Sdim  bit isMCAsmWriter = 1;
396193323Sed}
397193323Sed
398193323Seddef X86 : Target {
399193323Sed  // Information about the instructions...
400193323Sed  let InstructionSet = X86InstrInfo;
401198090Srdivacky  let AssemblyParsers = [ATTAsmParser];
402234353Sdim  let AssemblyParserVariants = [ATTAsmParserVariant, IntelAsmParserVariant];
403193323Sed  let AssemblyWriters = [ATTAsmWriter, IntelAsmWriter];
404193323Sed}
405