blob: 11a4a5b964dcf8ae2d026cf67eb88b3a788c296f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
// Copyright 2020 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_COMPILER_BACKEND_REGISTER_ALLOCATION_H_
#define V8_COMPILER_BACKEND_REGISTER_ALLOCATION_H_
#include "src/codegen/register-configuration.h"
#include "src/zone/zone.h"
namespace v8 {
namespace internal {
namespace compiler {
enum class RegisterKind { kGeneral, kDouble };
inline int GetRegisterCount(const RegisterConfiguration* config,
RegisterKind kind) {
switch (kind) {
case RegisterKind::kGeneral:
return config->num_general_registers();
case RegisterKind::kDouble:
return config->num_double_registers();
}
}
inline int GetAllocatableRegisterCount(const RegisterConfiguration* config,
RegisterKind kind) {
switch (kind) {
case RegisterKind::kGeneral:
return config->num_allocatable_general_registers();
case RegisterKind::kDouble:
return config->num_allocatable_double_registers();
}
}
inline const int* GetAllocatableRegisterCodes(
const RegisterConfiguration* config, RegisterKind kind) {
switch (kind) {
case RegisterKind::kGeneral:
return config->allocatable_general_codes();
case RegisterKind::kDouble:
return config->allocatable_double_codes();
}
}
inline int ByteWidthForStackSlot(MachineRepresentation rep) {
switch (rep) {
case MachineRepresentation::kBit:
case MachineRepresentation::kWord8:
case MachineRepresentation::kWord16:
case MachineRepresentation::kWord32:
case MachineRepresentation::kFloat32:
case MachineRepresentation::kCagedPointer:
return kSystemPointerSize;
case MachineRepresentation::kTaggedSigned:
case MachineRepresentation::kTaggedPointer:
case MachineRepresentation::kTagged:
case MachineRepresentation::kCompressedPointer:
case MachineRepresentation::kCompressed:
// TODO(ishell): kTaggedSize once half size locations are supported.
return kSystemPointerSize;
case MachineRepresentation::kWord64:
case MachineRepresentation::kFloat64:
return kDoubleSize;
case MachineRepresentation::kSimd128:
return kSimd128Size;
case MachineRepresentation::kNone:
case MachineRepresentation::kMapWord:
break;
}
UNREACHABLE();
}
class RegisterAllocationData : public ZoneObject {
public:
enum Type {
kTopTier,
kMidTier,
};
Type type() const { return type_; }
protected:
explicit RegisterAllocationData(Type type) : type_(type) {}
private:
Type type_;
};
} // namespace compiler
} // namespace internal
} // namespace v8
#endif // V8_COMPILER_BACKEND_REGISTER_ALLOCATION_H_
|