blob: fe434a29f381e6334ac80b2e86fd054ffeac9641 (
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
|
// SPDX-License-Identifier: GPL-3.0-or-later
#ifndef HOME_RICHARD_CODE_RCC_PROJECT_BACKEND_UNITTESTS_TARGET_TESTTARGET_H
#define HOME_RICHARD_CODE_RCC_PROJECT_BACKEND_UNITTESTS_TARGET_TESTTARGET_H
#include "rcc/CodeGen/InstructionDescriptor.h"
#include "rcc/CodeGen/RegisterMask.h"
#include "rcc/CodeGen/TargetDescription.h"
#include "rcc/CodeGen/TargetMIRTextInfo.h"
#include "rcc/CodeGen/TargetRegisterInfo.h"
#include "rcc/Support/Error.h"
#include <cstdint>
#include <memory>
namespace rcc::test {
struct TestRegister final {
static constexpr std::uint32_t G0 = 1;
static constexpr std::uint32_t G0Low32 = 2;
static constexpr std::uint32_t G0High32 = 3;
static constexpr std::uint32_t G0Low16 = 4;
static constexpr std::uint32_t G1 = 5;
static constexpr std::uint32_t G1Low32 = 6;
static constexpr std::uint32_t G1High32 = 7;
static constexpr std::uint32_t G1Low16 = 8;
static constexpr std::uint32_t StackPointer = 9;
static constexpr std::uint32_t F0 = 10;
static constexpr std::uint32_t F1 = 11;
};
struct TestSubReg final {
static constexpr SubRegIndex Low32 = SubRegIndex::fromValue(1);
static constexpr SubRegIndex High32 = SubRegIndex::fromValue(2);
static constexpr SubRegIndex Low16 = SubRegIndex::fromValue(3);
};
struct TestRegisterBank final {
static constexpr RegisterBankID GPR = RegisterBankID::fromValue(1);
static constexpr RegisterBankID FPR = RegisterBankID::fromValue(2);
};
struct TestRegisterClass final {
static constexpr RegisterClassID GPR64 = RegisterClassID::fromValue(1);
static constexpr RegisterClassID GPR64Alloc = RegisterClassID::fromValue(2);
static constexpr RegisterClassID GPR32 = RegisterClassID::fromValue(3);
static constexpr RegisterClassID GPR32Low = RegisterClassID::fromValue(4);
static constexpr RegisterClassID GPR32High = RegisterClassID::fromValue(5);
static constexpr RegisterClassID GPR16 = RegisterClassID::fromValue(6);
static constexpr RegisterClassID FPR64 = RegisterClassID::fromValue(7);
static constexpr RegisterClassID SpecialGPR64 = RegisterClassID::fromValue(8);
};
[[nodiscard]] TargetRegisterInfoDesc createTestTargetRegisterInfoDescription();
[[nodiscard]] Expected<TargetRegisterInfo> createTestTargetRegisterInfo();
[[nodiscard]] TargetMIRTextInfoDesc createTestTargetMIRTextInfoDescription();
[[nodiscard]] Expected<TargetDescription> createTestTargetDescription(InstructionSet Instructions);
[[nodiscard]] std::shared_ptr<const RegisterMask> createTestCallPreservedMask();
} // namespace rcc::test
#endif // HOME_RICHARD_CODE_RCC_PROJECT_BACKEND_UNITTESTS_TARGET_TESTTARGET_H
|