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