1 | // Licensed to the .NET Foundation under one or more agreements. |
2 | // The .NET Foundation licenses this file to you under the MIT license. |
3 | // See the LICENSE file in the project root for more information. |
4 | |
5 | // clang-format off |
6 | |
7 | /*****************************************************************************/ |
8 | /*****************************************************************************/ |
9 | #ifndef REGDEF |
10 | #error Must define REGDEF macro before including this file |
11 | #endif |
12 | #ifndef REGALIAS |
13 | #define REGALIAS(alias, realname) |
14 | #endif |
15 | |
16 | #if defined(_TARGET_XARCH_) |
17 | |
18 | #if defined(_TARGET_X86_) |
19 | /* |
20 | REGDEF(name, rnum, mask, sname) */ |
21 | REGDEF(EAX, 0, 0x01, "eax" ) |
22 | REGDEF(ECX, 1, 0x02, "ecx" ) |
23 | REGDEF(EDX, 2, 0x04, "edx" ) |
24 | REGDEF(EBX, 3, 0x08, "ebx" ) |
25 | REGDEF(ESP, 4, 0x10, "esp" ) |
26 | REGDEF(EBP, 5, 0x20, "ebp" ) |
27 | REGDEF(ESI, 6, 0x40, "esi" ) |
28 | REGDEF(EDI, 7, 0x80, "edi" ) |
29 | REGALIAS(RAX, EAX) |
30 | REGALIAS(RCX, ECX) |
31 | REGALIAS(RDX, EDX) |
32 | REGALIAS(RBX, EBX) |
33 | REGALIAS(RSP, ESP) |
34 | REGALIAS(RBP, EBP) |
35 | REGALIAS(RSI, ESI) |
36 | REGALIAS(RDI, EDI) |
37 | |
38 | #else // !defined(_TARGET_X86_) |
39 | |
40 | /* |
41 | REGDEF(name, rnum, mask, sname) */ |
42 | REGDEF(RAX, 0, 0x0001, "rax" ) |
43 | REGDEF(RCX, 1, 0x0002, "rcx" ) |
44 | REGDEF(RDX, 2, 0x0004, "rdx" ) |
45 | REGDEF(RBX, 3, 0x0008, "rbx" ) |
46 | REGDEF(RSP, 4, 0x0010, "rsp" ) |
47 | REGDEF(RBP, 5, 0x0020, "rbp" ) |
48 | REGDEF(RSI, 6, 0x0040, "rsi" ) |
49 | REGDEF(RDI, 7, 0x0080, "rdi" ) |
50 | REGDEF(R8, 8, 0x0100, "r8" ) |
51 | REGDEF(R9, 9, 0x0200, "r9" ) |
52 | REGDEF(R10, 10, 0x0400, "r10" ) |
53 | REGDEF(R11, 11, 0x0800, "r11" ) |
54 | REGDEF(R12, 12, 0x1000, "r12" ) |
55 | REGDEF(R13, 13, 0x2000, "r13" ) |
56 | REGDEF(R14, 14, 0x4000, "r14" ) |
57 | REGDEF(R15, 15, 0x8000, "r15" ) |
58 | |
59 | REGALIAS(EAX, RAX) |
60 | REGALIAS(ECX, RCX) |
61 | REGALIAS(EDX, RDX) |
62 | REGALIAS(EBX, RBX) |
63 | REGALIAS(ESP, RSP) |
64 | REGALIAS(EBP, RBP) |
65 | REGALIAS(ESI, RSI) |
66 | REGALIAS(EDI, RDI) |
67 | |
68 | #endif // !defined(_TARGET_X86_) |
69 | |
70 | #ifdef _TARGET_AMD64_ |
71 | #define XMMBASE 16 |
72 | #define XMMMASK(x) (__int64(1) << (x+XMMBASE)) |
73 | #else // !_TARGET_AMD64_ |
74 | #define XMMBASE 8 |
75 | #define XMMMASK(x) (__int32(1) << (x+XMMBASE)) |
76 | #endif // !_TARGET_AMD64_ |
77 | |
78 | REGDEF(XMM0, 0+XMMBASE, XMMMASK(0), "mm0" ) |
79 | REGDEF(XMM1, 1+XMMBASE, XMMMASK(1), "mm1" ) |
80 | REGDEF(XMM2, 2+XMMBASE, XMMMASK(2), "mm2" ) |
81 | REGDEF(XMM3, 3+XMMBASE, XMMMASK(3), "mm3" ) |
82 | REGDEF(XMM4, 4+XMMBASE, XMMMASK(4), "mm4" ) |
83 | REGDEF(XMM5, 5+XMMBASE, XMMMASK(5), "mm5" ) |
84 | REGDEF(XMM6, 6+XMMBASE, XMMMASK(6), "mm6" ) |
85 | REGDEF(XMM7, 7+XMMBASE, XMMMASK(7), "mm7" ) |
86 | |
87 | #ifdef _TARGET_X86_ |
88 | REGDEF(STK, 8+XMMBASE, 0x0000, "STK" ) |
89 | #else // !_TARGET_X86_ |
90 | REGDEF(XMM8, 8+XMMBASE, XMMMASK(8), "mm8" ) |
91 | REGDEF(XMM9, 9+XMMBASE, XMMMASK(9), "mm9" ) |
92 | REGDEF(XMM10, 10+XMMBASE, XMMMASK(10), "mm10" ) |
93 | REGDEF(XMM11, 11+XMMBASE, XMMMASK(11), "mm11" ) |
94 | REGDEF(XMM12, 12+XMMBASE, XMMMASK(12), "mm12" ) |
95 | REGDEF(XMM13, 13+XMMBASE, XMMMASK(13), "mm13" ) |
96 | REGDEF(XMM14, 14+XMMBASE, XMMMASK(14), "mm14" ) |
97 | REGDEF(XMM15, 15+XMMBASE, XMMMASK(15), "mm15" ) |
98 | REGDEF(STK, 16+XMMBASE, 0x0000, "STK" ) |
99 | #endif // !_TARGET_X86_ |
100 | |
101 | #elif defined(_TARGET_ARM_) |
102 | #include "registerarm.h" |
103 | |
104 | #elif defined(_TARGET_ARM64_) |
105 | #include "registerarm64.h" |
106 | |
107 | #else |
108 | #error Unsupported or unset target architecture |
109 | #endif // target type |
110 | /*****************************************************************************/ |
111 | #undef REGDEF |
112 | #undef REGALIAS |
113 | #undef XMMMASK |
114 | /*****************************************************************************/ |
115 | |
116 | // clang-format on |
117 | |