| OLD | NEW |
| 1 //===- subzero/src/IceInstARM32.def - X-Macros for ARM32 insts --*- C++ -*-===// | 1 //===- subzero/src/IceInstARM32.def - X-Macros for ARM32 insts --*- C++ -*-===// |
| 2 // | 2 // |
| 3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 // | 9 // |
| 10 // This file defines properties of ARM32 instructions in the form of x-macros. | 10 // This file defines properties of ARM32 instructions in the form of x-macros. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 // For the NaCl sandbox we also need to r9 (and the r8-r9 pair) for TLS, so | 21 // For the NaCl sandbox we also need to r9 (and the r8-r9 pair) for TLS, so |
| 22 // just reserve always. | 22 // just reserve always. |
| 23 // TODO(jpp): Allow r9 to be isInt when sandboxing is turned off (native mode). | 23 // TODO(jpp): Allow r9 to be isInt when sandboxing is turned off (native mode). |
| 24 // | 24 // |
| 25 // IP is not considered isInt to reserve it as a scratch register. A scratch | 25 // IP is not considered isInt to reserve it as a scratch register. A scratch |
| 26 // register is useful for expanding instructions post-register allocation. | 26 // register is useful for expanding instructions post-register allocation. |
| 27 // | 27 // |
| 28 // LR is not considered isInt to avoid being allocated as a register. It is | 28 // LR is not considered isInt to avoid being allocated as a register. It is |
| 29 // technically preserved, but save/restore is handled separately, based on | 29 // technically preserved, but save/restore is handled separately, based on |
| 30 // whether or not the function MaybeLeafFunc. | 30 // whether or not the function MaybeLeafFunc. |
| 31 // |
| 32 // The register tables can be generated using the gen_arm32_reg_tables.py |
| 33 // script. |
| 31 | 34 |
| 32 #define REGARM32_GPR_TABLE \ | 35 #define REGARM32_GPR_TABLE \ |
| 33 /* val, encode, name, scratch,preserved,stackptr,frameptr, \ | 36 /* val, encode, name, scratch,preserved,stackptr,frameptr, \ |
| 34 isInt,isI64Pair,isFP32,isFP64,isVec128, alias_init */ \ | 37 isInt,isI64Pair,isFP32,isFP64,isVec128, alias_init */ \ |
| 35 X(Reg_r0, 0, "r0", 1,0,0,0, 1,0,0,0,0, REGLIST1(RegARM32, r0r1)) \ | 38 X(Reg_r0, 0, "r0", 1,0,0,0, 1,0,0,0,0, REGLIST1(RegARM32, r0r1)) \ |
| 36 X(Reg_r1, 1, "r1", 1,0,0,0, 1,0,0,0,0, REGLIST1(RegARM32, r0r1)) \ | 39 X(Reg_r1, 1, "r1", 1,0,0,0, 1,0,0,0,0, REGLIST1(RegARM32, r0r1)) \ |
| 37 X(Reg_r2, 2, "r2", 1,0,0,0, 1,0,0,0,0, REGLIST1(RegARM32, r2r3)) \ | 40 X(Reg_r2, 2, "r2", 1,0,0,0, 1,0,0,0,0, REGLIST1(RegARM32, r2r3)) \ |
| 38 X(Reg_r3, 3, "r3", 1,0,0,0, 1,0,0,0,0, REGLIST1(RegARM32, r2r3)) \ | 41 X(Reg_r3, 3, "r3", 1,0,0,0, 1,0,0,0,0, REGLIST1(RegARM32, r2r3)) \ |
| 39 X(Reg_r4, 4, "r4", 0,1,0,0, 1,0,0,0,0, REGLIST1(RegARM32, r4r5)) \ | 42 X(Reg_r4, 4, "r4", 0,1,0,0, 1,0,0,0,0, REGLIST1(RegARM32, r4r5)) \ |
| 40 X(Reg_r5, 5, "r5", 0,1,0,0, 1,0,0,0,0, REGLIST1(RegARM32, r4r5)) \ | 43 X(Reg_r5, 5, "r5", 0,1,0,0, 1,0,0,0,0, REGLIST1(RegARM32, r4r5)) \ |
| (...skipping 21 matching lines...) Expand all Loading... |
| 62 X(Reg_r0r1, 0, "r0, r1", 1,0,0,0, 0,1,0,0,0, REGLIST2(RegARM32, r0, r1)) \ | 65 X(Reg_r0r1, 0, "r0, r1", 1,0,0,0, 0,1,0,0,0, REGLIST2(RegARM32, r0, r1)) \ |
| 63 X(Reg_r2r3, 2, "r2, r3", 1,0,0,0, 0,1,0,0,0, REGLIST2(RegARM32, r2, r3)) \ | 66 X(Reg_r2r3, 2, "r2, r3", 1,0,0,0, 0,1,0,0,0, REGLIST2(RegARM32, r2, r3)) \ |
| 64 X(Reg_r4r5, 4, "r4, r5", 0,1,0,0, 0,1,0,0,0, REGLIST2(RegARM32, r4, r5)) \ | 67 X(Reg_r4r5, 4, "r4, r5", 0,1,0,0, 0,1,0,0,0, REGLIST2(RegARM32, r4, r5)) \ |
| 65 X(Reg_r6r7, 6, "r6, r7", 0,1,0,0, 0,1,0,0,0, REGLIST2(RegARM32, r6, r7)) \ | 68 X(Reg_r6r7, 6, "r6, r7", 0,1,0,0, 0,1,0,0,0, REGLIST2(RegARM32, r6, r7)) \ |
| 66 X(Reg_r8r9, 8, "r8, r9", 0,1,0,0, 0,0,0,0,0, REGLIST2(RegARM32, r8, r9)) \ | 69 X(Reg_r8r9, 8, "r8, r9", 0,1,0,0, 0,0,0,0,0, REGLIST2(RegARM32, r8, r9)) \ |
| 67 X(Reg_r10fp, 10, "r10, fp", 0,1,0,0, 0,0,0,0,0, REGLIST2(RegARM32, r10, fp)) | 70 X(Reg_r10fp, 10, "r10, fp", 0,1,0,0, 0,0,0,0,0, REGLIST2(RegARM32, r10, fp)) |
| 68 //#define X(val, encode, name, scratch, preserved, stackptr, frameptr, | 71 //#define X(val, encode, name, scratch, preserved, stackptr, frameptr, |
| 69 // isInt, isI64Pair, isFP32, isFP64, isVec128, alias_init) | 72 // isInt, isI64Pair, isFP32, isFP64, isVec128, alias_init) |
| 70 | 73 |
| 71 // S registers 0-15 are scratch, but 16-31 are preserved. | 74 // S registers 0-15 are scratch, but 16-31 are preserved. |
| 72 // Regenerate this with the following python script: | |
| 73 // | |
| 74 // def print_sregs(): | |
| 75 // for i in xrange(0, 32): | |
| 76 // is_scratch = 1 if i < 16 else 0 | |
| 77 // is_preserved = 1 if i >= 16 else 0 | |
| 78 // print (' X(Reg_s{regnum:<2}, {regnum:<2}, "s{regnum}", ' + | |
| 79 // '{scratch}, {preserved}, 0, 0, 0, 0, 1, 0, 0, ' + | |
| 80 // 'REGLIST2(RegARM32, d{regnum:<2}, ' + | |
| 81 // 'q{regnum_q:<2})) \\').format( | |
| 82 // regnum=i, regnum_d=i>>1, | |
| 83 // regnum_q=i>>2, scratch=is_scratch, preserved=is_preserved) | |
| 84 // | |
| 85 // print_sregs() | |
| 86 // | |
| 87 #define REGARM32_FP32_TABLE \ | 75 #define REGARM32_FP32_TABLE \ |
| 88 /* val, encode, name, scratch,preserved,stackptr,frameptr, \ | 76 /* val, encode, name, scratch,preserved,stackptr,frameptr, \ |
| 89 isInt,isI64Pair,isFP32,isFP64,isVec128, alias_init */ \ | 77 isInt,isI64Pair,isFP32,isFP64,isVec128, alias_init */ \ |
| 90 X(Reg_s0, 0, "s0", 1,0,0,0, 0,0,1,0,0, REGLIST2(RegARM32, d0, q0)) \ | 78 X(Reg_s0, 0, "s0", 1,0,0,0, 0,0,1,0,0, REGLIST2(RegARM32, d0, q0)) \ |
| 91 X(Reg_s1, 1, "s1", 1,0,0,0, 0,0,1,0,0, REGLIST2(RegARM32, d0, q0)) \ | 79 X(Reg_s1, 1, "s1", 1,0,0,0, 0,0,1,0,0, REGLIST2(RegARM32, d0, q0)) \ |
| 92 X(Reg_s2, 2, "s2", 1,0,0,0, 0,0,1,0,0, REGLIST2(RegARM32, d1, q0)) \ | 80 X(Reg_s2, 2, "s2", 1,0,0,0, 0,0,1,0,0, REGLIST2(RegARM32, d1, q0)) \ |
| 93 X(Reg_s3, 3, "s3", 1,0,0,0, 0,0,1,0,0, REGLIST2(RegARM32, d1, q0)) \ | 81 X(Reg_s3, 3, "s3", 1,0,0,0, 0,0,1,0,0, REGLIST2(RegARM32, d1, q0)) \ |
| 94 X(Reg_s4, 4, "s4", 1,0,0,0, 0,0,1,0,0, REGLIST2(RegARM32, d2, q1)) \ | 82 X(Reg_s4, 4, "s4", 1,0,0,0, 0,0,1,0,0, REGLIST2(RegARM32, d2, q1)) \ |
| 95 X(Reg_s5, 5, "s5", 1,0,0,0, 0,0,1,0,0, REGLIST2(RegARM32, d2, q1)) \ | 83 X(Reg_s5, 5, "s5", 1,0,0,0, 0,0,1,0,0, REGLIST2(RegARM32, d2, q1)) \ |
| 96 X(Reg_s6, 6, "s6", 1,0,0,0, 0,0,1,0,0, REGLIST2(RegARM32, d3, q1)) \ | 84 X(Reg_s6, 6, "s6", 1,0,0,0, 0,0,1,0,0, REGLIST2(RegARM32, d3, q1)) \ |
| (...skipping 24 matching lines...) Expand all Loading... |
| 121 X(Reg_s31, 31, "s31", 0,1,0,0, 0,0,1,0,0, REGLIST2(RegARM32, d15, q7)) | 109 X(Reg_s31, 31, "s31", 0,1,0,0, 0,0,1,0,0, REGLIST2(RegARM32, d15, q7)) |
| 122 //#define X(val, encode, name, scratch, preserved, stackptr, frameptr, | 110 //#define X(val, encode, name, scratch, preserved, stackptr, frameptr, |
| 123 // isInt, isI64Pair, isFP32,isFP64, isVec128, alias_init) | 111 // isInt, isI64Pair, isFP32,isFP64, isVec128, alias_init) |
| 124 | 112 |
| 125 // D registers 0-7 are scratch, 8-15 are preserved, and 16-31 are also scratch | 113 // D registers 0-7 are scratch, 8-15 are preserved, and 16-31 are also scratch |
| 126 // (if supported by the D32 feature vs D16). D registers are defined in reverse | 114 // (if supported by the D32 feature vs D16). D registers are defined in reverse |
| 127 // order so that, during register allocation, Subzero will prefer higher D | 115 // order so that, during register allocation, Subzero will prefer higher D |
| 128 // registers. In processors supporting the D32 feature this will effectively | 116 // registers. In processors supporting the D32 feature this will effectively |
| 129 // cause double allocation to bias towards allocating "high" D registers, which | 117 // cause double allocation to bias towards allocating "high" D registers, which |
| 130 // do not alias any S registers. | 118 // do not alias any S registers. |
| 131 // | |
| 132 // Regenerate this with the following python script: | |
| 133 // def print_dregs(): | |
| 134 // for i in xrange(31, 15, -1): | |
| 135 // is_scratch = 1 if (i < 8 or i >= 16) else 0 | |
| 136 // is_preserved = 1 if (8 <= i and i < 16) else 0 | |
| 137 // print (' X(Reg_d{regnum:<2}, {regnum:<2}, "d{regnum}", ' + | |
| 138 // '{scratch}, {preserved}, 0, 0, 0, 0, 0, 1, 0, ' + | |
| 139 // 'REGLIST1(RegARM32, q{regnum_q:<2}) \\').format( | |
| 140 // regnum=i, regnum_q=i>>1, scratch=is_scratch, | |
| 141 // preserved=is_preserved) | |
| 142 // for i in xrange(15, -1, -1): | |
| 143 // is_scratch = 1 if (i < 8 or i >= 16) else 0 | |
| 144 // is_preserved = 1 if (8 <= i and i < 16) else 0 | |
| 145 // print (' X(Reg_d{regnum:<2}, {regnum:<2}, "d{regnum}", ' + | |
| 146 // '{scratch}, {preserved}, 0, 0, 0, 0, 0, 1, 0, ' + | |
| 147 // 'REGLIST3(RegARM32, s{regnum_s0:<2}, s{regnum_s1:<2}, ' + | |
| 148 // 'q{regnum_q:<2})) \\').format( | |
| 149 // regnum_s0 = (i<<1), regnum_s1 = (i<<1) + 1, regnum=i, | |
| 150 // regnum_q=i>>1, scratch=is_scratch, preserved=is_preserved) | |
| 151 // | |
| 152 // print_dregs() | |
| 153 // | |
| 154 #define REGARM32_FP64_TABLE \ | 119 #define REGARM32_FP64_TABLE \ |
| 155 /* val, encode, name, scratch,preserved,stackptr,frameptr, \ | 120 /* val, encode, name, scratch,preserved,stackptr,frameptr, \ |
| 156 isInt,isI64Pair,isFP32,isFP64,isVec128, alias_init */ \ | 121 isInt,isI64Pair,isFP32,isFP64,isVec128, alias_init */ \ |
| 157 X(Reg_d31, 31, "d31", 1,0,0,0, 0,0,0,1,0, REGLIST1(RegARM32, q15)) \ | 122 X(Reg_d31, 31, "d31", 1,0,0,0, 0,0,0,1,0, REGLIST1(RegARM32, q15)) \ |
| 158 X(Reg_d30, 30, "d30", 1,0,0,0, 0,0,0,1,0, REGLIST1(RegARM32, q15)) \ | 123 X(Reg_d30, 30, "d30", 1,0,0,0, 0,0,0,1,0, REGLIST1(RegARM32, q15)) \ |
| 159 X(Reg_d29, 29, "d29", 1,0,0,0, 0,0,0,1,0, REGLIST1(RegARM32, q14)) \ | 124 X(Reg_d29, 29, "d29", 1,0,0,0, 0,0,0,1,0, REGLIST1(RegARM32, q14)) \ |
| 160 X(Reg_d28, 28, "d28", 1,0,0,0, 0,0,0,1,0, REGLIST1(RegARM32, q14)) \ | 125 X(Reg_d28, 28, "d28", 1,0,0,0, 0,0,0,1,0, REGLIST1(RegARM32, q14)) \ |
| 161 X(Reg_d27, 27, "d27", 1,0,0,0, 0,0,0,1,0, REGLIST1(RegARM32, q13)) \ | 126 X(Reg_d27, 27, "d27", 1,0,0,0, 0,0,0,1,0, REGLIST1(RegARM32, q13)) \ |
| 162 X(Reg_d26, 26, "d26", 1,0,0,0, 0,0,0,1,0, REGLIST1(RegARM32, q13)) \ | 127 X(Reg_d26, 26, "d26", 1,0,0,0, 0,0,0,1,0, REGLIST1(RegARM32, q13)) \ |
| 163 X(Reg_d25, 25, "d25", 1,0,0,0, 0,0,0,1,0, REGLIST1(RegARM32, q12)) \ | 128 X(Reg_d25, 25, "d25", 1,0,0,0, 0,0,0,1,0, REGLIST1(RegARM32, q12)) \ |
| (...skipping 21 matching lines...) Expand all Loading... |
| 185 X(Reg_d3, 3, "d3", 1,0,0,0, 0,0,0,1,0, REGLIST3(RegARM32, s6, s7, q1)) \ | 150 X(Reg_d3, 3, "d3", 1,0,0,0, 0,0,0,1,0, REGLIST3(RegARM32, s6, s7, q1)) \ |
| 186 X(Reg_d2, 2, "d2", 1,0,0,0, 0,0,0,1,0, REGLIST3(RegARM32, s4, s5, q1)) \ | 151 X(Reg_d2, 2, "d2", 1,0,0,0, 0,0,0,1,0, REGLIST3(RegARM32, s4, s5, q1)) \ |
| 187 X(Reg_d1, 1, "d1", 1,0,0,0, 0,0,0,1,0, REGLIST3(RegARM32, s2, s3, q0)) \ | 152 X(Reg_d1, 1, "d1", 1,0,0,0, 0,0,0,1,0, REGLIST3(RegARM32, s2, s3, q0)) \ |
| 188 X(Reg_d0, 0, "d0", 1,0,0,0, 0,0,0,1,0, REGLIST3(RegARM32, s0, s1, q0)) | 153 X(Reg_d0, 0, "d0", 1,0,0,0, 0,0,0,1,0, REGLIST3(RegARM32, s0, s1, q0)) |
| 189 //#define X(val, encode, name, scratch, preserved, stackptr, frameptr, | 154 //#define X(val, encode, name, scratch, preserved, stackptr, frameptr, |
| 190 // isInt, isI64Pair, isFP32, isFP64, isVec128, alias_init) | 155 // isInt, isI64Pair, isFP32, isFP64, isVec128, alias_init) |
| 191 | 156 |
| 192 // Q registers 0-3 are scratch, 4-7 are preserved, and 8-15 are also scratch | 157 // Q registers 0-3 are scratch, 4-7 are preserved, and 8-15 are also scratch |
| 193 // (if supported by the D32 feature). Q registers are defined in reverse order | 158 // (if supported by the D32 feature). Q registers are defined in reverse order |
| 194 // for the same reason as D registers. | 159 // for the same reason as D registers. |
| 195 // | |
| 196 // Regenerate this with the following python script: | |
| 197 // def print_qregs(): | |
| 198 // for i in xrange(15, 7, -1): | |
| 199 // is_scratch = 1 if (i < 4 or i >= 8) else 0 | |
| 200 // is_preserved = 1 if (4 <= i and i < 8) else 0 | |
| 201 // print (' X(Reg_q{regnum:<2}, {regnum:<2}, "q{regnum}", ' + | |
| 202 // '{scratch}, {preserved}, 0, 0, 0, 0, 0, 0, 1, REGLIST2(' + | |
| 203 // 'RegARM32, d{regnum_d0:<2}, d{regnum_d1:<2})) \\').format( | |
| 204 // regnum_d0=(i<<1), regnum_d1=(i<<1)+1, regnum=i, | |
| 205 // scratch=is_scratch, preserved=is_preserved) | |
| 206 // for i in xrange(7, -1, -1): | |
| 207 // is_scratch = 1 if (i < 4 or i >= 8) else 0 | |
| 208 // is_preserved = 1 if (4 <= i and i < 8) else 0 | |
| 209 // print (' X(Reg_q{regnum:<2}, {regnum:<2}, "q{regnum}", ' + | |
| 210 // '{scratch}, {preserved}, 0, 0, 0, 0, 0, 0, 1, REGLIST6(' + | |
| 211 // 'RegARM32, s{regnum_s0:<2}, s{regnum_s1:<2}, ' + | |
| 212 // 's{regnum_s2:<2}, s{regnum_s3:<2}, ' + | |
| 213 // 'd{regnum_d0:<2}, d{regnum_d1:<2})) \\').format( | |
| 214 // regnum_s0=(i<<2), regnum_s1=(i<<2)+1, regnum_s2=(i<<2)+2, | |
| 215 // regnum_s3=(i<<2)+3, regnum_d0=(i<<1), regnum_d1=(i<<1)+1, | |
| 216 // regnum=i, scratch=is_scratch, preserved=is_preserved) | |
| 217 // | |
| 218 // print_qregs() | |
| 219 // | |
| 220 #define REGARM32_VEC128_TABLE \ | 160 #define REGARM32_VEC128_TABLE \ |
| 221 /* val, encode, name, scratch, preserved, stackptr, frameptr, \ | 161 /* val, encode, name, scratch, preserved, stackptr, frameptr, \ |
| 222 isInt, isI64Pair, isFP32, isFP64, isVec128, alias_init */ \ | 162 isInt, isI64Pair, isFP32, isFP64, isVec128, alias_init */ \ |
| 223 X(Reg_q15, 15, "q15", 1, 0, 0, 0, 0, 0, 0, 0, 1, \ | 163 X(Reg_q15, 15, "q15", 1, 0, 0, 0, 0, 0, 0, 0, 1, \ |
| 224 REGLIST2(RegARM32, d30, d31)) \ | 164 REGLIST2(RegARM32, d30, d31)) \ |
| 225 X(Reg_q14, 14, "q14", 1, 0, 0, 0, 0, 0, 0, 0, 1, \ | 165 X(Reg_q14, 14, "q14", 1, 0, 0, 0, 0, 0, 0, 0, 1, \ |
| 226 REGLIST2(RegARM32, d28, d29)) \ | 166 REGLIST2(RegARM32, d28, d29)) \ |
| 227 X(Reg_q13, 13, "q13", 1, 0, 0, 0, 0, 0, 0, 0, 1, \ | 167 X(Reg_q13, 13, "q13", 1, 0, 0, 0, 0, 0, 0, 0, 1, \ |
| 228 REGLIST2(RegARM32, d26, d27)) \ | 168 REGLIST2(RegARM32, d26, d27)) \ |
| 229 X(Reg_q12, 12, "q12", 1, 0, 0, 0, 0, 0, 0, 0, 1, \ | 169 X(Reg_q12, 12, "q12", 1, 0, 0, 0, 0, 0, 0, 0, 1, \ |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 X(LS, 9, HI, "ls") /* unsigned lower or same */ \ | 274 X(LS, 9, HI, "ls") /* unsigned lower or same */ \ |
| 335 X(GE, 10, LT, "ge") /* signed greater than or equal */ \ | 275 X(GE, 10, LT, "ge") /* signed greater than or equal */ \ |
| 336 X(LT, 11, GE, "lt") /* signed less than */ \ | 276 X(LT, 11, GE, "lt") /* signed less than */ \ |
| 337 X(GT, 12, LE, "gt") /* signed greater than */ \ | 277 X(GT, 12, LE, "gt") /* signed greater than */ \ |
| 338 X(LE, 13, GT, "le") /* signed less than or equal */ \ | 278 X(LE, 13, GT, "le") /* signed less than or equal */ \ |
| 339 X(AL, 14, kNone, "") /* always (unconditional) */ \ | 279 X(AL, 14, kNone, "") /* always (unconditional) */ \ |
| 340 X(kNone, 15, kNone, "??") /* special condition / none */ | 280 X(kNone, 15, kNone, "??") /* special condition / none */ |
| 341 //#define X(tag, encode, opp, emit) | 281 //#define X(tag, encode, opp, emit) |
| 342 | 282 |
| 343 #endif // SUBZERO_SRC_ICEINSTARM32_DEF | 283 #endif // SUBZERO_SRC_ICEINSTARM32_DEF |
| OLD | NEW |