blob: 9cf574f9d3d0d3fbe6b37186363b69933a06a553 [file] [log] [blame]
Evan Cheng37f25d92008-08-28 23:39:26 +00001//===- ARMInstrFormats.td - ARM Instruction Formats --*- tablegen -*---------=//
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//===----------------------------------------------------------------------===//
11//
12// ARM Instruction Format Definitions.
13//
14
15// Format specifies the encoding used by the instruction. This is part of the
16// ad-hoc solution used to emit machine instruction encodings by our machine
17// code emitter.
18class Format<bits<5> val> {
19 bits<5> Value = val;
20}
21
22def Pseudo : Format<1>;
23def MulFrm : Format<2>;
24def MulSMLAW : Format<3>;
25def MulSMULW : Format<4>;
26def MulSMLA : Format<5>;
27def MulSMUL : Format<6>;
28def Branch : Format<7>;
29def BranchMisc : Format<8>;
30
31def DPRdIm : Format<9>;
32def DPRdReg : Format<10>;
33def DPRdSoReg : Format<11>;
34def DPRdMisc : Format<12>;
35def DPRnIm : Format<13>;
36def DPRnReg : Format<14>;
37def DPRnSoReg : Format<15>;
38def DPRIm : Format<16>;
39def DPRReg : Format<17>;
40def DPRSoReg : Format<18>;
41def DPRImS : Format<19>;
42def DPRRegS : Format<20>;
43def DPRSoRegS : Format<21>;
44
45def LdFrm : Format<22>;
46def StFrm : Format<23>;
47
48def ArithMisc : Format<24>;
49def ThumbFrm : Format<25>;
50def VFPFrm : Format<26>;
51
52
Evan Cheng37f25d92008-08-28 23:39:26 +000053//===----------------------------------------------------------------------===//
54
55// ARM Instruction templates.
56//
57
58class InstARM<bits<4> opcod, AddrMode am, SizeFlagVal sz, IndexMode im,
59 Format f, string cstr>
60 : Instruction {
Evan Cheng612b79e2008-08-29 07:40:52 +000061 field bits<32> Inst;
62
Evan Cheng37f25d92008-08-28 23:39:26 +000063 let Namespace = "ARM";
64
65 bits<4> Opcode = opcod;
66 AddrMode AM = am;
67 bits<4> AddrModeBits = AM.Value;
68
69 SizeFlagVal SZ = sz;
70 bits<3> SizeFlag = SZ.Value;
71
72 IndexMode IM = im;
73 bits<2> IndexModeBits = IM.Value;
74
75 Format F = f;
76 bits<5> Form = F.Value;
77
78 let Constraints = cstr;
79}
80
81class PseudoInst<dag oops, dag iops, string asm, list<dag> pattern>
82 : InstARM<0, AddrModeNone, SizeSpecial, IndexModeNone, Pseudo, ""> {
83 let OutOperandList = oops;
84 let InOperandList = iops;
85 let AsmString = asm;
86 let Pattern = pattern;
87}
88
89// Almost all ARM instructions are predicable.
90class I<bits<4> opcod, dag oops, dag iops, AddrMode am, SizeFlagVal sz,
91 IndexMode im, Format f, string opc, string asm, string cstr,
92 list<dag> pattern>
93 : InstARM<opcod, am, sz, im, f, cstr> {
94 let OutOperandList = oops;
95 let InOperandList = !con(iops, (ops pred:$p));
96 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
97 let Pattern = pattern;
98 list<Predicate> Predicates = [IsARM];
99}
100
101// Same as I except it can optionally modify CPSR. Note it's modeled as
102// an input operand since by default it's a zero register. It will
103// become an implicit def once it's "flipped".
104class sI<bits<4> opcod, dag oops, dag iops, AddrMode am, SizeFlagVal sz,
105 IndexMode im, Format f, string opc, string asm, string cstr,
106 list<dag> pattern>
107 : InstARM<opcod, am, sz, im, f, cstr> {
108 let OutOperandList = oops;
109 let InOperandList = !con(iops, (ops pred:$p, cc_out:$s));
110 let AsmString = !strconcat(opc, !strconcat("${p}${s}", asm));
111 let Pattern = pattern;
112 list<Predicate> Predicates = [IsARM];
113}
114
115class AI<bits<4> opcod, dag oops, dag iops, Format f, string opc,
116 string asm, list<dag> pattern>
117 : I<opcod, oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc,
118 asm,"",pattern>;
119class AsI<bits<4> opcod, dag oops, dag iops, Format f, string opc,
120 string asm, list<dag> pattern>
121 : sI<opcod, oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc,
122 asm,"",pattern>;
Evan Cheng0d14fc82008-09-01 01:51:14 +0000123
124// addrmode1 instructions
Evan Cheng37f25d92008-08-28 23:39:26 +0000125class AI1<bits<4> opcod, dag oops, dag iops, Format f, string opc,
126 string asm, list<dag> pattern>
127 : I<opcod, oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng612b79e2008-08-29 07:40:52 +0000128 asm, "", pattern> {
Evan Chengb7880ac2008-08-31 18:32:16 +0000129 let Inst{21-24} = opcod;
130 let Inst{26-27} = 0;
Evan Cheng612b79e2008-08-29 07:40:52 +0000131}
Evan Cheng37f25d92008-08-28 23:39:26 +0000132class AsI1<bits<4> opcod, dag oops, dag iops, Format f, string opc,
133 string asm, list<dag> pattern>
134 : sI<opcod, oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng612b79e2008-08-29 07:40:52 +0000135 asm, "", pattern> {
Evan Chengb7880ac2008-08-31 18:32:16 +0000136 let Inst{20} = 1;
137 let Inst{21-24} = opcod;
138 let Inst{26-27} = 0;
Evan Cheng612b79e2008-08-29 07:40:52 +0000139}
Evan Cheng0d14fc82008-09-01 01:51:14 +0000140class AI1x2<bits<4> opcod, dag oops, dag iops, Format f, string opc,
141 string asm, list<dag> pattern>
142 : I<opcod, oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, opc,
143 asm, "", pattern>;
Evan Cheng17222df2008-08-31 19:02:21 +0000144
Evan Cheng0d14fc82008-09-01 01:51:14 +0000145
146// addrmode2 loads and stores
Evan Cheng37f25d92008-08-28 23:39:26 +0000147class AI2<bits<4> opcod, dag oops, dag iops, Format f, string opc,
148 string asm, list<dag> pattern>
149 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng17222df2008-08-31 19:02:21 +0000150 asm, "", pattern> {
151 let Inst{26-27} = 1;
152}
Evan Cheng93912732008-09-01 01:27:33 +0000153
154// loads
Evan Cheng17222df2008-08-31 19:02:21 +0000155class AI2ldw<bits<4> opcod, dag oops, dag iops, Format f, string opc,
156 string asm, list<dag> pattern>
157 : AI2<opcod, oops, iops, f, opc, asm, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000158 let Inst{20} = 1; // L bit
Evan Cheng17222df2008-08-31 19:02:21 +0000159 let Inst{21} = 0; // W bit
160 let Inst{22} = 0; // B bit
161 let Inst{24} = 1; // P bit
162}
163class AI2ldb<bits<4> opcod, dag oops, dag iops, Format f, string opc,
164 string asm, list<dag> pattern>
165 : AI2<opcod, oops, iops, f, opc, asm, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000166 let Inst{20} = 1; // L bit
Evan Cheng17222df2008-08-31 19:02:21 +0000167 let Inst{21} = 0; // W bit
168 let Inst{22} = 1; // B bit
169 let Inst{24} = 1; // P bit
170}
171
Evan Cheng93912732008-09-01 01:27:33 +0000172// stores
173class AI2stw<bits<4> opcod, dag oops, dag iops, Format f, string opc,
174 string asm, list<dag> pattern>
175 : AI2<opcod, oops, iops, f, opc, asm, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000176 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000177 let Inst{21} = 0; // W bit
178 let Inst{22} = 0; // B bit
179 let Inst{24} = 1; // P bit
180}
181class AI2stb<bits<4> opcod, dag oops, dag iops, Format f, string opc,
182 string asm, list<dag> pattern>
183 : AI2<opcod, oops, iops, f, opc, asm, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000184 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000185 let Inst{21} = 0; // W bit
186 let Inst{22} = 1; // B bit
187 let Inst{24} = 1; // P bit
188}
189
Evan Cheng840917b2008-09-01 07:00:14 +0000190// Pre-indexed loads
Evan Cheng93912732008-09-01 01:27:33 +0000191class AI2ldwpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
Evan Cheng37f25d92008-08-28 23:39:26 +0000192 string asm, string cstr, list<dag> pattern>
193 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng93912732008-09-01 01:27:33 +0000194 asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000195 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000196 let Inst{21} = 1; // W bit
197 let Inst{22} = 0; // B bit
198 let Inst{24} = 1; // P bit
199}
200class AI2ldbpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
201 string asm, string cstr, list<dag> pattern>
202 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
203 asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000204 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000205 let Inst{21} = 1; // W bit
206 let Inst{22} = 1; // B bit
207 let Inst{24} = 1; // P bit
208}
209
Evan Cheng840917b2008-09-01 07:00:14 +0000210// Pre-indexed stores
Evan Cheng93912732008-09-01 01:27:33 +0000211class AI2stwpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
212 string asm, string cstr, list<dag> pattern>
213 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
214 asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000215 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000216 let Inst{21} = 1; // W bit
217 let Inst{22} = 0; // B bit
218 let Inst{24} = 1; // P bit
219}
220class AI2stbpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
221 string asm, string cstr, list<dag> pattern>
222 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
223 asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000224 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000225 let Inst{21} = 1; // W bit
226 let Inst{22} = 1; // B bit
227 let Inst{24} = 1; // P bit
228}
229
Evan Cheng840917b2008-09-01 07:00:14 +0000230// Post-indexed loads
Evan Cheng93912732008-09-01 01:27:33 +0000231class AI2ldwpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
Evan Cheng37f25d92008-08-28 23:39:26 +0000232 string asm, string cstr, list<dag> pattern>
233 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng93912732008-09-01 01:27:33 +0000234 asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000235 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000236 let Inst{21} = 0; // W bit
237 let Inst{22} = 0; // B bit
238 let Inst{24} = 0; // P bit
239}
240class AI2ldbpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
241 string asm, string cstr, list<dag> pattern>
242 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
243 asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000244 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000245 let Inst{21} = 0; // W bit
246 let Inst{22} = 1; // B bit
247 let Inst{24} = 0; // P bit
248}
249
Evan Cheng840917b2008-09-01 07:00:14 +0000250// Post-indexed stores
Evan Cheng93912732008-09-01 01:27:33 +0000251class AI2stwpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
252 string asm, string cstr, list<dag> pattern>
253 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
254 asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000255 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000256 let Inst{21} = 0; // W bit
257 let Inst{22} = 0; // B bit
258 let Inst{24} = 0; // P bit
259}
260class AI2stbpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
261 string asm, string cstr, list<dag> pattern>
262 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
263 asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000264 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000265 let Inst{21} = 0; // W bit
266 let Inst{22} = 1; // B bit
267 let Inst{24} = 0; // P bit
268}
269
Evan Cheng0d14fc82008-09-01 01:51:14 +0000270// addrmode3 instructions
271class AI3<bits<4> opcod, dag oops, dag iops, Format f, string opc,
272 string asm, list<dag> pattern>
273 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
274 asm, "", pattern>;
275
Evan Cheng840917b2008-09-01 07:00:14 +0000276// loads
277class AI3ldh<bits<4> opcod, dag oops, dag iops, Format f, string opc,
278 string asm, list<dag> pattern>
279 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
280 asm, "", pattern> {
281 let Inst{4} = 1;
282 let Inst{5} = 1; // H bit
283 let Inst{6} = 0; // S bit
284 let Inst{7} = 1;
285 let Inst{20} = 1; // L bit
286 let Inst{21} = 0; // W bit
287 let Inst{24} = 1; // P bit
288}
289class AI3ldsh<bits<4> opcod, dag oops, dag iops, Format f, string opc,
290 string asm, list<dag> pattern>
291 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
292 asm, "", pattern> {
293 let Inst{4} = 1;
294 let Inst{5} = 1; // H bit
295 let Inst{6} = 1; // S bit
296 let Inst{7} = 1;
297 let Inst{20} = 1; // L bit
298 let Inst{21} = 0; // W bit
299 let Inst{24} = 1; // P bit
300}
301class AI3ldsb<bits<4> opcod, dag oops, dag iops, Format f, string opc,
302 string asm, list<dag> pattern>
303 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
304 asm, "", pattern> {
305 let Inst{4} = 1;
306 let Inst{5} = 0; // H bit
307 let Inst{6} = 1; // S bit
308 let Inst{7} = 1;
309 let Inst{20} = 1; // L bit
310 let Inst{21} = 0; // W bit
311 let Inst{24} = 1; // P bit
312}
313class AI3ldd<bits<4> opcod, dag oops, dag iops, Format f, string opc,
314 string asm, list<dag> pattern>
315 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
316 asm, "", pattern> {
317 let Inst{4} = 1;
318 let Inst{5} = 0; // H bit
319 let Inst{6} = 1; // S bit
320 let Inst{7} = 1;
321 let Inst{20} = 0; // L bit
322 let Inst{21} = 0; // W bit
323 let Inst{24} = 1; // P bit
324}
325
326// stores
327class AI3sth<bits<4> opcod, dag oops, dag iops, Format f, string opc,
328 string asm, list<dag> pattern>
329 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
330 asm, "", pattern> {
331 let Inst{4} = 1;
332 let Inst{5} = 1; // H bit
333 let Inst{6} = 0; // S bit
334 let Inst{7} = 1;
335 let Inst{20} = 0; // L bit
336 let Inst{21} = 0; // W bit
337 let Inst{24} = 1; // P bit
338}
339class AI3std<bits<4> opcod, dag oops, dag iops, Format f, string opc,
340 string asm, list<dag> pattern>
341 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
342 asm, "", pattern> {
343 let Inst{4} = 1;
344 let Inst{5} = 1; // H bit
345 let Inst{6} = 1; // S bit
346 let Inst{7} = 1;
347 let Inst{20} = 0; // L bit
348 let Inst{21} = 0; // W bit
349 let Inst{24} = 1; // P bit
350}
351
352// Pre-indexed loads
353class AI3ldhpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
354 string asm, string cstr, list<dag> pattern>
355 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
356 asm, cstr, pattern> {
357 let Inst{4} = 1;
358 let Inst{5} = 1; // H bit
359 let Inst{6} = 0; // S bit
360 let Inst{7} = 1;
361 let Inst{20} = 1; // L bit
362 let Inst{21} = 1; // W bit
363 let Inst{24} = 1; // P bit
364}
365class AI3ldshpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
366 string asm, string cstr, list<dag> pattern>
367 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
368 asm, cstr, pattern> {
369 let Inst{4} = 1;
370 let Inst{5} = 1; // H bit
371 let Inst{6} = 1; // S bit
372 let Inst{7} = 1;
373 let Inst{20} = 1; // L bit
374 let Inst{21} = 1; // W bit
375 let Inst{24} = 1; // P bit
376}
377class AI3ldsbpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
378 string asm, string cstr, list<dag> pattern>
379 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
380 asm, cstr, pattern> {
381 let Inst{4} = 1;
382 let Inst{5} = 0; // H bit
383 let Inst{6} = 1; // S bit
384 let Inst{7} = 1;
385 let Inst{20} = 1; // L bit
386 let Inst{21} = 1; // W bit
387 let Inst{24} = 1; // P bit
388}
389
390// Pre-indexed stores
391class AI3sthpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
392 string asm, string cstr, list<dag> pattern>
393 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
394 asm, cstr, pattern> {
395 let Inst{4} = 1;
396 let Inst{5} = 1; // H bit
397 let Inst{6} = 0; // S bit
398 let Inst{7} = 1;
399 let Inst{20} = 0; // L bit
400 let Inst{21} = 1; // W bit
401 let Inst{24} = 1; // P bit
402}
403
404// Post-indexed loads
405class AI3ldhpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
406 string asm, string cstr, list<dag> pattern>
407 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
408 asm, cstr,pattern> {
409 let Inst{4} = 1;
410 let Inst{5} = 1; // H bit
411 let Inst{6} = 0; // S bit
412 let Inst{7} = 1;
413 let Inst{20} = 1; // L bit
414 let Inst{21} = 1; // W bit
415 let Inst{24} = 0; // P bit
416}
417class AI3ldshpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
418 string asm, string cstr, list<dag> pattern>
419 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
420 asm, cstr,pattern> {
421 let Inst{4} = 1;
422 let Inst{5} = 1; // H bit
423 let Inst{6} = 1; // S bit
424 let Inst{7} = 1;
425 let Inst{20} = 1; // L bit
426 let Inst{21} = 1; // W bit
427 let Inst{24} = 0; // P bit
428}
429class AI3ldsbpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
430 string asm, string cstr, list<dag> pattern>
431 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
432 asm, cstr,pattern> {
433 let Inst{4} = 1;
434 let Inst{5} = 0; // H bit
435 let Inst{6} = 1; // S bit
436 let Inst{7} = 1;
437 let Inst{20} = 1; // L bit
438 let Inst{21} = 1; // W bit
439 let Inst{24} = 0; // P bit
440}
441
442// Post-indexed stores
443class AI3sthpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
444 string asm, string cstr, list<dag> pattern>
445 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
446 asm, cstr,pattern> {
447 let Inst{4} = 1;
448 let Inst{5} = 1; // H bit
449 let Inst{6} = 0; // S bit
450 let Inst{7} = 1;
451 let Inst{20} = 0; // L bit
452 let Inst{21} = 1; // W bit
453 let Inst{24} = 0; // P bit
454}
455
456
Evan Cheng0d14fc82008-09-01 01:51:14 +0000457// addrmode4 instructions
458class AI4<bits<4> opcod, dag oops, dag iops, Format f, string opc,
459 string asm, list<dag> pattern>
460 : I<opcod, oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, opc,
461 asm, "", pattern>;
462
463
Evan Cheng37f25d92008-08-28 23:39:26 +0000464
465// Special cases.
466class XI<bits<4> opcod, dag oops, dag iops, AddrMode am, SizeFlagVal sz,
467 IndexMode im, Format f, string asm, string cstr, list<dag> pattern>
468 : InstARM<opcod, am, sz, im, f, cstr> {
469 let OutOperandList = oops;
470 let InOperandList = iops;
471 let AsmString = asm;
472 let Pattern = pattern;
473 list<Predicate> Predicates = [IsARM];
474}
475
476class AXI<bits<4> opcod, dag oops, dag iops, Format f, string asm,
477 list<dag> pattern>
478 : XI<opcod, oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, asm,
479 "", pattern>;
480class AXI1<bits<4> opcod, dag oops, dag iops, Format f, string asm,
481 list<dag> pattern>
482 : XI<opcod, oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, asm,
483 "", pattern>;
484class AXI2<bits<4> opcod, dag oops, dag iops, Format f, string asm,
485 list<dag> pattern>
486 : XI<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, asm,
487 "", pattern>;
488class AXI3<bits<4> opcod, dag oops, dag iops, Format f, string asm,
489 list<dag> pattern>
490 : XI<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, asm,
491 "", pattern>;
492class AXI4<bits<4> opcod, dag oops, dag iops, Format f, string asm,
493 list<dag> pattern>
494 : XI<opcod, oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
495 "", pattern>;
496
497class AXIx2<bits<4> opcod, dag oops, dag iops, Format f, string asm,
498 list<dag> pattern>
499 : XI<opcod, oops, iops, AddrModeNone, Size8Bytes, IndexModeNone, f, asm,
500 "", pattern>;
501
502// BR_JT instructions
503class JTI<bits<4> opcod, dag oops, dag iops, string asm, list<dag> pattern>
504 : XI<opcod, oops, iops, AddrModeNone, SizeSpecial, IndexModeNone, BranchMisc,
505 asm, "", pattern>;
506class JTI1<bits<4> opcod, dag oops, dag iops, string asm, list<dag> pattern>
507 : XI<opcod, oops, iops, AddrMode1, SizeSpecial, IndexModeNone, BranchMisc,
508 asm, "", pattern>;
509class JTI2<bits<4> opcod, dag oops, dag iops, string asm, list<dag> pattern>
510 : XI<opcod, oops, iops, AddrMode2, SizeSpecial, IndexModeNone, BranchMisc,
511 asm, "", pattern>;
512
513
514//===----------------------------------------------------------------------===//
515
516// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
517class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
518 list<Predicate> Predicates = [IsARM];
519}
520class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
521 list<Predicate> Predicates = [IsARM, HasV5TE];
522}
523class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
524 list<Predicate> Predicates = [IsARM, HasV6];
525}
Evan Cheng13096642008-08-29 06:41:12 +0000526
527//===----------------------------------------------------------------------===//
528//
529// Thumb Instruction Format Definitions.
530//
531
532
533// TI - Thumb instruction.
534
535class ThumbI<dag outs, dag ins, AddrMode am, SizeFlagVal sz,
536 string asm, string cstr, list<dag> pattern>
537 // FIXME: Set all opcodes to 0 for now.
538 : InstARM<0, am, sz, IndexModeNone, ThumbFrm, cstr> {
539 let OutOperandList = outs;
540 let InOperandList = ins;
541 let AsmString = asm;
542 let Pattern = pattern;
543 list<Predicate> Predicates = [IsThumb];
544}
545
546class TI<dag outs, dag ins, string asm, list<dag> pattern>
547 : ThumbI<outs, ins, AddrModeNone, Size2Bytes, asm, "", pattern>;
548class TI1<dag outs, dag ins, string asm, list<dag> pattern>
549 : ThumbI<outs, ins, AddrModeT1, Size2Bytes, asm, "", pattern>;
550class TI2<dag outs, dag ins, string asm, list<dag> pattern>
551 : ThumbI<outs, ins, AddrModeT2, Size2Bytes, asm, "", pattern>;
552class TI4<dag outs, dag ins, string asm, list<dag> pattern>
553 : ThumbI<outs, ins, AddrModeT4, Size2Bytes, asm, "", pattern>;
554class TIs<dag outs, dag ins, string asm, list<dag> pattern>
555 : ThumbI<outs, ins, AddrModeTs, Size2Bytes, asm, "", pattern>;
556
557// Two-address instructions
558class TIt<dag outs, dag ins, string asm, list<dag> pattern>
559 : ThumbI<outs, ins, AddrModeNone, Size2Bytes, asm, "$lhs = $dst", pattern>;
560
561// BL, BLX(1) are translated by assembler into two instructions
562class TIx2<dag outs, dag ins, string asm, list<dag> pattern>
563 : ThumbI<outs, ins, AddrModeNone, Size4Bytes, asm, "", pattern>;
564
565// BR_JT instructions
566class TJTI<dag outs, dag ins, string asm, list<dag> pattern>
567 : ThumbI<outs, ins, AddrModeNone, SizeSpecial, asm, "", pattern>;
568
569
570//===----------------------------------------------------------------------===//
571
572
573// ThumbPat - Same as Pat<>, but requires that the compiler be in Thumb mode.
574class ThumbPat<dag pattern, dag result> : Pat<pattern, result> {
575 list<Predicate> Predicates = [IsThumb];
576}
577
578class ThumbV5Pat<dag pattern, dag result> : Pat<pattern, result> {
579 list<Predicate> Predicates = [IsThumb, HasV5T];
580}