Upstream version 11.40.271.0
[platform/framework/web/crosswalk.git] / src / v8 / src / compiler / register-configuration.h
1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef V8_COMPILER_REGISTER_CONFIGURATION_H_
6 #define V8_COMPILER_REGISTER_CONFIGURATION_H_
7
8 #include "src/v8.h"
9
10 namespace v8 {
11 namespace internal {
12 namespace compiler {
13
14 // An architecture independent representation of the sets of registers available
15 // for instruction creation.
16 class RegisterConfiguration {
17  public:
18   // Architecture independent maxes.
19   static const int kMaxGeneralRegisters = 32;
20   static const int kMaxDoubleRegisters = 32;
21
22   static const RegisterConfiguration* ArchDefault();
23
24   RegisterConfiguration(int num_general_registers, int num_double_registers,
25                         int num_aliased_double_registers,
26                         const char* const* general_register_name,
27                         const char* const* double_register_name);
28
29   int num_general_registers() const { return num_general_registers_; }
30   int num_double_registers() const { return num_double_registers_; }
31   int num_aliased_double_registers() const {
32     return num_aliased_double_registers_;
33   }
34
35   const char* general_register_name(int offset) const {
36     DCHECK(offset >= 0 && offset < kMaxGeneralRegisters);
37     return general_register_names_[offset];
38   }
39   const char* double_register_name(int offset) const {
40     DCHECK(offset >= 0 && offset < kMaxDoubleRegisters);
41     return double_register_names_[offset];
42   }
43
44  private:
45   const int num_general_registers_;
46   const int num_double_registers_;
47   const int num_aliased_double_registers_;
48   const char* const* general_register_names_;
49   const char* const* double_register_names_;
50 };
51
52 }  // namespace compiler
53 }  // namespace internal
54 }  // namespace v8
55
56 #endif  // V8_COMPILER_REGISTER_CONFIGURATION_H_