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