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 | 02daecc | 2005-07-22 20:50:29 +0000 | [diff] [blame] | 20 | def u8imm : Operand<i8>; |
| 21 | def s14imm : Operand<i16>; |
| 22 | def s16imm : Operand<i16>; |
| 23 | def s21imm : Operand<i32>; |
| 24 | def s64imm : Operand<i64>; |
| 25 | |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 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; |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 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 |
Andrew Lenharth | 02daecc | 2005-07-22 20:50:29 +0000 | [diff] [blame] | 41 | class MForm<bits<6> opcode, string asmstr> |
| 42 | : InstAlpha<opcode, (ops GPRC:$RA, s16imm:$DISP, GPRC:$RB), asmstr> { |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 43 | bits<5> Ra; |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 44 | bits<16> disp; |
Andrew Lenharth | 02daecc | 2005-07-22 20:50:29 +0000 | [diff] [blame] | 45 | bits<5> Rb; |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 46 | |
| 47 | let Inst{25-21} = Ra; |
| 48 | let Inst{20-16} = Rb; |
| 49 | let Inst{15-0} = disp; |
| 50 | } |
| 51 | |
Andrew Lenharth | 02daecc | 2005-07-22 20:50:29 +0000 | [diff] [blame] | 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 | |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 74 | //3.3.2 |
| 75 | let isBranch = 1, isTerminator = 1 in |
Andrew Lenharth | 02daecc | 2005-07-22 20:50:29 +0000 | [diff] [blame] | 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> { |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 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 |
Andrew Lenharth | 02daecc | 2005-07-22 20:50:29 +0000 | [diff] [blame] | 96 | class OForm<bits<6> opcode, bits<7> fun, string asmstr> |
| 97 | : InstAlpha<opcode, (ops GPRC:$RC, GPRC:$RA, GPRC:$RB), asmstr> { |
| 98 | bits<5> Rc; |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 99 | bits<5> Ra; |
| 100 | bits<5> Rb; |
Andrew Lenharth | 02daecc | 2005-07-22 20:50:29 +0000 | [diff] [blame] | 101 | bits<7> Function = fun; |
| 102 | |
| 103 | let Inst{25-21} = Ra; |
| 104 | let Inst{20-16} = Rb; |
| 105 | let Inst{15-13} = 0; |
| 106 | let Inst{12} = 0; |
| 107 | let Inst{11-5} = Function; |
| 108 | let Inst{4-0} = Rc; |
| 109 | } |
| 110 | |
| 111 | class OcmForm<bits<6> opcode, bits<7> fun, dag OL, string asmstr> |
| 112 | : InstAlpha<opcode, OL, asmstr> { |
| 113 | bits<5> Ra; |
| 114 | bits<5> Rb; |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 115 | bits<7> Function = fun; |
| 116 | bits<5> Rc; |
| 117 | |
| 118 | let Inst{25-21} = Ra; |
| 119 | let Inst{20-16} = Rb; |
Andrew Lenharth | 02daecc | 2005-07-22 20:50:29 +0000 | [diff] [blame] | 120 | let Inst{15-13} = 0; |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 121 | let Inst{12} = 0; |
| 122 | let Inst{11-5} = Function; |
| 123 | let Inst{4-0} = Rc; |
| 124 | } |
| 125 | |
| 126 | |
Andrew Lenharth | 02daecc | 2005-07-22 20:50:29 +0000 | [diff] [blame] | 127 | class OFormL<bits<6> opcode, bits<7> fun, string asmstr> |
| 128 | : InstAlpha<opcode, (ops GPRC:$RC, GPRC:$RA, u8imm:$L), asmstr> { |
| 129 | bits<5> Rc; |
| 130 | bits<5> Ra; |
| 131 | bits<8> LIT; |
| 132 | bits<7> Function = fun; |
| 133 | |
| 134 | let Inst{25-21} = Ra; |
| 135 | let Inst{20-13} = LIT; |
| 136 | let Inst{12} = 1; |
| 137 | let Inst{11-5} = Function; |
| 138 | let Inst{4-0} = Rc; |
| 139 | } |
| 140 | |
| 141 | class OcmFormL<bits<6> opcode, bits<7> fun, dag OL, string asmstr> |
| 142 | : InstAlpha<opcode, OL, asmstr> { |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 143 | bits<5> Ra; |
| 144 | bits<8> LIT; |
Andrew Lenharth | 2f0f845 | 2005-01-24 19:44:07 +0000 | [diff] [blame] | 145 | bits<7> Function = fun; |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 146 | bits<5> Rc; |
| 147 | |
| 148 | let Inst{25-21} = Ra; |
| 149 | let Inst{20-13} = LIT; |
| 150 | let Inst{12} = 1; |
| 151 | let Inst{11-5} = Function; |
| 152 | let Inst{4-0} = Rc; |
| 153 | } |
| 154 | |
| 155 | //3.3.4 |
Andrew Lenharth | 1ec48e8 | 2005-07-28 18:14:47 +0000 | [diff] [blame^] | 156 | class FPForm<bits<6> opcode, bits<11> fun, string asmstr> |
| 157 | : InstAlpha<opcode, (ops FPRC:$RC, FPRC:$RA, FPRC:$RB), asmstr> { |
| 158 | bits<5> Fc; |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 159 | bits<5> Fa; |
| 160 | bits<5> Fb; |
Andrew Lenharth | 5ae5f81 | 2005-01-26 21:54:09 +0000 | [diff] [blame] | 161 | bits<11> Function = fun; |
Andrew Lenharth | 1ec48e8 | 2005-07-28 18:14:47 +0000 | [diff] [blame^] | 162 | |
| 163 | let Inst{25-21} = Fa; |
| 164 | let Inst{20-16} = Fb; |
| 165 | let Inst{15-5} = Function; |
| 166 | let Inst{4-0} = Fc; |
| 167 | } |
| 168 | |
| 169 | class FPFormCM<bits<6> opcode, bits<11> fun, dag OL, string asmstr> |
| 170 | : InstAlpha<opcode, OL, asmstr> { |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 171 | bits<5> Fc; |
Andrew Lenharth | 1ec48e8 | 2005-07-28 18:14:47 +0000 | [diff] [blame^] | 172 | bits<5> Fa; |
| 173 | bits<5> Fb; |
| 174 | bits<11> Function = fun; |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 175 | |
| 176 | let Inst{25-21} = Fa; |
| 177 | let Inst{20-16} = Fb; |
| 178 | let Inst{15-5} = Function; |
| 179 | let Inst{4-0} = Fc; |
| 180 | } |
| 181 | |
| 182 | //3.3.5 |
| 183 | class PALForm<bits<6> opcode, dag OL, string asmstr> : InstAlpha<opcode, OL, asmstr> { |
| 184 | bits<26> Function; |
| 185 | |
| 186 | let Inst{25-0} = Function; |
| 187 | } |
| 188 | |
| 189 | |
| 190 | // Pseudo instructions. |
| 191 | class PseudoInstAlpha<dag OL, string nm> : InstAlpha<0, OL, nm> { |
| 192 | } |