| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 return NumAllocatableRegisters() - 1; | 220 return NumAllocatableRegisters() - 1; |
| 221 } | 221 } |
| 222 | 222 |
| 223 return (code <= kAllocatableLowRangeEnd) | 223 return (code <= kAllocatableLowRangeEnd) |
| 224 ? code | 224 ? code |
| 225 : code - kAllocatableRangeGapSize; | 225 : code - kAllocatableRangeGapSize; |
| 226 } | 226 } |
| 227 | 227 |
| 228 static Register from_code(int code) { | 228 static Register from_code(int code) { |
| 229 // Always return an X register. | 229 // Always return an X register. |
| 230 return Register::Create(code, kXRegSize); | 230 return Register::Create(code, kXRegSizeInBits); |
| 231 } | 231 } |
| 232 | 232 |
| 233 // End of V8 compatibility section ----------------------- | 233 // End of V8 compatibility section ----------------------- |
| 234 }; | 234 }; |
| 235 | 235 |
| 236 | 236 |
| 237 struct FPRegister : public CPURegister { | 237 struct FPRegister : public CPURegister { |
| 238 static FPRegister Create(unsigned code, unsigned size) { | 238 static FPRegister Create(unsigned code, unsigned size) { |
| 239 return CPURegister::Create(code, size, CPURegister::kFPRegister); | 239 return CPURegister::Create(code, size, CPURegister::kFPRegister); |
| 240 } | 240 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 } | 291 } |
| 292 | 292 |
| 293 static int ToAllocationIndex(FPRegister reg) { | 293 static int ToAllocationIndex(FPRegister reg) { |
| 294 int code = reg.code(); | 294 int code = reg.code(); |
| 295 ASSERT(code < NumAllocatableRegisters()); | 295 ASSERT(code < NumAllocatableRegisters()); |
| 296 return code; | 296 return code; |
| 297 } | 297 } |
| 298 | 298 |
| 299 static FPRegister from_code(int code) { | 299 static FPRegister from_code(int code) { |
| 300 // Always return a D register. | 300 // Always return a D register. |
| 301 return FPRegister::Create(code, kDRegSize); | 301 return FPRegister::Create(code, kDRegSizeInBits); |
| 302 } | 302 } |
| 303 // End of V8 compatibility section ----------------------- | 303 // End of V8 compatibility section ----------------------- |
| 304 }; | 304 }; |
| 305 | 305 |
| 306 | 306 |
| 307 STATIC_ASSERT(sizeof(CPURegister) == sizeof(Register)); | 307 STATIC_ASSERT(sizeof(CPURegister) == sizeof(Register)); |
| 308 STATIC_ASSERT(sizeof(CPURegister) == sizeof(FPRegister)); | 308 STATIC_ASSERT(sizeof(CPURegister) == sizeof(FPRegister)); |
| 309 | 309 |
| 310 | 310 |
| 311 #if defined(A64_DEFINE_REG_STATICS) | 311 #if defined(A64_DEFINE_REG_STATICS) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 327 // these all compare equal (using the Is() method). The Register and FPRegister | 327 // these all compare equal (using the Is() method). The Register and FPRegister |
| 328 // variants are provided for convenience. | 328 // variants are provided for convenience. |
| 329 INITIALIZE_REGISTER(Register, NoReg, 0, 0, CPURegister::kNoRegister); | 329 INITIALIZE_REGISTER(Register, NoReg, 0, 0, CPURegister::kNoRegister); |
| 330 INITIALIZE_REGISTER(FPRegister, NoFPReg, 0, 0, CPURegister::kNoRegister); | 330 INITIALIZE_REGISTER(FPRegister, NoFPReg, 0, 0, CPURegister::kNoRegister); |
| 331 INITIALIZE_REGISTER(CPURegister, NoCPUReg, 0, 0, CPURegister::kNoRegister); | 331 INITIALIZE_REGISTER(CPURegister, NoCPUReg, 0, 0, CPURegister::kNoRegister); |
| 332 | 332 |
| 333 // v8 compatibility. | 333 // v8 compatibility. |
| 334 INITIALIZE_REGISTER(Register, no_reg, 0, 0, CPURegister::kNoRegister); | 334 INITIALIZE_REGISTER(Register, no_reg, 0, 0, CPURegister::kNoRegister); |
| 335 | 335 |
| 336 #define DEFINE_REGISTERS(N) \ | 336 #define DEFINE_REGISTERS(N) \ |
| 337 INITIALIZE_REGISTER(Register, w##N, N, kWRegSize, CPURegister::kRegister); \ | 337 INITIALIZE_REGISTER(Register, w##N, N, \ |
| 338 INITIALIZE_REGISTER(Register, x##N, N, kXRegSize, CPURegister::kRegister); | 338 kWRegSizeInBits, CPURegister::kRegister); \ |
| 339 INITIALIZE_REGISTER(Register, x##N, N, \ |
| 340 kXRegSizeInBits, CPURegister::kRegister); |
| 339 REGISTER_CODE_LIST(DEFINE_REGISTERS) | 341 REGISTER_CODE_LIST(DEFINE_REGISTERS) |
| 340 #undef DEFINE_REGISTERS | 342 #undef DEFINE_REGISTERS |
| 341 | 343 |
| 342 INITIALIZE_REGISTER(Register, wcsp, kSPRegInternalCode, kWRegSize, | 344 INITIALIZE_REGISTER(Register, wcsp, kSPRegInternalCode, kWRegSizeInBits, |
| 343 CPURegister::kRegister); | 345 CPURegister::kRegister); |
| 344 INITIALIZE_REGISTER(Register, csp, kSPRegInternalCode, kXRegSize, | 346 INITIALIZE_REGISTER(Register, csp, kSPRegInternalCode, kXRegSizeInBits, |
| 345 CPURegister::kRegister); | 347 CPURegister::kRegister); |
| 346 | 348 |
| 347 #define DEFINE_FPREGISTERS(N) \ | 349 #define DEFINE_FPREGISTERS(N) \ |
| 348 INITIALIZE_REGISTER(FPRegister, s##N, N, kSRegSize, \ | 350 INITIALIZE_REGISTER(FPRegister, s##N, N, \ |
| 349 CPURegister::kFPRegister); \ | 351 kSRegSizeInBits, CPURegister::kFPRegister); \ |
| 350 INITIALIZE_REGISTER(FPRegister, d##N, N, kDRegSize, CPURegister::kFPRegister); | 352 INITIALIZE_REGISTER(FPRegister, d##N, N, \ |
| 353 kDRegSizeInBits, CPURegister::kFPRegister); |
| 351 REGISTER_CODE_LIST(DEFINE_FPREGISTERS) | 354 REGISTER_CODE_LIST(DEFINE_FPREGISTERS) |
| 352 #undef DEFINE_FPREGISTERS | 355 #undef DEFINE_FPREGISTERS |
| 353 | 356 |
| 354 #undef INITIALIZE_REGISTER | 357 #undef INITIALIZE_REGISTER |
| 355 | 358 |
| 356 // Registers aliases. | 359 // Registers aliases. |
| 357 ALIAS_REGISTER(Register, ip0, x16); | 360 ALIAS_REGISTER(Register, ip0, x16); |
| 358 ALIAS_REGISTER(Register, ip1, x17); | 361 ALIAS_REGISTER(Register, ip1, x17); |
| 359 ALIAS_REGISTER(Register, wip0, w16); | 362 ALIAS_REGISTER(Register, wip0, w16); |
| 360 ALIAS_REGISTER(Register, wip1, w17); | 363 ALIAS_REGISTER(Register, wip1, w17); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 void Remove(int code); | 492 void Remove(int code); |
| 490 | 493 |
| 491 // Remove all callee-saved registers from the list. This can be useful when | 494 // Remove all callee-saved registers from the list. This can be useful when |
| 492 // preparing registers for an AAPCS64 function call, for example. | 495 // preparing registers for an AAPCS64 function call, for example. |
| 493 void RemoveCalleeSaved(); | 496 void RemoveCalleeSaved(); |
| 494 | 497 |
| 495 CPURegister PopLowestIndex(); | 498 CPURegister PopLowestIndex(); |
| 496 CPURegister PopHighestIndex(); | 499 CPURegister PopHighestIndex(); |
| 497 | 500 |
| 498 // AAPCS64 callee-saved registers. | 501 // AAPCS64 callee-saved registers. |
| 499 static CPURegList GetCalleeSaved(unsigned size = kXRegSize); | 502 static CPURegList GetCalleeSaved(unsigned size = kXRegSizeInBits); |
| 500 static CPURegList GetCalleeSavedFP(unsigned size = kDRegSize); | 503 static CPURegList GetCalleeSavedFP(unsigned size = kDRegSizeInBits); |
| 501 | 504 |
| 502 // AAPCS64 caller-saved registers. Note that this includes lr. | 505 // AAPCS64 caller-saved registers. Note that this includes lr. |
| 503 static CPURegList GetCallerSaved(unsigned size = kXRegSize); | 506 static CPURegList GetCallerSaved(unsigned size = kXRegSizeInBits); |
| 504 static CPURegList GetCallerSavedFP(unsigned size = kDRegSize); | 507 static CPURegList GetCallerSavedFP(unsigned size = kDRegSizeInBits); |
| 505 | 508 |
| 506 // Registers saved as safepoints. | 509 // Registers saved as safepoints. |
| 507 static CPURegList GetSafepointSavedRegisters(); | 510 static CPURegList GetSafepointSavedRegisters(); |
| 508 | 511 |
| 509 bool IsEmpty() const { | 512 bool IsEmpty() const { |
| 510 ASSERT(IsValid()); | 513 ASSERT(IsValid()); |
| 511 return list_ == 0; | 514 return list_ == 0; |
| 512 } | 515 } |
| 513 | 516 |
| 514 bool IncludesAliasOf(const CPURegister& other1, | 517 bool IncludesAliasOf(const CPURegister& other1, |
| (...skipping 1653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2168 class EnsureSpace BASE_EMBEDDED { | 2171 class EnsureSpace BASE_EMBEDDED { |
| 2169 public: | 2172 public: |
| 2170 explicit EnsureSpace(Assembler* assembler) { | 2173 explicit EnsureSpace(Assembler* assembler) { |
| 2171 assembler->CheckBuffer(); | 2174 assembler->CheckBuffer(); |
| 2172 } | 2175 } |
| 2173 }; | 2176 }; |
| 2174 | 2177 |
| 2175 } } // namespace v8::internal | 2178 } } // namespace v8::internal |
| 2176 | 2179 |
| 2177 #endif // V8_A64_ASSEMBLER_A64_H_ | 2180 #endif // V8_A64_ASSEMBLER_A64_H_ |
| OLD | NEW |