| 1 | /* |
| 2 | * Copyright (C) 2019 Metrological Group B.V. |
| 3 | * Copyright (C) 2019 Igalia S.L. |
| 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions |
| 7 | * are met: |
| 8 | * 1. Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer. |
| 10 | * 2. Redistributions in binary form must reproduce the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer in the |
| 12 | * documentation and/or other materials provided with the distribution. |
| 13 | * |
| 14 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY |
| 15 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 17 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR |
| 18 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 19 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 20 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 21 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 22 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 24 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 25 | */ |
| 26 | |
| 27 | #pragma once |
| 28 | |
| 29 | #include <wtf/Compiler.h> |
| 30 | #include <wtf/Platform.h> |
| 31 | |
| 32 | #define RegisterNames X86Registers |
| 33 | |
| 34 | #if !OS(WINDOWS) |
| 35 | |
| 36 | #define FOR_EACH_GP_REGISTER(macro) \ |
| 37 | macro(eax, "rax", 0, 0) \ |
| 38 | macro(ecx, "rcx", 0, 0) \ |
| 39 | macro(edx, "rdx", 0, 0) \ |
| 40 | macro(ebx, "rbx", 0, 1) \ |
| 41 | macro(esp, "rsp", 0, 0) \ |
| 42 | macro(ebp, "rbp", 0, 1) \ |
| 43 | macro(esi, "rsi", 0, 0) \ |
| 44 | macro(edi, "rdi", 0, 0) \ |
| 45 | macro(r8, "r8", 0, 0) \ |
| 46 | macro(r9, "r9", 0, 0) \ |
| 47 | macro(r10, "r10", 0, 0) \ |
| 48 | macro(r11, "r11", 0, 0) \ |
| 49 | macro(r12, "r12", 0, 1) \ |
| 50 | macro(r13, "r13", 0, 1) \ |
| 51 | macro(r14, "r14", 0, 1) \ |
| 52 | macro(r15, "r15", 0, 1) |
| 53 | |
| 54 | #else // OS(WINDOWS) |
| 55 | |
| 56 | #define FOR_EACH_GP_REGISTER(macro) \ |
| 57 | macro(eax, "rax", 0, 0) \ |
| 58 | macro(ecx, "rcx", 0, 0) \ |
| 59 | macro(edx, "rdx", 0, 0) \ |
| 60 | macro(ebx, "rbx", 0, 1) \ |
| 61 | macro(esp, "rsp", 0, 0) \ |
| 62 | macro(ebp, "rbp", 0, 1) \ |
| 63 | macro(esi, "rsi", 0, 1) \ |
| 64 | macro(edi, "rdi", 0, 1) \ |
| 65 | macro(r8, "r8", 0, 0) \ |
| 66 | macro(r9, "r9", 0, 0) \ |
| 67 | macro(r10, "r10", 0, 0) \ |
| 68 | macro(r11, "r11", 0, 0) \ |
| 69 | macro(r12, "r12", 0, 1) \ |
| 70 | macro(r13, "r13", 0, 1) \ |
| 71 | macro(r14, "r14", 0, 1) \ |
| 72 | macro(r15, "r15", 0, 1) |
| 73 | |
| 74 | #endif // !OS(WINDOWS) |
| 75 | |
| 76 | #define FOR_EACH_FP_REGISTER(macro) \ |
| 77 | macro(xmm0, "xmm0", 0, 0) \ |
| 78 | macro(xmm1, "xmm1", 0, 0) \ |
| 79 | macro(xmm2, "xmm2", 0, 0) \ |
| 80 | macro(xmm3, "xmm3", 0, 0) \ |
| 81 | macro(xmm4, "xmm4", 0, 0) \ |
| 82 | macro(xmm5, "xmm5", 0, 0) \ |
| 83 | macro(xmm6, "xmm6", 0, 0) \ |
| 84 | macro(xmm7, "xmm7", 0, 0) \ |
| 85 | macro(xmm8, "xmm8", 0, 0) \ |
| 86 | macro(xmm9, "xmm9", 0, 0) \ |
| 87 | macro(xmm10, "xmm10", 0, 0) \ |
| 88 | macro(xmm11, "xmm11", 0, 0) \ |
| 89 | macro(xmm12, "xmm12", 0, 0) \ |
| 90 | macro(xmm13, "xmm13", 0, 0) \ |
| 91 | macro(xmm14, "xmm14", 0, 0) \ |
| 92 | macro(xmm15, "xmm15", 0, 0) |
| 93 | |
| 94 | #define FOR_EACH_SP_REGISTER(macro) \ |
| 95 | macro(eip, "eip", 0, 0) \ |
| 96 | macro(eflags, "eflags", 0, 0) |
| 97 | |