| OLD | NEW |
| 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
| 2 // All Rights Reserved. | 2 // All Rights Reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions | 5 // modification, are permitted provided that the following conditions |
| 6 // are met: | 6 // are met: |
| 7 // | 7 // |
| 8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
| 9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
| 10 // | 10 // |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 // forces initialization stubs in MSVC, making us dependent on initialization | 59 // forces initialization stubs in MSVC, making us dependent on initialization |
| 60 // order. | 60 // order. |
| 61 // | 61 // |
| 62 // 3) By not using an enum, we are possibly preventing the compiler from | 62 // 3) By not using an enum, we are possibly preventing the compiler from |
| 63 // doing certain constant folds, which may significantly reduce the | 63 // doing certain constant folds, which may significantly reduce the |
| 64 // code generated for some assembly instructions (because they boil down | 64 // code generated for some assembly instructions (because they boil down |
| 65 // to a few constants). If this is a problem, we could change the code | 65 // to a few constants). If this is a problem, we could change the code |
| 66 // such that we use an enum in optimized mode, and the struct in debug | 66 // such that we use an enum in optimized mode, and the struct in debug |
| 67 // mode. This way we get the compile-time error checking in debug mode | 67 // mode. This way we get the compile-time error checking in debug mode |
| 68 // and best performance in optimized code. | 68 // and best performance in optimized code. |
| 69 // | 69 |
| 70 // Core register | 70 // Core register |
| 71 struct Register { | 71 struct Register { |
| 72 static const int kNumRegisters = 16; | 72 static const int kNumRegisters = 16; |
| 73 static const int kNumAllocatableRegisters = 8; | 73 static const int kNumAllocatableRegisters = 8; |
| 74 | 74 |
| 75 static int ToAllocationIndex(Register reg) { | 75 static int ToAllocationIndex(Register reg) { |
| 76 ASSERT(reg.code() < kNumAllocatableRegisters); |
| 76 return reg.code(); | 77 return reg.code(); |
| 77 } | 78 } |
| 78 | 79 |
| 79 static Register FromAllocationIndex(int index) { | 80 static Register FromAllocationIndex(int index) { |
| 80 ASSERT(index >= 0 && index < kNumAllocatableRegisters); | 81 ASSERT(index >= 0 && index < kNumAllocatableRegisters); |
| 81 return from_code(index); | 82 return from_code(index); |
| 82 } | 83 } |
| 83 | 84 |
| 84 static const char* AllocationIndexToString(int index) { | 85 static const char* AllocationIndexToString(int index) { |
| 85 ASSERT(index >= 0 && index < kNumAllocatableRegisters); | 86 ASSERT(index >= 0 && index < kNumAllocatableRegisters); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 126 |
| 126 const Register r0 = { 0 }; | 127 const Register r0 = { 0 }; |
| 127 const Register r1 = { 1 }; | 128 const Register r1 = { 1 }; |
| 128 const Register r2 = { 2 }; | 129 const Register r2 = { 2 }; |
| 129 const Register r3 = { 3 }; | 130 const Register r3 = { 3 }; |
| 130 const Register r4 = { 4 }; | 131 const Register r4 = { 4 }; |
| 131 const Register r5 = { 5 }; | 132 const Register r5 = { 5 }; |
| 132 const Register r6 = { 6 }; | 133 const Register r6 = { 6 }; |
| 133 const Register r7 = { 7 }; | 134 const Register r7 = { 7 }; |
| 134 const Register r8 = { 8 }; // Used as context register. | 135 const Register r8 = { 8 }; // Used as context register. |
| 135 const Register r9 = { 9 }; | 136 const Register r9 = { 9 }; // Used as lithium codegen scratch register. |
| 136 const Register r10 = { 10 }; // Used as roots register. | 137 const Register r10 = { 10 }; // Used as roots register. |
| 137 const Register fp = { 11 }; | 138 const Register fp = { 11 }; |
| 138 const Register ip = { 12 }; | 139 const Register ip = { 12 }; |
| 139 const Register sp = { 13 }; | 140 const Register sp = { 13 }; |
| 140 const Register lr = { 14 }; | 141 const Register lr = { 14 }; |
| 141 const Register pc = { 15 }; | 142 const Register pc = { 15 }; |
| 142 | 143 |
| 143 // Single word VFP register. | 144 // Single word VFP register. |
| 144 struct SwVfpRegister { | 145 struct SwVfpRegister { |
| 145 bool is_valid() const { return 0 <= code_ && code_ < 32; } | 146 bool is_valid() const { return 0 <= code_ && code_ < 32; } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 159 } | 160 } |
| 160 | 161 |
| 161 int code_; | 162 int code_; |
| 162 }; | 163 }; |
| 163 | 164 |
| 164 | 165 |
| 165 // Double word VFP register. | 166 // Double word VFP register. |
| 166 struct DwVfpRegister { | 167 struct DwVfpRegister { |
| 167 // d0 has been excluded from allocation. This is following ia32 | 168 // d0 has been excluded from allocation. This is following ia32 |
| 168 // where xmm0 is excluded. This should be revisited. | 169 // where xmm0 is excluded. This should be revisited. |
| 170 // Currently d0 is used as a scratch register. |
| 171 // d1 has also been excluded from allocation to be used as a scratch |
| 172 // register as well. |
| 169 static const int kNumRegisters = 16; | 173 static const int kNumRegisters = 16; |
| 170 static const int kNumAllocatableRegisters = 15; | 174 static const int kNumAllocatableRegisters = 14; |
| 171 | 175 |
| 172 static int ToAllocationIndex(DwVfpRegister reg) { | 176 static int ToAllocationIndex(DwVfpRegister reg) { |
| 173 ASSERT(reg.code() != 0); | 177 ASSERT(reg.code() != 0); |
| 174 return reg.code() - 1; | 178 return reg.code() - 1; |
| 175 } | 179 } |
| 176 | 180 |
| 177 static DwVfpRegister FromAllocationIndex(int index) { | 181 static DwVfpRegister FromAllocationIndex(int index) { |
| 178 ASSERT(index >= 0 && index < kNumAllocatableRegisters); | 182 ASSERT(index >= 0 && index < kNumAllocatableRegisters); |
| 179 return from_code(index + 1); | 183 return from_code(index + 2); |
| 180 } | 184 } |
| 181 | 185 |
| 182 static const char* AllocationIndexToString(int index) { | 186 static const char* AllocationIndexToString(int index) { |
| 183 ASSERT(index >= 0 && index < kNumAllocatableRegisters); | 187 ASSERT(index >= 0 && index < kNumAllocatableRegisters); |
| 184 const char* const names[] = { | 188 const char* const names[] = { |
| 185 "d1", | |
| 186 "d2", | 189 "d2", |
| 187 "d3", | 190 "d3", |
| 188 "d4", | 191 "d4", |
| 189 "d5", | 192 "d5", |
| 190 "d6", | 193 "d6", |
| 191 "d7", | 194 "d7", |
| 192 "d8", | 195 "d8", |
| 193 "d9", | 196 "d9", |
| 194 "d10", | 197 "d10", |
| 195 "d11", | 198 "d11", |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 const DwVfpRegister d8 = { 8 }; | 293 const DwVfpRegister d8 = { 8 }; |
| 291 const DwVfpRegister d9 = { 9 }; | 294 const DwVfpRegister d9 = { 9 }; |
| 292 const DwVfpRegister d10 = { 10 }; | 295 const DwVfpRegister d10 = { 10 }; |
| 293 const DwVfpRegister d11 = { 11 }; | 296 const DwVfpRegister d11 = { 11 }; |
| 294 const DwVfpRegister d12 = { 12 }; | 297 const DwVfpRegister d12 = { 12 }; |
| 295 const DwVfpRegister d13 = { 13 }; | 298 const DwVfpRegister d13 = { 13 }; |
| 296 const DwVfpRegister d14 = { 14 }; | 299 const DwVfpRegister d14 = { 14 }; |
| 297 const DwVfpRegister d15 = { 15 }; | 300 const DwVfpRegister d15 = { 15 }; |
| 298 | 301 |
| 299 // VFP FPSCR constants. | 302 // VFP FPSCR constants. |
| 303 static const uint32_t kVFPNConditionFlagBit = 1 << 31; |
| 304 static const uint32_t kVFPZConditionFlagBit = 1 << 30; |
| 305 static const uint32_t kVFPCConditionFlagBit = 1 << 29; |
| 306 static const uint32_t kVFPVConditionFlagBit = 1 << 28; |
| 307 |
| 308 static const uint32_t kVFPFlushToZeroMask = 1 << 24; |
| 309 |
| 310 static const uint32_t kVFPRoundingModeMask = 3 << 22; |
| 311 static const uint32_t kVFPRoundToMinusInfinityBits = 2 << 22; |
| 312 |
| 300 static const uint32_t kVFPExceptionMask = 0xf; | 313 static const uint32_t kVFPExceptionMask = 0xf; |
| 301 static const uint32_t kVFPRoundingModeMask = 3 << 22; | |
| 302 static const uint32_t kVFPFlushToZeroMask = 1 << 24; | |
| 303 static const uint32_t kVFPRoundToMinusInfinityBits = 2 << 22; | |
| 304 | 314 |
| 305 // Coprocessor register | 315 // Coprocessor register |
| 306 struct CRegister { | 316 struct CRegister { |
| 307 bool is_valid() const { return 0 <= code_ && code_ < 16; } | 317 bool is_valid() const { return 0 <= code_ && code_ < 16; } |
| 308 bool is(CRegister creg) const { return code_ == creg.code_; } | 318 bool is(CRegister creg) const { return code_ == creg.code_; } |
| 309 int code() const { | 319 int code() const { |
| 310 ASSERT(is_valid()); | 320 ASSERT(is_valid()); |
| 311 return code_; | 321 return code_; |
| 312 } | 322 } |
| 313 int bit() const { | 323 int bit() const { |
| (...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1150 void vmul(const DwVfpRegister dst, | 1160 void vmul(const DwVfpRegister dst, |
| 1151 const DwVfpRegister src1, | 1161 const DwVfpRegister src1, |
| 1152 const DwVfpRegister src2, | 1162 const DwVfpRegister src2, |
| 1153 const Condition cond = al); | 1163 const Condition cond = al); |
| 1154 void vdiv(const DwVfpRegister dst, | 1164 void vdiv(const DwVfpRegister dst, |
| 1155 const DwVfpRegister src1, | 1165 const DwVfpRegister src1, |
| 1156 const DwVfpRegister src2, | 1166 const DwVfpRegister src2, |
| 1157 const Condition cond = al); | 1167 const Condition cond = al); |
| 1158 void vcmp(const DwVfpRegister src1, | 1168 void vcmp(const DwVfpRegister src1, |
| 1159 const DwVfpRegister src2, | 1169 const DwVfpRegister src2, |
| 1160 const SBit s = LeaveCC, | |
| 1161 const Condition cond = al); | 1170 const Condition cond = al); |
| 1162 void vcmp(const DwVfpRegister src1, | 1171 void vcmp(const DwVfpRegister src1, |
| 1163 const double src2, | 1172 const double src2, |
| 1164 const SBit s = LeaveCC, | |
| 1165 const Condition cond = al); | 1173 const Condition cond = al); |
| 1166 void vmrs(const Register dst, | 1174 void vmrs(const Register dst, |
| 1167 const Condition cond = al); | 1175 const Condition cond = al); |
| 1168 void vmsr(const Register dst, | 1176 void vmsr(const Register dst, |
| 1169 const Condition cond = al); | 1177 const Condition cond = al); |
| 1170 void vsqrt(const DwVfpRegister dst, | 1178 void vsqrt(const DwVfpRegister dst, |
| 1171 const DwVfpRegister src, | 1179 const DwVfpRegister src, |
| 1172 const Condition cond = al); | 1180 const Condition cond = al); |
| 1173 | 1181 |
| 1174 // Pseudo instructions | 1182 // Pseudo instructions |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1424 public: | 1432 public: |
| 1425 explicit EnsureSpace(Assembler* assembler) { | 1433 explicit EnsureSpace(Assembler* assembler) { |
| 1426 assembler->CheckBuffer(); | 1434 assembler->CheckBuffer(); |
| 1427 } | 1435 } |
| 1428 }; | 1436 }; |
| 1429 | 1437 |
| 1430 | 1438 |
| 1431 } } // namespace v8::internal | 1439 } } // namespace v8::internal |
| 1432 | 1440 |
| 1433 #endif // V8_ARM_ASSEMBLER_ARM_H_ | 1441 #endif // V8_ARM_ASSEMBLER_ARM_H_ |
| OLD | NEW |