/ assembler / RegisterInfo.h
RegisterInfo.h
 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/Assertions.h>
30  
31  /* This file serves as the platform independent redirection header for
32   * platform dependent register information. Each architecture has its own header.
33   *
34   * Each header defines a few important macros that are used in a platform independent
35   * way - see for example jit/RegisterSet.cpp.
36   * - FOR_EACH_GP_REGISTER which lists all available general purpose registers.
37   * - FOR_EACH_FP_REGISTER which lists all available floating point registers.
38   * these take themselves a macro that can filter through the available information
39   * spread accross the four macro arguments.
40   * = 1. id: is an identifier used to specify the register (for example, as an enumerator
41   * in an enum);
42   * = 2. name: is a string constant specifying the name of the identifier;
43   * = 3. isReserved: a boolean (usually 0/1) specifying if this is a reserved register;
44   * = 4. isCalleeSaved: a boolean (usually 0/1) specifying if this is a callee saved register;
45   *
46   * - A few other platform dependent macros can be specified to be used in platform
47   *   dependent files (for example assembler X86Assembler.h).
48   */
49  
50  #if CPU(X86)
51  #include "X86Registers.h"
52  #elif CPU(X86_64)
53  #include "X86_64Registers.h"
54  #elif CPU(MIPS)
55  #include "MIPSRegisters.h"
56  #elif CPU(ARM_THUMB2)
57  #include "ARMv7Registers.h"
58  #elif CPU(ARM64)
59  #include "ARM64Registers.h"
60  #else
61      UNREACHABLE_FOR_PLATFORM();
62  #endif