blob: 222dc38cf5010cc3f31443a0f4a0c52815c9451e [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
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000115// Special cases
116class XI<bits<4> opcod, dag oops, dag iops, AddrMode am, SizeFlagVal sz,
117 IndexMode im, Format f, string asm, string cstr, list<dag> pattern>
118 : InstARM<opcod, am, sz, im, f, cstr> {
119 let OutOperandList = oops;
120 let InOperandList = iops;
121 let AsmString = asm;
122 let Pattern = pattern;
123 list<Predicate> Predicates = [IsARM];
124}
125
Evan Cheng37f25d92008-08-28 23:39:26 +0000126class AI<bits<4> opcod, dag oops, dag iops, Format f, string opc,
127 string asm, list<dag> pattern>
128 : I<opcod, oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc,
129 asm,"",pattern>;
130class AsI<bits<4> opcod, dag oops, dag iops, Format f, string opc,
131 string asm, list<dag> pattern>
132 : sI<opcod, oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc,
133 asm,"",pattern>;
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000134class AXI<bits<4> opcod, dag oops, dag iops, Format f, string asm,
135 list<dag> pattern>
136 : XI<opcod, oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, asm,
137 "", pattern>;
138class AXIx2<bits<4> opcod, dag oops, dag iops, Format f, string asm,
139 list<dag> pattern>
140 : XI<opcod, oops, iops, AddrModeNone, Size8Bytes, IndexModeNone, f, asm,
141 "", pattern>;
Evan Cheng0d14fc82008-09-01 01:51:14 +0000142
143// addrmode1 instructions
Evan Cheng37f25d92008-08-28 23:39:26 +0000144class AI1<bits<4> opcod, dag oops, dag iops, Format f, string opc,
145 string asm, list<dag> pattern>
146 : I<opcod, oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng612b79e2008-08-29 07:40:52 +0000147 asm, "", pattern> {
Evan Chengb7880ac2008-08-31 18:32:16 +0000148 let Inst{21-24} = opcod;
149 let Inst{26-27} = 0;
Evan Cheng612b79e2008-08-29 07:40:52 +0000150}
Evan Cheng37f25d92008-08-28 23:39:26 +0000151class AsI1<bits<4> opcod, dag oops, dag iops, Format f, string opc,
152 string asm, list<dag> pattern>
153 : sI<opcod, oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng612b79e2008-08-29 07:40:52 +0000154 asm, "", pattern> {
Evan Chengb7880ac2008-08-31 18:32:16 +0000155 let Inst{20} = 1;
156 let Inst{21-24} = opcod;
157 let Inst{26-27} = 0;
Evan Cheng612b79e2008-08-29 07:40:52 +0000158}
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000159class AXI1<bits<4> opcod, dag oops, dag iops, Format f, string asm,
160 list<dag> pattern>
161 : XI<opcod, oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, asm,
162 "", pattern> {
163 let Inst{20} = 1;
164 let Inst{21-24} = opcod;
165 let Inst{26-27} = 0;
166}
Evan Cheng0d14fc82008-09-01 01:51:14 +0000167class AI1x2<bits<4> opcod, dag oops, dag iops, Format f, string opc,
168 string asm, list<dag> pattern>
169 : I<opcod, oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, opc,
170 asm, "", pattern>;
Evan Cheng17222df2008-08-31 19:02:21 +0000171
Evan Cheng0d14fc82008-09-01 01:51:14 +0000172
173// addrmode2 loads and stores
Evan Cheng37f25d92008-08-28 23:39:26 +0000174class AI2<bits<4> opcod, dag oops, dag iops, Format f, string opc,
175 string asm, list<dag> pattern>
176 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng17222df2008-08-31 19:02:21 +0000177 asm, "", pattern> {
178 let Inst{26-27} = 1;
179}
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000180class AXI2<bits<4> opcod, dag oops, dag iops, Format f, string asm,
181 list<dag> pattern>
182 : XI<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, asm,
183 "", pattern>;
Evan Cheng93912732008-09-01 01:27:33 +0000184
185// loads
Evan Cheng17222df2008-08-31 19:02:21 +0000186class AI2ldw<bits<4> opcod, dag oops, dag iops, Format f, string opc,
187 string asm, list<dag> pattern>
188 : AI2<opcod, oops, iops, f, opc, asm, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000189 let Inst{20} = 1; // L bit
Evan Cheng17222df2008-08-31 19:02:21 +0000190 let Inst{21} = 0; // W bit
191 let Inst{22} = 0; // B bit
192 let Inst{24} = 1; // P bit
193}
194class AI2ldb<bits<4> opcod, dag oops, dag iops, Format f, string opc,
195 string asm, list<dag> pattern>
196 : AI2<opcod, oops, iops, f, opc, asm, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000197 let Inst{20} = 1; // L bit
Evan Cheng17222df2008-08-31 19:02:21 +0000198 let Inst{21} = 0; // W bit
199 let Inst{22} = 1; // B bit
200 let Inst{24} = 1; // P bit
201}
202
Evan Cheng93912732008-09-01 01:27:33 +0000203// stores
204class AI2stw<bits<4> opcod, dag oops, dag iops, Format f, string opc,
205 string asm, list<dag> pattern>
206 : AI2<opcod, oops, iops, f, opc, asm, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000207 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000208 let Inst{21} = 0; // W bit
209 let Inst{22} = 0; // B bit
210 let Inst{24} = 1; // P bit
211}
212class AI2stb<bits<4> opcod, dag oops, dag iops, Format f, string opc,
213 string asm, list<dag> pattern>
214 : AI2<opcod, oops, iops, f, opc, asm, 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} = 0; // W bit
217 let Inst{22} = 1; // B bit
218 let Inst{24} = 1; // P bit
219}
220
Evan Cheng840917b2008-09-01 07:00:14 +0000221// Pre-indexed loads
Evan Cheng93912732008-09-01 01:27:33 +0000222class AI2ldwpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
Evan Cheng37f25d92008-08-28 23:39:26 +0000223 string asm, string cstr, list<dag> pattern>
224 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng93912732008-09-01 01:27:33 +0000225 asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000226 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000227 let Inst{21} = 1; // W bit
228 let Inst{22} = 0; // B bit
229 let Inst{24} = 1; // P bit
230}
231class AI2ldbpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
232 string asm, string cstr, list<dag> pattern>
233 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
234 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} = 1; // W bit
237 let Inst{22} = 1; // B bit
238 let Inst{24} = 1; // P bit
239}
240
Evan Cheng840917b2008-09-01 07:00:14 +0000241// Pre-indexed stores
Evan Cheng93912732008-09-01 01:27:33 +0000242class AI2stwpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
243 string asm, string cstr, list<dag> pattern>
244 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
245 asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000246 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000247 let Inst{21} = 1; // W bit
248 let Inst{22} = 0; // B bit
249 let Inst{24} = 1; // P bit
250}
251class AI2stbpr<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, IndexModePre, 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} = 1; // W bit
257 let Inst{22} = 1; // B bit
258 let Inst{24} = 1; // P bit
259}
260
Evan Cheng840917b2008-09-01 07:00:14 +0000261// Post-indexed loads
Evan Cheng93912732008-09-01 01:27:33 +0000262class AI2ldwpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
Evan Cheng37f25d92008-08-28 23:39:26 +0000263 string asm, string cstr, list<dag> pattern>
264 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng93912732008-09-01 01:27:33 +0000265 asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000266 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000267 let Inst{21} = 0; // W bit
268 let Inst{22} = 0; // B bit
269 let Inst{24} = 0; // P bit
270}
271class AI2ldbpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
272 string asm, string cstr, list<dag> pattern>
273 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
274 asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000275 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000276 let Inst{21} = 0; // W bit
277 let Inst{22} = 1; // B bit
278 let Inst{24} = 0; // P bit
279}
280
Evan Cheng840917b2008-09-01 07:00:14 +0000281// Post-indexed stores
Evan Cheng93912732008-09-01 01:27:33 +0000282class AI2stwpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
283 string asm, string cstr, list<dag> pattern>
284 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
285 asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000286 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000287 let Inst{21} = 0; // W bit
288 let Inst{22} = 0; // B bit
289 let Inst{24} = 0; // P bit
290}
291class AI2stbpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
292 string asm, string cstr, list<dag> pattern>
293 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
294 asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000295 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000296 let Inst{21} = 0; // W bit
297 let Inst{22} = 1; // B bit
298 let Inst{24} = 0; // P bit
299}
300
Evan Cheng0d14fc82008-09-01 01:51:14 +0000301// addrmode3 instructions
302class AI3<bits<4> opcod, dag oops, dag iops, Format f, string opc,
303 string asm, list<dag> pattern>
304 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
305 asm, "", pattern>;
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000306class AXI3<bits<4> opcod, dag oops, dag iops, Format f, string asm,
307 list<dag> pattern>
308 : XI<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, asm,
309 "", pattern>;
Evan Cheng0d14fc82008-09-01 01:51:14 +0000310
Evan Cheng840917b2008-09-01 07:00:14 +0000311// loads
312class AI3ldh<bits<4> opcod, dag oops, dag iops, Format f, string opc,
313 string asm, list<dag> pattern>
314 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
315 asm, "", pattern> {
316 let Inst{4} = 1;
317 let Inst{5} = 1; // H bit
318 let Inst{6} = 0; // S bit
319 let Inst{7} = 1;
320 let Inst{20} = 1; // L bit
321 let Inst{21} = 0; // W bit
322 let Inst{24} = 1; // P bit
323}
324class AI3ldsh<bits<4> opcod, dag oops, dag iops, Format f, string opc,
325 string asm, list<dag> pattern>
326 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
327 asm, "", pattern> {
328 let Inst{4} = 1;
329 let Inst{5} = 1; // H bit
330 let Inst{6} = 1; // S bit
331 let Inst{7} = 1;
332 let Inst{20} = 1; // L bit
333 let Inst{21} = 0; // W bit
334 let Inst{24} = 1; // P bit
335}
336class AI3ldsb<bits<4> opcod, dag oops, dag iops, Format f, string opc,
337 string asm, list<dag> pattern>
338 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
339 asm, "", pattern> {
340 let Inst{4} = 1;
341 let Inst{5} = 0; // H bit
342 let Inst{6} = 1; // S bit
343 let Inst{7} = 1;
344 let Inst{20} = 1; // L bit
345 let Inst{21} = 0; // W bit
346 let Inst{24} = 1; // P bit
347}
348class AI3ldd<bits<4> opcod, dag oops, dag iops, Format f, string opc,
349 string asm, list<dag> pattern>
350 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
351 asm, "", pattern> {
352 let Inst{4} = 1;
353 let Inst{5} = 0; // H bit
354 let Inst{6} = 1; // S bit
355 let Inst{7} = 1;
356 let Inst{20} = 0; // L bit
357 let Inst{21} = 0; // W bit
358 let Inst{24} = 1; // P bit
359}
360
361// stores
362class AI3sth<bits<4> opcod, dag oops, dag iops, Format f, string opc,
363 string asm, list<dag> pattern>
364 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
365 asm, "", pattern> {
366 let Inst{4} = 1;
367 let Inst{5} = 1; // H bit
368 let Inst{6} = 0; // S bit
369 let Inst{7} = 1;
370 let Inst{20} = 0; // L bit
371 let Inst{21} = 0; // W bit
372 let Inst{24} = 1; // P bit
373}
374class AI3std<bits<4> opcod, dag oops, dag iops, Format f, string opc,
375 string asm, list<dag> pattern>
376 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
377 asm, "", pattern> {
378 let Inst{4} = 1;
379 let Inst{5} = 1; // H bit
380 let Inst{6} = 1; // S bit
381 let Inst{7} = 1;
382 let Inst{20} = 0; // L bit
383 let Inst{21} = 0; // W bit
384 let Inst{24} = 1; // P bit
385}
386
387// Pre-indexed loads
388class AI3ldhpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
389 string asm, string cstr, list<dag> pattern>
390 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
391 asm, cstr, pattern> {
392 let Inst{4} = 1;
393 let Inst{5} = 1; // H bit
394 let Inst{6} = 0; // S bit
395 let Inst{7} = 1;
396 let Inst{20} = 1; // L bit
397 let Inst{21} = 1; // W bit
398 let Inst{24} = 1; // P bit
399}
400class AI3ldshpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
401 string asm, string cstr, list<dag> pattern>
402 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
403 asm, cstr, pattern> {
404 let Inst{4} = 1;
405 let Inst{5} = 1; // H bit
406 let Inst{6} = 1; // S bit
407 let Inst{7} = 1;
408 let Inst{20} = 1; // L bit
409 let Inst{21} = 1; // W bit
410 let Inst{24} = 1; // P bit
411}
412class AI3ldsbpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
413 string asm, string cstr, list<dag> pattern>
414 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
415 asm, cstr, pattern> {
416 let Inst{4} = 1;
417 let Inst{5} = 0; // H bit
418 let Inst{6} = 1; // S bit
419 let Inst{7} = 1;
420 let Inst{20} = 1; // L bit
421 let Inst{21} = 1; // W bit
422 let Inst{24} = 1; // P bit
423}
424
425// Pre-indexed stores
426class AI3sthpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
427 string asm, string cstr, list<dag> pattern>
428 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
429 asm, cstr, pattern> {
430 let Inst{4} = 1;
431 let Inst{5} = 1; // H bit
432 let Inst{6} = 0; // S bit
433 let Inst{7} = 1;
434 let Inst{20} = 0; // L bit
435 let Inst{21} = 1; // W bit
436 let Inst{24} = 1; // P bit
437}
438
439// Post-indexed loads
440class AI3ldhpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
441 string asm, string cstr, list<dag> pattern>
442 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
443 asm, cstr,pattern> {
444 let Inst{4} = 1;
445 let Inst{5} = 1; // H bit
446 let Inst{6} = 0; // S bit
447 let Inst{7} = 1;
448 let Inst{20} = 1; // L bit
449 let Inst{21} = 1; // W bit
450 let Inst{24} = 0; // P bit
451}
452class AI3ldshpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
453 string asm, string cstr, list<dag> pattern>
454 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
455 asm, cstr,pattern> {
456 let Inst{4} = 1;
457 let Inst{5} = 1; // H bit
458 let Inst{6} = 1; // S bit
459 let Inst{7} = 1;
460 let Inst{20} = 1; // L bit
461 let Inst{21} = 1; // W bit
462 let Inst{24} = 0; // P bit
463}
464class AI3ldsbpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
465 string asm, string cstr, list<dag> pattern>
466 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
467 asm, cstr,pattern> {
468 let Inst{4} = 1;
469 let Inst{5} = 0; // H bit
470 let Inst{6} = 1; // S bit
471 let Inst{7} = 1;
472 let Inst{20} = 1; // L bit
473 let Inst{21} = 1; // W bit
474 let Inst{24} = 0; // P bit
475}
476
477// Post-indexed stores
478class AI3sthpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
479 string asm, string cstr, list<dag> pattern>
480 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
481 asm, cstr,pattern> {
482 let Inst{4} = 1;
483 let Inst{5} = 1; // H bit
484 let Inst{6} = 0; // S bit
485 let Inst{7} = 1;
486 let Inst{20} = 0; // L bit
487 let Inst{21} = 1; // W bit
488 let Inst{24} = 0; // P bit
489}
490
491
Evan Cheng0d14fc82008-09-01 01:51:14 +0000492// addrmode4 instructions
493class AI4<bits<4> opcod, dag oops, dag iops, Format f, string opc,
494 string asm, list<dag> pattern>
495 : I<opcod, oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, opc,
496 asm, "", pattern>;
Evan Cheng37f25d92008-08-28 23:39:26 +0000497class AXI4<bits<4> opcod, dag oops, dag iops, Format f, string asm,
498 list<dag> pattern>
499 : XI<opcod, oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
500 "", pattern>;
501
Evan Cheng37f25d92008-08-28 23:39:26 +0000502
503// BR_JT instructions
504class JTI<bits<4> opcod, dag oops, dag iops, string asm, list<dag> pattern>
505 : XI<opcod, oops, iops, AddrModeNone, SizeSpecial, IndexModeNone, BranchMisc,
506 asm, "", pattern>;
507class JTI1<bits<4> opcod, dag oops, dag iops, string asm, list<dag> pattern>
508 : XI<opcod, oops, iops, AddrMode1, SizeSpecial, IndexModeNone, BranchMisc,
509 asm, "", pattern>;
510class JTI2<bits<4> opcod, dag oops, dag iops, string asm, list<dag> pattern>
511 : XI<opcod, oops, iops, AddrMode2, SizeSpecial, IndexModeNone, BranchMisc,
512 asm, "", pattern>;
513
514
515//===----------------------------------------------------------------------===//
516
517// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
518class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
519 list<Predicate> Predicates = [IsARM];
520}
521class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
522 list<Predicate> Predicates = [IsARM, HasV5TE];
523}
524class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
525 list<Predicate> Predicates = [IsARM, HasV6];
526}
Evan Cheng13096642008-08-29 06:41:12 +0000527
528//===----------------------------------------------------------------------===//
529//
530// Thumb Instruction Format Definitions.
531//
532
533
534// TI - Thumb instruction.
535
536class ThumbI<dag outs, dag ins, AddrMode am, SizeFlagVal sz,
537 string asm, string cstr, list<dag> pattern>
538 // FIXME: Set all opcodes to 0 for now.
539 : InstARM<0, am, sz, IndexModeNone, ThumbFrm, cstr> {
540 let OutOperandList = outs;
541 let InOperandList = ins;
542 let AsmString = asm;
543 let Pattern = pattern;
544 list<Predicate> Predicates = [IsThumb];
545}
546
547class TI<dag outs, dag ins, string asm, list<dag> pattern>
548 : ThumbI<outs, ins, AddrModeNone, Size2Bytes, asm, "", pattern>;
549class TI1<dag outs, dag ins, string asm, list<dag> pattern>
550 : ThumbI<outs, ins, AddrModeT1, Size2Bytes, asm, "", pattern>;
551class TI2<dag outs, dag ins, string asm, list<dag> pattern>
552 : ThumbI<outs, ins, AddrModeT2, Size2Bytes, asm, "", pattern>;
553class TI4<dag outs, dag ins, string asm, list<dag> pattern>
554 : ThumbI<outs, ins, AddrModeT4, Size2Bytes, asm, "", pattern>;
555class TIs<dag outs, dag ins, string asm, list<dag> pattern>
556 : ThumbI<outs, ins, AddrModeTs, Size2Bytes, asm, "", pattern>;
557
558// Two-address instructions
559class TIt<dag outs, dag ins, string asm, list<dag> pattern>
560 : ThumbI<outs, ins, AddrModeNone, Size2Bytes, asm, "$lhs = $dst", pattern>;
561
562// BL, BLX(1) are translated by assembler into two instructions
563class TIx2<dag outs, dag ins, string asm, list<dag> pattern>
564 : ThumbI<outs, ins, AddrModeNone, Size4Bytes, asm, "", pattern>;
565
566// BR_JT instructions
567class TJTI<dag outs, dag ins, string asm, list<dag> pattern>
568 : ThumbI<outs, ins, AddrModeNone, SizeSpecial, asm, "", pattern>;
569
570
571//===----------------------------------------------------------------------===//
572
573
574// ThumbPat - Same as Pat<>, but requires that the compiler be in Thumb mode.
575class ThumbPat<dag pattern, dag result> : Pat<pattern, result> {
576 list<Predicate> Predicates = [IsThumb];
577}
578
579class ThumbV5Pat<dag pattern, dag result> : Pat<pattern, result> {
580 list<Predicate> Predicates = [IsThumb, HasV5T];
581}