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/*
20REGDEF(name, rnum, mask, sname) */
21REGDEF(EAX, 0, 0x01, "eax" )
22REGDEF(ECX, 1, 0x02, "ecx" )
23REGDEF(EDX, 2, 0x04, "edx" )
24REGDEF(EBX, 3, 0x08, "ebx" )
25REGDEF(ESP, 4, 0x10, "esp" )
26REGDEF(EBP, 5, 0x20, "ebp" )
27REGDEF(ESI, 6, 0x40, "esi" )
28REGDEF(EDI, 7, 0x80, "edi" )
29REGALIAS(RAX, EAX)
30REGALIAS(RCX, ECX)
31REGALIAS(RDX, EDX)
32REGALIAS(RBX, EBX)
33REGALIAS(RSP, ESP)
34REGALIAS(RBP, EBP)
35REGALIAS(RSI, ESI)
36REGALIAS(RDI, EDI)
37
38#else // !defined(_TARGET_X86_)
39
40/*
41REGDEF(name, rnum, mask, sname) */
42REGDEF(RAX, 0, 0x0001, "rax" )
43REGDEF(RCX, 1, 0x0002, "rcx" )
44REGDEF(RDX, 2, 0x0004, "rdx" )
45REGDEF(RBX, 3, 0x0008, "rbx" )
46REGDEF(RSP, 4, 0x0010, "rsp" )
47REGDEF(RBP, 5, 0x0020, "rbp" )
48REGDEF(RSI, 6, 0x0040, "rsi" )
49REGDEF(RDI, 7, 0x0080, "rdi" )
50REGDEF(R8, 8, 0x0100, "r8" )
51REGDEF(R9, 9, 0x0200, "r9" )
52REGDEF(R10, 10, 0x0400, "r10" )
53REGDEF(R11, 11, 0x0800, "r11" )
54REGDEF(R12, 12, 0x1000, "r12" )
55REGDEF(R13, 13, 0x2000, "r13" )
56REGDEF(R14, 14, 0x4000, "r14" )
57REGDEF(R15, 15, 0x8000, "r15" )
58
59REGALIAS(EAX, RAX)
60REGALIAS(ECX, RCX)
61REGALIAS(EDX, RDX)
62REGALIAS(EBX, RBX)
63REGALIAS(ESP, RSP)
64REGALIAS(EBP, RBP)
65REGALIAS(ESI, RSI)
66REGALIAS(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
78REGDEF(XMM0, 0+XMMBASE, XMMMASK(0), "mm0" )
79REGDEF(XMM1, 1+XMMBASE, XMMMASK(1), "mm1" )
80REGDEF(XMM2, 2+XMMBASE, XMMMASK(2), "mm2" )
81REGDEF(XMM3, 3+XMMBASE, XMMMASK(3), "mm3" )
82REGDEF(XMM4, 4+XMMBASE, XMMMASK(4), "mm4" )
83REGDEF(XMM5, 5+XMMBASE, XMMMASK(5), "mm5" )
84REGDEF(XMM6, 6+XMMBASE, XMMMASK(6), "mm6" )
85REGDEF(XMM7, 7+XMMBASE, XMMMASK(7), "mm7" )
86
87#ifdef _TARGET_X86_
88REGDEF(STK, 8+XMMBASE, 0x0000, "STK" )
89#else // !_TARGET_X86_
90REGDEF(XMM8, 8+XMMBASE, XMMMASK(8), "mm8" )
91REGDEF(XMM9, 9+XMMBASE, XMMMASK(9), "mm9" )
92REGDEF(XMM10, 10+XMMBASE, XMMMASK(10), "mm10" )
93REGDEF(XMM11, 11+XMMBASE, XMMMASK(11), "mm11" )
94REGDEF(XMM12, 12+XMMBASE, XMMMASK(12), "mm12" )
95REGDEF(XMM13, 13+XMMBASE, XMMMASK(13), "mm13" )
96REGDEF(XMM14, 14+XMMBASE, XMMMASK(14), "mm14" )
97REGDEF(XMM15, 15+XMMBASE, XMMMASK(15), "mm15" )
98REGDEF(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