Relex assertions to account for additional implicit def / use operands.
[oota-llvm.git] / lib / Target / Alpha / AlphaInstrFormats.td
1 //===- AlphaInstrFormats.td - Alpha Instruction Formats ----*- tablegen -*-===//
2 // 
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
7 // 
8 //===----------------------------------------------------------------------===//
9 //
10 //
11 //===----------------------------------------------------------------------===//
12
13 //3.3:
14 //Memory
15 //Branch
16 //Operate
17 //Floating-point
18 //PALcode
19
20 def u8imm   : Operand<i64>;
21 def s14imm  : Operand<i64>;
22 def s16imm  : Operand<i64>;
23 def s21imm  : Operand<i64>;
24 def s64imm  : Operand<i64>;
25 def u64imm  : Operand<i64>;
26
27 //===----------------------------------------------------------------------===//
28 // Instruction format superclass
29 //===----------------------------------------------------------------------===//
30 // Alpha instruction baseline
31 class InstAlpha<bits<6> op, string asmstr, InstrItinClass itin> : Instruction {
32   field bits<32> Inst;
33   let Namespace = "Alpha";
34   let AsmString = asmstr;
35   let Inst{31-26} = op;
36   let Itinerary = itin;
37 }
38
39
40 //3.3.1
41 class MForm<bits<6> opcode, bit store, bit load, string asmstr, list<dag> pattern, InstrItinClass itin> 
42         : InstAlpha<opcode, asmstr, itin> {
43   let Pattern = pattern;
44   let isStore = store;
45   let isLoad = load;
46   let Defs = [R28]; //We may use this for frame index calculations, so reserve it here
47
48   bits<5> Ra;
49   bits<16> disp;
50   bits<5> Rb;
51
52   let Inst{25-21} = Ra;
53   let Inst{20-16} = Rb;
54   let Inst{15-0} = disp;
55 }
56 class MfcForm<bits<6> opcode, bits<16> fc, string asmstr, InstrItinClass itin> 
57         : InstAlpha<opcode, asmstr, itin> {    
58   bits<5> Ra;
59
60   let OperandList = (ops GPRC:$RA);
61   let Inst{25-21} = Ra;
62   let Inst{20-16} = 0;
63   let Inst{15-0} = fc;
64 }
65
66 class MbrForm<bits<6> opcode, bits<2> TB, dag OL, string asmstr, InstrItinClass itin>
67     : InstAlpha<opcode, asmstr, itin> {
68   bits<5> Ra;
69   bits<5> Rb;
70   bits<14> disp;
71
72   let OperandList = OL;
73
74   let Inst{25-21} = Ra;
75   let Inst{20-16} = Rb;
76   let Inst{15-14} = TB;
77   let Inst{13-0} = disp;
78 }
79 class MbrpForm<bits<6> opcode, bits<2> TB, dag OL, string asmstr, list<dag> pattern, InstrItinClass itin>
80     : InstAlpha<opcode, asmstr, itin> {
81   let Pattern=pattern;
82   bits<5> Ra;
83   bits<5> Rb;
84   bits<14> disp;
85
86   let OperandList = OL;
87
88   let Inst{25-21} = Ra;
89   let Inst{20-16} = Rb;
90   let Inst{15-14} = TB;
91   let Inst{13-0} = disp;
92 }
93
94 //3.3.2
95 def target : Operand<OtherVT> {}
96
97 let isBranch = 1, isTerminator = 1, hasCtrlDep = 1, noResults = 1 in {
98 class BFormN<bits<6> opcode, dag OL, string asmstr, InstrItinClass itin>
99    : InstAlpha<opcode, asmstr, itin> {
100   let OperandList = OL;
101   bits<64> Opc; //dummy
102   bits<5> Ra;
103   bits<21> disp;
104
105   let Inst{25-21} = Ra;
106   let Inst{20-0} = disp;
107 }
108 }
109
110 let isBranch = 1, isTerminator = 1 in
111 class BFormD<bits<6> opcode, string asmstr, list<dag> pattern, InstrItinClass itin> 
112     : InstAlpha<opcode, asmstr, itin> {
113   let Pattern = pattern;
114   let OperandList = (ops target:$DISP);
115   bits<5> Ra;
116   bits<21> disp;
117
118   let Inst{25-21} = Ra;
119   let Inst{20-0} = disp;
120 }
121
122 //3.3.3
123 class OForm<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin> 
124     : InstAlpha<opcode, asmstr, itin> {
125   let Pattern = pattern;
126   let OperandList = (ops GPRC:$RC, GPRC:$RA, GPRC:$RB);
127
128   bits<5> Rc;
129   bits<5> Ra;
130   bits<5> Rb;
131   bits<7> Function = fun;
132
133   let Inst{25-21} = Ra;
134   let Inst{20-16} = Rb;
135   let Inst{15-13} = 0;
136   let Inst{12} = 0;
137   let Inst{11-5} = Function;
138   let Inst{4-0} = Rc;
139 }
140
141 class OForm2<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin> 
142     : InstAlpha<opcode, asmstr, itin> {
143   let Pattern = pattern;
144   let OperandList = (ops GPRC:$RC, GPRC:$RB);
145
146   bits<5> Rc;
147   bits<5> Rb;
148   bits<7> Function = fun;
149
150   let Inst{25-21} = 31;
151   let Inst{20-16} = Rb;
152   let Inst{15-13} = 0;
153   let Inst{12} = 0;
154   let Inst{11-5} = Function;
155   let Inst{4-0} = Rc;
156 }
157
158 class OForm4<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin> 
159     : InstAlpha<opcode, asmstr, itin> {
160   let Pattern = pattern;
161   let OperandList = (ops GPRC:$RDEST, GPRC:$RCOND, GPRC:$RTRUE, GPRC:$RFALSE);
162   let Constraints = "$RFALSE = $RDEST";
163   let DisableEncoding = "$RFALSE";
164
165   bits<5> Rc;
166   bits<5> Ra;
167   bits<5> Rb;
168   bits<7> Function = fun;
169
170 //  let isTwoAddress = 1;
171   let Inst{25-21} = Ra;
172   let Inst{20-16} = Rb;
173   let Inst{15-13} = 0;
174   let Inst{12} = 0;
175   let Inst{11-5} = Function;
176   let Inst{4-0} = Rc;
177 }
178
179
180 class OFormL<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin> 
181     : InstAlpha<opcode, asmstr, itin> {
182   let Pattern = pattern;
183   let OperandList = (ops GPRC:$RC, GPRC:$RA, u8imm:$L);
184
185   bits<5> Rc;
186   bits<5> Ra;
187   bits<8> LIT;
188   bits<7> Function = fun;
189
190   let Inst{25-21} = Ra;
191   let Inst{20-13} = LIT;
192   let Inst{12} = 1;
193   let Inst{11-5} = Function;
194   let Inst{4-0} = Rc;
195 }
196
197 class OForm4L<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin> 
198     : InstAlpha<opcode, asmstr, itin> {
199   let Pattern = pattern;
200   let OperandList = (ops GPRC:$RDEST, GPRC:$RCOND, s64imm:$RTRUE, GPRC:$RFALSE);
201   let Constraints = "$RFALSE = $RDEST";
202   let DisableEncoding = "$RFALSE";
203
204   bits<5> Rc;
205   bits<5> Ra;
206   bits<8> LIT;
207   bits<7> Function = fun;
208
209 //  let isTwoAddress = 1;
210   let Inst{25-21} = Ra;
211   let Inst{20-13} = LIT;
212   let Inst{12} = 1;
213   let Inst{11-5} = Function;
214   let Inst{4-0} = Rc;
215 }
216
217 //3.3.4
218 class FPForm<bits<6> opcode, bits<11> fun, string asmstr, list<dag> pattern, InstrItinClass itin> 
219     : InstAlpha<opcode, asmstr, itin> {
220   let Pattern = pattern;
221
222   bits<5> Fc;
223   bits<5> Fa;
224   bits<5> Fb;
225   bits<11> Function = fun;
226
227   let Inst{25-21} = Fa;
228   let Inst{20-16} = Fb;
229   let Inst{15-5} = Function;
230   let Inst{4-0} = Fc;
231 }
232
233 //3.3.5
234 class PALForm<bits<6> opcode, dag OL, string asmstr, InstrItinClass itin>
235     : InstAlpha<opcode, asmstr, itin> {
236   let OperandList = OL;
237   bits<26> Function;
238
239   let Inst{25-0} = Function;
240 }
241
242
243 // Pseudo instructions.
244 class PseudoInstAlpha<dag OL, string nm, list<dag> pattern, InstrItinClass itin> 
245     : InstAlpha<0, nm, itin>  {
246   let OperandList = OL;
247   let Pattern = pattern;
248
249 }