ret 0; works, not much else
[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
26 //===----------------------------------------------------------------------===//
27 // Instruction format superclass
28 //===----------------------------------------------------------------------===//
29
30 class InstAlpha<bits<6> op, dag OL, string asmstr> : Instruction {          // Alpha instruction baseline
31   field bits<32> Inst;
32   let Namespace = "Alpha";
33   let OperandList = OL;
34   let AsmString = asmstr;
35
36  
37   let Inst{31-26} = op;
38 }
39
40 //3.3.1
41 class MForm<bits<6> opcode, string asmstr> 
42         : InstAlpha<opcode, (ops GPRC:$RA, s16imm:$DISP, GPRC:$RB), asmstr> {
43   bits<5> Ra;
44   bits<16> disp;
45   bits<5> Rb;
46
47   let Inst{25-21} = Ra;
48   let Inst{20-16} = Rb;
49   let Inst{15-0} = disp;
50 }
51
52 class MgForm<bits<6> opcode, string asmstr> 
53         : InstAlpha<opcode, (ops GPRC:$RA, s16imm:$DISP, GPRC:$RB, s16imm:$NUM), asmstr> {
54   bits<5> Ra;
55   bits<16> disp;
56   bits<5> Rb;
57
58   let Inst{25-21} = Ra;
59   let Inst{20-16} = Rb;
60   let Inst{15-0} = disp;
61 }
62
63 class MbrForm<bits<6> opcode, bits<2> TB, dag OL, string asmstr> : InstAlpha<opcode, OL, asmstr> {
64   bits<5> Ra;
65   bits<5> Rb;
66   bits<14> disp;
67
68   let Inst{25-21} = Ra;
69   let Inst{20-16} = Rb;
70   let Inst{15-14} = TB;
71   let Inst{13-0} = disp;
72 }
73
74 //3.3.2
75 let isBranch = 1, isTerminator = 1 in
76 class BForm<bits<6> opcode, string asmstr> 
77     : InstAlpha<opcode, (ops GPRC:$RA, s21imm:$DISP), asmstr> {
78   bits<5> Ra;
79   bits<21> disp;
80
81   let Inst{25-21} = Ra;
82   let Inst{20-0} = disp;
83 }
84
85 let isBranch = 1, isTerminator = 1 in
86 class FBForm<bits<6> opcode, string asmstr> 
87     : InstAlpha<opcode, (ops FPRC:$RA, s21imm:$DISP), asmstr> {
88   bits<5> Ra;
89   bits<21> disp;
90
91   let Inst{25-21} = Ra;
92   let Inst{20-0} = disp;
93 }
94
95 //3.3.3
96 class OForm<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern> 
97         : InstAlpha<opcode, (ops GPRC:$RC, GPRC:$RA, GPRC:$RB), asmstr> {
98   let Pattern = pattern;
99
100   bits<5> Rc;
101   bits<5> Ra;
102   bits<5> Rb;
103   bits<7> Function = fun;
104
105   let Inst{25-21} = Ra;
106   let Inst{20-16} = Rb;
107   let Inst{15-13} = 0;
108   let Inst{12} = 0;
109   let Inst{11-5} = Function;
110   let Inst{4-0} = Rc;
111 }
112
113 class OcmForm<bits<6> opcode, bits<7> fun, dag OL, string asmstr> 
114         : InstAlpha<opcode, OL, asmstr> {
115   bits<5> Ra;
116   bits<5> Rb;
117   bits<7> Function = fun;
118   bits<5> Rc;
119
120   let Inst{25-21} = Ra;
121   let Inst{20-16} = Rb;
122   let Inst{15-13} = 0;
123   let Inst{12} = 0;
124   let Inst{11-5} = Function;
125   let Inst{4-0} = Rc;
126 }
127
128
129 class OFormL<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern> 
130         : InstAlpha<opcode, (ops GPRC:$RC, GPRC:$RA, u8imm:$L), asmstr> {
131   let Pattern = pattern;
132
133   bits<5> Rc;
134   bits<5> Ra;
135   bits<8> LIT;
136   bits<7> Function = fun;
137
138   let Inst{25-21} = Ra;
139   let Inst{20-13} = LIT;
140   let Inst{12} = 1;
141   let Inst{11-5} = Function;
142   let Inst{4-0} = Rc;
143 }
144
145 class OcmFormL<bits<6> opcode, bits<7> fun, dag OL, string asmstr> 
146         : InstAlpha<opcode, OL, asmstr> {
147   bits<5> Ra;
148   bits<8> LIT;
149   bits<7> Function = fun;
150   bits<5> Rc;
151
152   let Inst{25-21} = Ra;
153   let Inst{20-13} = LIT;
154   let Inst{12} = 1;
155   let Inst{11-5} = Function;
156   let Inst{4-0} = Rc;
157 }
158
159 //3.3.4
160 class FPForm<bits<6> opcode, bits<11> fun, string asmstr> 
161         : InstAlpha<opcode, (ops FPRC:$RC, FPRC:$RA, FPRC:$RB), asmstr> {
162   bits<5> Fc;
163   bits<5> Fa;
164   bits<5> Fb;
165   bits<11> Function = fun;
166
167   let Inst{25-21} = Fa;
168   let Inst{20-16} = Fb;
169   let Inst{15-5} = Function;
170   let Inst{4-0} = Fc;
171 }
172
173 class FPFormCM<bits<6> opcode, bits<11> fun, dag OL, string asmstr> 
174         : InstAlpha<opcode, OL, asmstr> {
175   bits<5> Fc;
176   bits<5> Fa;
177   bits<5> Fb;
178   bits<11> Function = fun;
179
180   let Inst{25-21} = Fa;
181   let Inst{20-16} = Fb;
182   let Inst{15-5} = Function;
183   let Inst{4-0} = Fc;
184 }
185
186 //3.3.5
187 class PALForm<bits<6> opcode, dag OL, string asmstr> : InstAlpha<opcode, OL, asmstr> {
188   bits<26> Function;
189
190   let Inst{25-0} = Function;
191 }
192
193
194 // Pseudo instructions.
195 class PseudoInstAlpha<dag OL, string nm> : InstAlpha<0, OL, nm>  {
196 }