Misha Brukman | ffe9968 | 2005-02-05 02:24:26 +0000 | [diff] [blame] | 1 | //===- AlphaInstrFormats.td - Alpha Instruction Formats ----*- tablegen -*-===// |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 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 | |
Andrew Lenharth | 7b69867 | 2005-10-20 00:28:31 +0000 | [diff] [blame] | 20 | def u8imm : Operand<i64>; |
| 21 | def s14imm : Operand<i64>; |
| 22 | def s16imm : Operand<i64>; |
| 23 | def s21imm : Operand<i64>; |
Andrew Lenharth | 02daecc | 2005-07-22 20:50:29 +0000 | [diff] [blame] | 24 | def s64imm : Operand<i64>; |
| 25 | |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 26 | //===----------------------------------------------------------------------===// |
| 27 | // Instruction format superclass |
| 28 | //===----------------------------------------------------------------------===// |
Andrew Lenharth | 97a7fcf | 2005-11-09 19:17:08 +0000 | [diff] [blame] | 29 | // Alpha instruction baseline |
| 30 | class InstAlphaAlt<bits<6> op, string asmstr> : Instruction { |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 31 | field bits<32> Inst; |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 32 | let Namespace = "Alpha"; |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 33 | let AsmString = asmstr; |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 34 | let Inst{31-26} = op; |
| 35 | } |
| 36 | |
Andrew Lenharth | 97a7fcf | 2005-11-09 19:17:08 +0000 | [diff] [blame] | 37 | class InstAlpha<bits<6> op, dag OL, string asmstr> |
| 38 | : InstAlphaAlt<op, asmstr> { // Alpha instruction baseline |
| 39 | let OperandList = OL; |
| 40 | } |
| 41 | |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 42 | //3.3.1 |
Andrew Lenharth | 6db615d | 2005-11-30 07:19:56 +0000 | [diff] [blame] | 43 | class MFormAlt<bits<6> opcode, string asmstr> |
| 44 | : InstAlphaAlt<opcode, asmstr> { |
| 45 | bits<5> Ra; |
| 46 | bits<16> disp; |
| 47 | bits<5> Rb; |
| 48 | |
| 49 | let Inst{25-21} = Ra; |
| 50 | let Inst{20-16} = Rb; |
| 51 | let Inst{15-0} = disp; |
| 52 | } |
Andrew Lenharth | 02daecc | 2005-07-22 20:50:29 +0000 | [diff] [blame] | 53 | class MForm<bits<6> opcode, string asmstr> |
| 54 | : InstAlpha<opcode, (ops GPRC:$RA, s16imm:$DISP, GPRC:$RB), asmstr> { |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 55 | bits<5> Ra; |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 56 | bits<16> disp; |
Andrew Lenharth | 02daecc | 2005-07-22 20:50:29 +0000 | [diff] [blame] | 57 | bits<5> Rb; |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 58 | |
| 59 | let Inst{25-21} = Ra; |
| 60 | let Inst{20-16} = Rb; |
| 61 | let Inst{15-0} = disp; |
| 62 | } |
Andrew Lenharth | 01aa563 | 2005-11-11 16:47:30 +0000 | [diff] [blame] | 63 | class MfcForm<bits<6> opcode, bits<16> fc, string asmstr> |
| 64 | : InstAlpha<opcode, (ops GPRC:$RA, GPRC:$RB), asmstr> { |
| 65 | bits<5> Ra; |
| 66 | bits<5> Rb; |
| 67 | |
| 68 | let Inst{25-21} = Ra; |
| 69 | let Inst{20-16} = Rb; |
| 70 | let Inst{15-0} = fc; |
| 71 | } |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 72 | |
Andrew Lenharth | 02daecc | 2005-07-22 20:50:29 +0000 | [diff] [blame] | 73 | class MgForm<bits<6> opcode, string asmstr> |
| 74 | : InstAlpha<opcode, (ops GPRC:$RA, s16imm:$DISP, GPRC:$RB, s16imm:$NUM), asmstr> { |
| 75 | bits<5> Ra; |
| 76 | bits<16> disp; |
| 77 | bits<5> Rb; |
| 78 | |
| 79 | let Inst{25-21} = Ra; |
| 80 | let Inst{20-16} = Rb; |
| 81 | let Inst{15-0} = disp; |
| 82 | } |
| 83 | |
| 84 | class MbrForm<bits<6> opcode, bits<2> TB, dag OL, string asmstr> : InstAlpha<opcode, OL, asmstr> { |
| 85 | bits<5> Ra; |
| 86 | bits<5> Rb; |
| 87 | bits<14> disp; |
| 88 | |
| 89 | let Inst{25-21} = Ra; |
| 90 | let Inst{20-16} = Rb; |
| 91 | let Inst{15-14} = TB; |
| 92 | let Inst{13-0} = disp; |
| 93 | } |
| 94 | |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 95 | //3.3.2 |
| 96 | let isBranch = 1, isTerminator = 1 in |
Andrew Lenharth | 02daecc | 2005-07-22 20:50:29 +0000 | [diff] [blame] | 97 | class BForm<bits<6> opcode, string asmstr> |
| 98 | : InstAlpha<opcode, (ops GPRC:$RA, s21imm:$DISP), asmstr> { |
| 99 | bits<5> Ra; |
| 100 | bits<21> disp; |
| 101 | |
| 102 | let Inst{25-21} = Ra; |
| 103 | let Inst{20-0} = disp; |
| 104 | } |
Andrew Lenharth | 29b7ef0 | 2005-12-06 20:40:34 +0000 | [diff] [blame] | 105 | let isBranch = 1, isTerminator = 1 in |
Andrew Lenharth | 5a99041 | 2005-10-22 22:06:58 +0000 | [diff] [blame] | 106 | class BFormD<bits<6> opcode, string asmstr> |
| 107 | : InstAlpha<opcode, (ops s21imm:$DISP), asmstr> { |
| 108 | bits<5> Ra = 31; |
| 109 | bits<21> disp; |
| 110 | |
| 111 | let Inst{25-21} = Ra; |
| 112 | let Inst{20-0} = disp; |
| 113 | } |
Andrew Lenharth | 02daecc | 2005-07-22 20:50:29 +0000 | [diff] [blame] | 114 | |
| 115 | let isBranch = 1, isTerminator = 1 in |
| 116 | class FBForm<bits<6> opcode, string asmstr> |
Andrew Lenharth | 97a7fcf | 2005-11-09 19:17:08 +0000 | [diff] [blame] | 117 | : InstAlpha<opcode, (ops F8RC:$RA, s21imm:$DISP), asmstr> { |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 118 | bits<5> Ra; |
| 119 | bits<21> disp; |
| 120 | |
| 121 | let Inst{25-21} = Ra; |
| 122 | let Inst{20-0} = disp; |
| 123 | } |
| 124 | |
| 125 | //3.3.3 |
Andrew Lenharth | 7b69867 | 2005-10-20 00:28:31 +0000 | [diff] [blame] | 126 | class OForm<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern> |
Andrew Lenharth | 02daecc | 2005-07-22 20:50:29 +0000 | [diff] [blame] | 127 | : InstAlpha<opcode, (ops GPRC:$RC, GPRC:$RA, GPRC:$RB), asmstr> { |
Andrew Lenharth | 7b69867 | 2005-10-20 00:28:31 +0000 | [diff] [blame] | 128 | let Pattern = pattern; |
| 129 | |
Andrew Lenharth | 02daecc | 2005-07-22 20:50:29 +0000 | [diff] [blame] | 130 | bits<5> Rc; |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 131 | bits<5> Ra; |
| 132 | bits<5> Rb; |
Andrew Lenharth | 02daecc | 2005-07-22 20:50:29 +0000 | [diff] [blame] | 133 | bits<7> Function = fun; |
| 134 | |
| 135 | let Inst{25-21} = Ra; |
| 136 | let Inst{20-16} = Rb; |
| 137 | let Inst{15-13} = 0; |
| 138 | let Inst{12} = 0; |
| 139 | let Inst{11-5} = Function; |
| 140 | let Inst{4-0} = Rc; |
| 141 | } |
| 142 | |
Andrew Lenharth | a6a23b5 | 2005-10-20 23:58:36 +0000 | [diff] [blame] | 143 | class OForm2<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern> |
Andrew Lenharth | d4c0ed7 | 2005-10-20 19:39:24 +0000 | [diff] [blame] | 144 | : InstAlpha<opcode, (ops GPRC:$RC, GPRC:$RB), asmstr> { |
| 145 | let Pattern = pattern; |
| 146 | |
| 147 | bits<5> Rc; |
| 148 | bits<5> Rb; |
| 149 | bits<7> Function = fun; |
| 150 | |
Andrew Lenharth | 5a99041 | 2005-10-22 22:06:58 +0000 | [diff] [blame] | 151 | let Inst{25-21} = 31; |
Andrew Lenharth | d4c0ed7 | 2005-10-20 19:39:24 +0000 | [diff] [blame] | 152 | let Inst{20-16} = Rb; |
| 153 | let Inst{15-13} = 0; |
| 154 | let Inst{12} = 0; |
| 155 | let Inst{11-5} = Function; |
| 156 | let Inst{4-0} = Rc; |
| 157 | } |
| 158 | |
Andrew Lenharth | e788bbf | 2005-12-06 00:33:53 +0000 | [diff] [blame] | 159 | class OForm4<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern> |
Andrew Lenharth | 3c7c4d7 | 2005-12-05 23:19:44 +0000 | [diff] [blame] | 160 | : InstAlphaAlt<opcode, asmstr> { |
| 161 | let Pattern = pattern; |
| 162 | |
| 163 | bits<5> Rc; |
| 164 | bits<5> Rb; |
| 165 | bits<5> Ra; |
| 166 | bits<7> Function = fun; |
| 167 | |
| 168 | let isTwoAddress = 1; |
| 169 | let Inst{25-21} = Ra; |
| 170 | let Inst{20-16} = Rb; |
| 171 | let Inst{15-13} = 0; |
| 172 | let Inst{12} = 0; |
| 173 | let Inst{11-5} = Function; |
| 174 | let Inst{4-0} = Rc; |
| 175 | } |
| 176 | |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 177 | |
Andrew Lenharth | 7b69867 | 2005-10-20 00:28:31 +0000 | [diff] [blame] | 178 | class OFormL<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern> |
Andrew Lenharth | 02daecc | 2005-07-22 20:50:29 +0000 | [diff] [blame] | 179 | : InstAlpha<opcode, (ops GPRC:$RC, GPRC:$RA, u8imm:$L), asmstr> { |
Andrew Lenharth | 7b69867 | 2005-10-20 00:28:31 +0000 | [diff] [blame] | 180 | let Pattern = pattern; |
| 181 | |
Andrew Lenharth | 02daecc | 2005-07-22 20:50:29 +0000 | [diff] [blame] | 182 | bits<5> Rc; |
| 183 | bits<5> Ra; |
| 184 | bits<8> LIT; |
| 185 | bits<7> Function = fun; |
| 186 | |
| 187 | let Inst{25-21} = Ra; |
| 188 | let Inst{20-13} = LIT; |
| 189 | let Inst{12} = 1; |
| 190 | let Inst{11-5} = Function; |
| 191 | let Inst{4-0} = Rc; |
| 192 | } |
| 193 | |
Andrew Lenharth | a6a23b5 | 2005-10-20 23:58:36 +0000 | [diff] [blame] | 194 | class OForm4L<bits<6> opcode, bits<7> fun, string asmstr> |
| 195 | : InstAlpha<opcode, (ops GPRC:$RDEST, GPRC:$RSRC2, u8imm:$L, GPRC:$RCOND), asmstr> { |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 196 | bits<5> Rc; |
Andrew Lenharth | a6a23b5 | 2005-10-20 23:58:36 +0000 | [diff] [blame] | 197 | bits<8> LIT; |
| 198 | bits<5> Ra; |
| 199 | bits<7> Function = fun; |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 200 | |
Andrew Lenharth | a6a23b5 | 2005-10-20 23:58:36 +0000 | [diff] [blame] | 201 | let isTwoAddress = 1; |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 202 | let Inst{25-21} = Ra; |
| 203 | let Inst{20-13} = LIT; |
| 204 | let Inst{12} = 1; |
| 205 | let Inst{11-5} = Function; |
| 206 | let Inst{4-0} = Rc; |
| 207 | } |
| 208 | |
| 209 | //3.3.4 |
Andrew Lenharth | 97a7fcf | 2005-11-09 19:17:08 +0000 | [diff] [blame] | 210 | class FPForm<bits<6> opcode, bits<11> fun, string asmstr, list<dag> pattern> |
| 211 | : InstAlphaAlt<opcode, asmstr> { |
| 212 | let Pattern = pattern; |
| 213 | |
Andrew Lenharth | 1ec48e8 | 2005-07-28 18:14:47 +0000 | [diff] [blame] | 214 | bits<5> Fc; |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 215 | bits<5> Fa; |
| 216 | bits<5> Fb; |
Andrew Lenharth | 5ae5f81 | 2005-01-26 21:54:09 +0000 | [diff] [blame] | 217 | bits<11> Function = fun; |
Andrew Lenharth | 1ec48e8 | 2005-07-28 18:14:47 +0000 | [diff] [blame] | 218 | |
| 219 | let Inst{25-21} = Fa; |
| 220 | let Inst{20-16} = Fb; |
| 221 | let Inst{15-5} = Function; |
| 222 | let Inst{4-0} = Fc; |
| 223 | } |
| 224 | |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 225 | //3.3.5 |
| 226 | class PALForm<bits<6> opcode, dag OL, string asmstr> : InstAlpha<opcode, OL, asmstr> { |
| 227 | bits<26> Function; |
| 228 | |
| 229 | let Inst{25-0} = Function; |
| 230 | } |
| 231 | |
| 232 | |
| 233 | // Pseudo instructions. |
Andrew Lenharth | 0294e33 | 2005-11-22 04:20:06 +0000 | [diff] [blame] | 234 | class PseudoInstAlpha<dag OL, string nm, list<dag> pattern> : InstAlpha<0, OL, nm> { |
| 235 | let Pattern = pattern; |
| 236 | |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 237 | } |